0
votes

I have 300 data samples with around 4000 dimension feature each. Each input has a 5 dim. output which is in the range of -2 to 2. I am trying to fit a lasso model to it. I went through a few posts which talk about cross validation strategies like this one: Leave one out cross validation algorithm in matlab

But I saw that lasso does not support leaveout in Matlab! http://www.mathworks.com/help/stats/lasso.html

How can I train a model using leave one out cross validation and fit a model using lasso on my dataset? I am trying to do this in matlab. I would like to get a set of weights which I will be able to use for future predictions on other data.

I tried using glmnet: http://www.stanford.edu/~hastie/glmnet_matlab/intro.html but I couldn't compile it on my machine due to lack of proper mex compiler.

Any solutions to my problem? Thanks :)

EDIT

I am also trying to use lasso function in-built with MATLAB. It has an option to perform cross validation. It outputs B and Fit Statistics, where B is Fitted coefficients, a p-by-L matrix, where p is the number of predictors (columns) in X, and L is the number of Lambda values.

Now given a new test sample, how can I calculate the output using this model?

1

1 Answers

0
votes

You can use a leave-one-out approach regardless of your training method. As explained here, you can use crossvalind to split the data into training and test sets.

[Train, Test] = crossvalind('LeaveMOut', N, M)