To calculate the % of true values between two arrays, you can use the following code in MATLAB:
main.m319 chars13 lines
This code first calculates the RMSE between the y_true
and y_pred
arrays using the formula sqrt(mean((y_true - y_pred).^2))
.
Then, the code calculates the % of true values by counting the number of times y_pred
is exactly equal to y_true
and dividing by the length of the arrays, multiplied by 100 to get a percentage.
The code outputs the RMSE and % true values using the disp
function.
gistlibby LogSnag