Why immse function is giving error?

4 次查看(过去 30 天)
Sanchit
Sanchit 2023-7-9
评论: Sanchit 2023-7-9
I am getting following error while using immse function for computing mean square error
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)
I am attaching the matlab code along with input file. Please suggest me how to fix this error.
Sanchit
  1 个评论
Sanchit
Sanchit 2023-7-9
% Create a Random Forest classifier
rf_classifier = TreeBagger(100, X_train, y_train, 'OOBPrediction', 'On');
predicted = predict(rf_classifier, X_train);
oob_mse = immse(y_train, predicted);
disp(sprintf('Out-of-Bag Mean Square Error: %.4f', oob_mse(end)));
I am getting following error while using immse function for computing mean square error
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)
I am attaching the matlab code along with input file. Please suggest me how to fix this error.
Sanchit

请先登录,再进行评论。

回答(1 个)

Prasannavenkatesh
Hi Sanchit,
The error message indicates that the input argument expected by the "immse" function is not of the correct data type. In this case, the error message suggests that the input argument is a table data type, which is not one of the supported data types for the "immse" function. The "immse" function only supports data types such as uint8, int8, uint16, int16, uint32, int32, single, and double.
To resolve this error, you need to make sure that the input argument is of one of the supported data types. Convert the input argument to one of the data types supported by the immse function to solve the error.

Community Treasure Hunt

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

Start Hunting!

Translated by