crossval with multiple linear model
4 views (last 30 days)
Show older comments
Hey all,
Currently, I am trying to build a crossvalidated linear model. I have started with the crossval function ... but I dont really understand the function...
I thought this one might be the right one.. vals = crossval(fun,X,Y,...) is used when data are stored in separate variables X, Y, ... . All variables (column vectors, matrices, or arrays) must have the same number of rows. fun is called with the training subsets of X, Y, ... , followed by the test subsets of X, Y, ... , as follows:
testvals = fun(XTRAIN,YTRAIN,...,XTEST,YTEST,...)
Normally I would built my linear model in the following way:
>> load('fisheriris'); Y = species; X = meas; mdl=fitlm(X,Y)
Now using the trying to get the crossvalidated model I started the following testvals=fun(XTRAIN,YTRAIN,...XTEST,YTEST,...); vals=crossval(fun, X,Y,...)
But this doesnt work unfortunately....
Anyone any ideas?
Thank you!!
0 Comments
Answers (0)
See Also
Categories
Find more on Gaussian Process Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!