From e356827d6e99e449f6edddfb34189baf0c5ce892 Mon Sep 17 00:00:00 2001 From: Fabian Pedregosa <fabian.pedregosa@inria.fr> Date: Sat, 26 Jun 2010 08:28:50 -0500 Subject: [PATCH] Remove benchmarking code from lasso example. --- examples/glm/plot_lasso_coordinate_descent_path.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/examples/glm/plot_lasso_coordinate_descent_path.py b/examples/glm/plot_lasso_coordinate_descent_path.py index 7940f1fadf..74c0d51e6d 100644 --- a/examples/glm/plot_lasso_coordinate_descent_path.py +++ b/examples/glm/plot_lasso_coordinate_descent_path.py @@ -10,25 +10,17 @@ coordinate descent. # Author: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD Style. -from datetime import datetime from itertools import cycle import numpy as np import pylab as pl from scikits.learn.glm import lasso_path, enet_path -n_samples, n_features, maxit = 442, 10, 50 - -from scikits.learn import datasets - +n_samples, n_features = 100, 10 np.random.seed(0) y = np.random.randn(n_samples) X = np.random.randn(n_samples, n_features) -data = datasets.load_diabetes() -X = data.data -y = data.target - ################################################################################ # Fit models ################################################################################ @@ -40,16 +32,12 @@ y = data.target eps = 1e-2 # the smaller it is the longer is the path print "Computing regularization path using the lasso..." -start = datetime.now() models = lasso_path(X, y, eps=eps) -print "This took ", datetime.now() - start alphas_lasso = np.array([model.alpha for model in models]) coefs_lasso = np.array([model.coef_ for model in models]) print "Computing regularization path using the elastic net..." -start = datetime.now() models = enet_path(X, y, eps=eps, rho=0.6) -print "This took ", datetime.now() - start alphas_enet = np.array([model.alpha for model in models]) coefs_enet = np.array([model.coef_ for model in models]) -- GitLab