How can i use Random Forest classifier ?

21 ビュー (過去 30 日間)
kerem hacisabanoglu
kerem hacisabanoglu 2018 年 12 月 15 日
コメント済み: adel medrar 2022 年 2 月 28 日
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.

回答 (1 件)

zineb kaoudja
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);
  1 件のコメント
adel medrar
adel medrar 2022 年 2 月 28 日
thank you

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeClassification についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by