Issues with CV function in lasso

Hi there,
I am trying to run lasso on a small data set of metabolites, and keep getting an error when it comes to the cross validation.
Here is my code:
x=data;
y=phase;
[B,STATS]=lasso(x,y,'CV',10);
axTrace=lassoPlot(B,STATS);
axCV=lassoPlot(B,STATS,'PlotType','CV');
minMSEModel=STATS.PredictorNames(B(:,STATS.IndexMinMSE)~=0)
sparseModel=STATS.PredictorNames(B(:,STATS.Index1SE)~=0)
And here is my error message:
Warning: This format of input to CROSSVAL may be removed in the future. See 'help crossval'.
> In crossval (line 313)
In lasso (line 517)
In Lasso (line 3)
Undefined operator ':' for input arguments of type 'cvpartition'.
Error in crossval (line 405)
ncompvector = 1:ncomp;
Error in lasso (line 517)
cvMSE = crossval(cvfun,[weights(:) X],Y, ...
Error in Lasso (line 3)
[B,STATS]=lasso(x,y,'CV',10);
This how I have normally run lasso in the past, and appears to also be what is suggested online. Please help!

回答(0 个)

类别

产品

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by