Created
June 6, 2013 15:25
-
-
Save karlnapf/5722391 to your computer and use it in GitHub Desktop.
LARS segfault
This file contains 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
from numpy.ma.core import reshape, mean | |
from shogun.Features import RegressionLabels, RealFeatures | |
from shogun.Regression import LeastAngleRegression, LinearRidgeRegression, LeastSquaresRegression | |
from shogun.Evaluation import CrossValidation, CrossValidationResult, \ | |
CrossValidationSplitting, MeanSquaredError | |
import time | |
n=250 | |
n_class=6 | |
dim=274 * 100 * 12 | |
feats=randn(dim, n) | |
lab=randint(0,n_class, n) | |
# normalise | |
lab_mean=mean(lab) | |
lab=lab-lab_mean | |
feats=(feats.T-mean(feats,1)).T | |
features = RealFeatures(feats) | |
labels = RegressionLabels(lab) | |
lars = LeastAngleRegression() | |
lars.set_labels(labels) | |
time_start=time.time() | |
lars.train(RealFeatures(features)) | |
time_end=time.time() | |
print "time", time_end-time_start | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment