powered by
Calculates the accuracy of the model by taking the mean of the number of times the truth, \(y\), equals the predicted, \(\hat{y}\).
acc(y, yhat)
A vector of the true \(y\) values
vector
A vector of predicted \(\hat{y}\) values.
The accuracy of the classification in numeric form.
numeric
# NOT RUN { # Set seed for reproducibility set.seed(100) # Generate data n = 1e2 y = round(runif(n)) yhat = round(runif(n)) # Compute o = acc(y, yhat) # }
Run the code above in your browser using DataLab