{MetricsWeighted} provides weighted and unweighted versions of metrics and performance measures for machine learning.
# From CRAN
install.packages("MetricsWeighted")
# Development version
devtools::install_github("mayer79/MetricsWeighted")
There are two ways to apply the package. We will go through them in the following examples. Please have a look at the vignette on CRAN for further information and examples.
Useful, e.g., in a {dplyr} chain.
dat <- data.frame(y = y, pred = pred)
performance(dat, actual = "y", predicted = "pred")
> metric value
> rmse 1.581139
performance(
dat,
actual = "y",
predicted = "pred",
metrics = list(rmse = rmse, `R-squared` = r_squared)
)
> metric value
> rmse 1.5811388
> R-squared 0.6969697
Check out the vignette for more applications.