This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| The most atomic way to train and run inference for a GPT in pure, dependency-free Python. | |
| This file is the complete algorithm. | |
| Everything else is just efficiency. | |
| @karpathy | |
| """ | |
| import os # os.path.exists | |
| import math # math.log, math.exp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Efficient implementation of FISTA. | |
| """ | |
| # Author: Mathieu Blondel | |
| # License: BSD 3 clause | |
| import numpy as np | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # | |
| # Solve LASSO regression problem with ISTA and FISTA | |
| # iterative solvers. | |
| # Author : Alexandre Gramfort, first.last@telecom-paristech.fr | |
| # License BSD | |
| import time | |
| from math import sqrt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| from scipy import linalg, optimize | |
| MAX_ITER = 100 | |
| def group_lasso(X, y, alpha, groups, max_iter=MAX_ITER, rtol=1e-6, | |
| verbose=False): | |
| """ | |
| Linear least-squares with l2/l1 regularization solver. |