Why immse function is giving error?

6 visualizzazioni (ultimi 30 giorni)
Sanchit
Sanchit il 9 Lug 2023
Commentato: Sanchit il 9 Lug 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 Commento
Sanchit
Sanchit il 9 Lug 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

Accedi per commentare.

Risposte (1)

Prasannavenkatesh
Prasannavenkatesh il 9 Lug 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.

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by