matlab code for mean_squared_error

4 ビュー (過去 30 日間)
Sanchit
Sanchit 2023 年 7 月 9 日
コメント済み: Walter Roberson 2023 年 7 月 9 日
oob_mse = mean_squared_error(y_train, predict(rf_classifier, X_train));
I need matlab code for mean_squared_error.
Please provide me.
Thanks.
Sanchit
  4 件のコメント
Sanchit
Sanchit 2023 年 7 月 9 日
Error using immse
Expected input number 1, A, to be one of these types:
uint8, int8, uint16, int16, uint32, int32, single, double
Instead its type was table.
Error in immse (line 28)
validateattributes(x,{'uint8', 'int8', 'uint16', 'int16', 'uint32', 'int32', ...
Error in sample (line 17)
oob_mse = immse(y_train, predict(rf_classifier, X_train));
How to convert table into number array?
Sanchit

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

採用された回答

Walter Roberson
Walter Roberson 2023 年 7 月 9 日
oob_mse = rmse(predict(rf_classifier, X_train), y_train);
... as I discussed in one of your other postings.
  2 件のコメント
Sanchit
Sanchit 2023 年 7 月 9 日
Error using matlab.internal.math.parseErrorMetricsInput
Invalid data type. First and second arguments must be double or single arrays.
Error in rmse (line 46)
matlab.internal.math.parseErrorMetricsInput(false,F,A,varargin{:});
Error in sample (line 18)
oob_mse = rmse(predict(rf_classifier, X_train), y_train);
Please suggest me how to fix it.
Sanchit
Walter Roberson
Walter Roberson 2023 年 7 月 9 日
You are continuing to use tables for your training data. I showed you in https://www.mathworks.com/matlabcentral/answers/1993558-i-am-attaching-the-matlab-code-and-input-file-and-request-to-make-it-workable#answer_1269743 how to assign to X and y to avoid those problems.

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

その他の回答 (1 件)

Prasannavenkatesh
Prasannavenkatesh 2023 年 7 月 9 日
Hi Sanchit,
You can use the existing immse function in matlab (https://in.mathworks.com/help/images/ref/immse.html) for calculating the mean squared error. Hope this helps.
  2 件のコメント
Sanchit
Sanchit 2023 年 7 月 9 日
Brace indexing into the result of a function call is not supported. Assign the result of 'immse' to a
variable first, then brace index into it.
Error in sample (line 17)
oob_mse = immse{y_train, predict(rf_classifier, X_train)};
Please suggest me how to fix this error.
Thanks for your help.
Sanchit
Walter Roberson
Walter Roberson 2023 年 7 月 9 日
oob_mse = immse(y_train, predict(rf_classifier, X_train));

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

カテゴリ

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

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by