# MetricsWeighted v0.3.0

0

0th

Percentile

## Weighted Metrics, Scoring Functions and Performance Measures for Machine Learning

Provides weighted versions of several metrics, scoring functions and performance measures used in machine learning, including average unit deviances of the Bernoulli, Tweedie, Poisson, and Gamma distributions, see Jorgensen B. (1997, ISBN: 978-0412997112). The package also contains a weighted version of generalized R-squared, see e.g. Cohen, J. et al. (2002, ISBN: 978-0805822236). Furthermore, 'dplyr' chains are supported.

# MetricsWeighted

The goal of this package is to provide weighted versions of metrics, scoring functions and performance measures for machine learning.

## Installation

You can install the released version of MetricsWeighted from CRAN with:

install.packages("MetricsWeighted")


To get the bleeding edge version, you can run

library(devtools)
install_github("mayer79/MetricsWeighted")


## Application

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.

## Example 1: Directly apply the metrics

library(MetricsWeighted)

y <- 1:10
pred <- c(2:10, 14)

rmse(y, pred)
rmse(y, pred, w = 1:10)

r_squared(y, pred)
r_squared(y, pred, deviance_function = deviance_gamma)


## Example 2: Call the metrics through a common function that can be used within a dplyr chain

dat <- data.frame(y = y, pred = pred)

performance(dat, actual = "y", predicted = "pred")
performance(dat, actual = "y", predicted = "pred", metrics = r_squared)
performance(dat, actual = "y", predicted = "pred",
metrics = list(rmse = rmse, R-squared = r_squared))


## Functions in MetricsWeighted

 Name Description precision Precision recall Recall rmse Root-Mean-Squared Error deviance_normal Normal Deviance r_squared Pseudo R-Squared weighted_median Weighted Median weighted_mean Weighted Mean mape Mean Absolute Percentage Error medae Median Absolute Error performance Performance weighted_var Weighted Variance mse Mean-Squared Error weighted_quantile Weighted Quantiles logLoss Log Loss/Binary Cross Entropy mae Mean Absolute Error deviance_poisson Poisson Deviance AUC Area under the ROC classification_error Classification Error deviance_gamma Gamma Deviance deviance_tweedie Tweedie Deviance deviance_bernoulli Bernoulli Deviance accuracy Accuracy f1_score F1 Score gini_coefficient Gini Coefficient No Results!