using Cross Validation in matlab with neural networks
Ältere Kommentare anzeigen
I want to make a cross validation on neural network, I tried to pass the labels to "crossval" function, with the help of "cvpartition" as follows :
%type is the label of data, features is the feature vector
p = cvpartition(type,'k',10);
regf=@(XTRAIN,ytrain,XTEST)(predfun(XTRAIN,ytrain,XTEST));
cvMse = crossval('mcr',features',type,'predfun',regf,'partition',cp);
My problems is that I can't pass the labels of my data to "cvpartition" since that function requires only a vector, and each label in the neural network must be a vector. put all labels together gives you a matrix N-by-L where N is the number of feature vectors and L is the number of classes.
I have tried to pass a character or string, which will be converted in regf function to label vectors to fit with neural network but the problem is that Matlab convert all labels to nominal class, which is especial type of data can't be compared, or calculated (i.e you cant do if(type == 'a')), the matlab will give you an error). So I have to pass the N-by-L vector to cvpartition .
Antworten (0)
Kategorien
Mehr zu Get Started with Statistics and Machine Learning Toolbox finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!