Why immse function is giving error?

6 visualizaciones (últimos 30 días)
Sanchit
Sanchit el 9 de Jul. de 2023
Comentada: Sanchit el 9 de Jul. de 2023
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 comentario
Sanchit
Sanchit el 9 de Jul. de 2023
% 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

Iniciar sesión para comentar.

Respuestas (1)

Prasannavenkatesh
Prasannavenkatesh el 9 de Jul. de 2023
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.

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by