Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

prop_within

Proportion Within


Description

Calculates weighted proportion of predictions that are within a given tolerance around the actual values. The larger the value, the better.

Usage

prop_within(actual, predicted, w = NULL, tol = 1, ...)

Arguments

actual

Observed values.

predicted

Predicted values.

w

Optional case weights.

tol

Predictions in the closed interval from actual - tol to actual + tol count as within.

...

Further arguments passed to weighted_mean.

Value

A numeric vector of length one.

Examples

prop_within(1:10, c(1:9, 12))
prop_within(1:10, c(1:9, 12), w = rep(1, 10))
prop_within(1:10, c(1:9, 12), w = 1:10)
data <- data.frame(act = 1:10, pred = c(1:9, 12), w = 1:10)
multi <- multi_metric(fun = prop_within, tol = 0:3)
performance(data, actual = "act", predicted = "pred", w = "w",
  metrics = multi, key = "Proportion within")

MetricsWeighted

Weighted Metrics, Scoring Functions and Performance Measures for Machine Learning

v0.5.2
GPL (>= 2)
Authors
Michael Mayer [aut, cre, cph], Christian Lorentzen [ctb, rev]
Initial release
2021-04-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.