Metrics

An R package for common supervised machine learning metrics.

92
21
R

Metrics

Build Status
CRAN_Status_Badge
Downloads

How to Install this Package

This package is distributed from CRAN. From the R prompt, run install.packages("Metrics").

Metrics Repo

This repository contains code for the Metrics package in R. Metrics was created by Ben Hamner and came from this github repo. Hamner’s repo contains packages for common machine learning metrics in several programming languages, not just R. On 2017-04-21, CRAN orphaned the R package. To revive the status of the R package, I cloned the original and created this repo. I have added new metrics, improved documentation, and fixed bugs. This repository will be the home of active development on the Metrics R package moving forward.

Community Feedback

If you notice anything wrong with the Metrics package or have any ideas on how to improve it, please create an issue in this github repository that describes your issue. I also welcome improvements to this package via a pull request. This is a simple R package, which makes it perfect for first time open source contributors. Here is a guide that walks you through how to make an open source contribution.

What Metrics are Included in this Package?

All functions in the Metrics package take at least two arguments: actual and predicted. In the table below, I abbreviate actual as x and predicted as y for the sake of mathematical brevity.

Metric Type Metric Name Function Name Formula
regression Squared Error se equation
regression Mean Squared Error mse equation
regression Root Mean Squared Error rmse equation
regression Absolute Error ae equation
regression Mean Absolute Error mae equation
regression Absolute Percent Error ape equation
regression Mean Absolute Percent Error mape equation
regression Symmetric Mean Absolute Percent Error smape equation
regression Squared Log Error sle equation
regression Mean Squared Log Error msle equation
regression Root Mean Squared Log Error rmsle equation
regression Relative Squared Error rse equation
regression Root Relative Squared Error rrse equation
regression Relative Absolute Error rae equation
time series Mean Absolute Scaled Error mase equation
classification Classification Error ce equation
classification Accuracy accuracy equation
classification F1 Score f1 equation
binary classification Area Under ROC Curve auc equation. help(auc) for details.
binary classification Log Loss ll equation
binary classification Mean Log Loss logloss equation
binary classification Precision precision equation
binary classification Recall recall equation
binary classification F-beta Score fbeta_score equation