acc: Accuracy of the Model

Description Usage Arguments Value Examples

View source: R/modeling.R

Description

Calculates the accuracy of the model by taking the mean of the number of times the truth, y, equals the predicted, y hat.

Usage

1
acc(y, yhat)

Arguments

y

A vector of the true y values

yhat

A vector of predicted y hat values.

Value

The accuracy of the classification in numeric form.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Set seed for reproducibility
set.seed(100)

# Generate data
n = 1e2

y = round(runif(n))
yhat = round(runif(n))

# Compute
o = acc(y, yhat)

jjb documentation built on Jan. 8, 2020, 5:07 p.m.