crossval with multiple linear model

1 Ansicht (letzte 30 Tage)
Tania
Tania am 10 Aug. 2014
Bearbeitet: Tania am 10 Aug. 2014
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!!

Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by