Skip to content

Instantly share code, notes, and snippets.

@Micky774
Created March 18, 2022 22:50
Show Gist options
  • Save Micky774/abb729c34a7760c602e42ee648d6d35d to your computer and use it in GitHub Desktop.
Save Micky774/abb729c34a7760c602e42ee648d6d35d to your computer and use it in GitHub Desktop.
`cda_fast` benchmark
import warnings
from sklearn.exceptions import ConvergenceWarning
warnings.filterwarnings("ignore", category=ConvergenceWarning)
from sklearn.linear_model import Lasso
import numpy as np
import time
clf = Lasso(max_iter=200)
n_samples = 500000
n_features = 200
X = np.random.rand(n_samples, n_features)
y = np.ones((n_samples, 1))
y = y.ravel()
def _time_fit(i):
start_time = time.time()
clf.fit(X, y)
return time.time() - start_time
iter = 10
times = np.array([_time_fit(i) for i in range(iter)])
print(f"{times=}\n{times.mean():.2f}+-{times.std():.2f}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment