i have a dataset of 100×6,i want to classify these and find the accuracy using random forest and mlp ,i have classifeid using svm and knn,but dont know how to do with MLP and random forest ,please do help
Best Answer
For Neural Net classification, see the documentation for patternnet and the classification demo example.
In particular, 2nd example for crossval herehttp://www.mathworks.com/help/toolbox/stats/crossval.html shows what you need to do. You would need to replace the function handle classf in that example with a function which has two lines of code in it: 1) Train a TreeBagger on Xtrain and Ytrain, and 2) Predict labels for Xtest using the trained TreeBagger.
In your code snippet, the error is caused by TreeBagger returning predicted class labels as a cell array of strings, while the class labels (groups variable) passed to classperf are numeric. To avoid this, convert groups to a cell array of strings:
Best Answer