Undefined function 'mean_squared_error' for input arguments of type 'table'.

27 ビュー (過去 30 日間)
Sanchit
Sanchit 2023 年 7 月 9 日
回答済み: Walter Roberson 2023 年 7 月 9 日
rf_classifier = TreeBagger(100, X_train, y_train,'Method','classification','OOBPredictorImportance', 'On');
Undefined function 'mean_squared_error' for input arguments of type 'table'.
Error in RF_Classification (line 39)
oob_mse = mean_squared_error(y_train, predict(rf_classifier, X_train));
Undefined function 'loss' for input arguments of type 'TreeBagger'.
Error in RF_Classification (line 45)
test_accuracy = 1 - loss(rf_classifier, X_test, y_test);
I request you to kindly help me out to fix these above errors.
Thank you very much.
Sanchit Singh

回答 (1 件)

Walter Roberson
Walter Roberson 2023 年 7 月 9 日
When you call TreeBagger there are two different syntaxes:
TreeBagger(NUMBER, X, Y)
or
TreeBagger(NUMBER, TABLE, ...)
You are using the NUMBER, X, Y syntax, but your y_train is a table()

カテゴリ

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