0
votes

I have got stuck in doing crossvalidation in svm in matlab.

I wanted to generate 5 fold stratified cross-validation and want to reset the random number generator at each run in order to be sure that I select always the same samples in the folds .Don't want to train on different samples as I wish to tune my svm parameters .

Whats the variable that can be used for doing so in Matlab or in lib svm?

I found a relevant variable in python called random_state : None, int or RandomState If I set random state to none I wll get the same set of data so that I could fine tune my svm parameters. Is there a similar process in matlab?

Link: http://scikit-learn.org/stable/modules/generated/sklearn.cross_validation.KFold.html#sklearn.cross_vali dation.KFold

2

2 Answers

0
votes

You can use the Matlab function crossvalind: http://www.mathworks.com/help/bioinfo/ref/crossvalind.html Hope this helps!

0
votes

This would depend on what release of MATLAB you are using, but in relatively current releases you can issue this command:

rng default

If you want more specific control than that, try "help rng" for more information.