Skip to content

Instantly share code, notes, and snippets.

@karlnapf
Created June 6, 2013 15:25
Show Gist options
  • Save karlnapf/5722391 to your computer and use it in GitHub Desktop.
Save karlnapf/5722391 to your computer and use it in GitHub Desktop.
LARS segfault
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