Unrecognized method, property, or field 'OOBError' for class 'TreeBagger'.

3 ビュー (過去 30 日間)
Sanchit
Sanchit 2023 年 7 月 9 日
回答済み: Walter Roberson 2023 年 7 月 9 日
% Print the calculated metrics
rf_classifier = TreeBagger(100, X_train, y_train,'Method','classification','OOBPrediction', 'On');
Unrecognized method, property, or field 'OOBError' for class 'TreeBagger'.
Error in RF_Classification (line 39)
oob_error = rf_classifier.OOBError;
Undefined function 'mean_squared_error' for input arguments of type 'table'.
Error in RF_Classification (line 40)
oob_mse = mean_squared_error(y_train, predict(rf_classifier, X_train));
Any help to fix above errors would be highly appreciated.
Sanchit

回答 (1 件)

Walter Roberson
Walter Roberson 2023 年 7 月 9 日
oob_error = rf_classifier.oobError;
There is no property or method named OOBError for TreeBagger objects; there is a method oobError() for TreeBagger objects.

カテゴリ

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

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by