How can i use Random Forest classifier ?
21 ビュー (過去 30 日間)
古いコメントを表示
I know that sounds stupid but im very very very new to matlab and i have a homework to do. Basicly i searched whole internet to find out for a basic example of using Random Forest. https://ch.mathworks.com/help/stats/treebagger.html#bvf7_tc-1 this one helped me a little but im still confused about the usage. I understand that i need to use NumPredictorsToSample but how ? can somebody please show me a VERY simple syntax and show me which piece of code does what. Im very desperate.
0 件のコメント
回答 (1 件)
zineb kaoudja
2019 年 8 月 6 日
%Tr is the training samples
%cl1 is the class label for the training images
%Ts is the testing samples
%cl2 is the class label for the test images
nTrees=500;
B = TreeBagger(nTrees,Tr,cl1, 'Method', 'classification');
predChar1 = B.predict(Ts); % Predictions is a char though. We want it to be a number.
c = str2double(predChar1);
consistency=sum(c==cl2)/length(cl2);
参考
カテゴリ
Help Center および File Exchange で Classification についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!