diff --git a/R/DESCRIPTION b/R/DESCRIPTION index eece20a..2cca014 100644 --- a/R/DESCRIPTION +++ b/R/DESCRIPTION @@ -10,3 +10,4 @@ Author: Ben Hamner License: BSD Collate: 'metrics.r' +RoxygenNote: 5.0.1 diff --git a/R/NAMESPACE b/R/NAMESPACE index bb1943d..d4e8362 100644 --- a/R/NAMESPACE +++ b/R/NAMESPACE @@ -1,20 +1,22 @@ +# Generated by roxygen2: do not edit by hand + +export(MeanQuadraticWeightedKappa) +export(ScoreQuadraticWeightedKappa) export(ae) export(apk) export(auc) export(ce) +export(f1) export(ll) export(logLoss) export(mae) export(mapk) -export(MeanQuadraticWeightedKappa) export(mse) export(msle) +export(rae) export(rmse) export(rmsle) -export(ScoreQuadraticWeightedKappa) +export(rrse) +export(rse) export(se) export(sle) -export(rse) -export(rrse) -export(rae) -export(f1) diff --git a/R/R/metrics.r b/R/R/metrics.r index 3d8ad57..7a29add 100644 --- a/R/R/metrics.r +++ b/R/R/metrics.r @@ -8,7 +8,7 @@ #' @export se <- function (actual, predicted) (actual-predicted)^2 -#' Compute the mean squared error#' +#' Compute the mean squared error #' This function computes the mean squared error between #' two vectors #' @@ -17,7 +17,7 @@ se <- function (actual, predicted) (actual-predicted)^2 #' @export mse <- function (actual, predicted) mean(se(actual, predicted)) -#' Compute the root mean squared error#' +#' Compute the root mean squared error #' This function computes the root mean squared error #' between two vectors #' @@ -26,7 +26,7 @@ mse <- function (actual, predicted) mean(se(actual, predicted)) #' @export rmse <- function (actual, predicted) sqrt(mse(actual, predicted)) -#' Compute the absolute error#' +#' Compute the absolute error #' This function computes the elementwise absolute error for a #' number or a vector #' @@ -35,7 +35,7 @@ rmse <- function (actual, predicted) sqrt(mse(actual, predicted)) #' @export ae <- function (actual, predicted) abs(actual-predicted) -#' Compute the mean absolute error#' +#' Compute the mean absolute error #' This function computes the mean absolte error between #' two vectors #' diff --git a/R/man/MeanQuadraticWeightedKappa.Rd b/R/man/MeanQuadraticWeightedKappa.Rd index 9d6604f..5d2ed92 100644 --- a/R/man/MeanQuadraticWeightedKappa.Rd +++ b/R/man/MeanQuadraticWeightedKappa.Rd @@ -1,16 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{MeanQuadraticWeightedKappa} \alias{MeanQuadraticWeightedKappa} \title{Compute the mean quadratic weighted kappa} \usage{ - MeanQuadraticWeightedKappa(kappas, weights) +MeanQuadraticWeightedKappa(kappas, weights) } \arguments{ - \item{kappas}{is a vector of possible kappas} +\item{kappas}{is a vector of possible kappas} - \item{weights}{is an optional vector of ratings} +\item{weights}{is an optional vector of ratings} } \description{ - This function computes the mean quadratic weighted kappa, - which can optionally be weighted +This function computes the mean quadratic weighted +kappa, which can optionally be weighted } diff --git a/R/man/ScoreQuadraticWeightedKappa.Rd b/R/man/ScoreQuadraticWeightedKappa.Rd index eb47a0d..ce14b8f 100644 --- a/R/man/ScoreQuadraticWeightedKappa.Rd +++ b/R/man/ScoreQuadraticWeightedKappa.Rd @@ -1,21 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{ScoreQuadraticWeightedKappa} \alias{ScoreQuadraticWeightedKappa} \title{Compute the quadratic weighted kappa} \usage{ - ScoreQuadraticWeightedKappa(rater.a, rater.b, min.rating, - max.rating) +ScoreQuadraticWeightedKappa(rater.a, rater.b, min.rating, max.rating) } \arguments{ - \item{rater.a}{is the first rater's ratings} +\item{rater.a}{is the first rater's ratings} - \item{rater.b}{is the second rater's ratings} +\item{rater.b}{is the second rater's ratings} - \item{min.rating}{is the minimum possible rating} +\item{min.rating}{is the minimum possible rating} - \item{max.rating}{is the maximum possible rating} +\item{max.rating}{is the maximum possible rating} } \description{ - This function computes the quadratic weighted kappa - between two vectors of integers +This function computes the quadratic weighted kappa +between two vectors of integers } diff --git a/R/man/ae.Rd b/R/man/ae.Rd index 36de0e5..b8c4d70 100644 --- a/R/man/ae.Rd +++ b/R/man/ae.Rd @@ -1,18 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{ae} \alias{ae} -\title{Compute the absolute error#' +\title{Compute the absolute error This function computes the elementwise absolute error for a number or a vector} \usage{ - ae(actual, predicted) +ae(actual, predicted) } \arguments{ - \item{actual}{ground truth number or vector} +\item{actual}{ground truth number or vector} - \item{predicted}{predicted number or vector} +\item{predicted}{predicted number or vector} } \description{ - Compute the absolute error#' This function computes the - elementwise absolute error for a number or a vector +Compute the absolute error +This function computes the elementwise absolute error for a +number or a vector } diff --git a/R/man/apk.Rd b/R/man/apk.Rd index d9f1da3..5697e34 100644 --- a/R/man/apk.Rd +++ b/R/man/apk.Rd @@ -1,18 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{apk} \alias{apk} \title{Compute the average precision at k} \usage{ - apk(k, actual, predicted) +apk(k, actual, predicted) } \arguments{ - \item{k}{max length of predicted sequence} +\item{k}{max length of predicted sequence} - \item{actual}{ground truth set (vector)} +\item{actual}{ground truth set (vector)} - \item{predicted}{predicted sequence (vector)} +\item{predicted}{predicted sequence (vector)} } \description{ - This function computes the average precision at k between - two sequences +This function computes the average precision at k +between two sequences } diff --git a/R/man/auc.Rd b/R/man/auc.Rd index 7ea2e91..1ee054b 100644 --- a/R/man/auc.Rd +++ b/R/man/auc.Rd @@ -1,17 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{auc} \alias{auc} \title{Compute the area under the ROC (AUC)} \usage{ - auc(actual, predicted) +auc(actual, predicted) } \arguments{ - \item{actual}{binary vector} +\item{actual}{binary vector} - \item{predicted}{real-valued vector that defines the - ranking} +\item{predicted}{real-valued vector that defines the ranking} } \description{ - This function computes the area under the - receiver-operator characteristic (AUC) +This function computes the area under the receiver-operator +characteristic (AUC) } diff --git a/R/man/ce.Rd b/R/man/ce.Rd index 5f25816..1c44a67 100644 --- a/R/man/ce.Rd +++ b/R/man/ce.Rd @@ -1,16 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{ce} \alias{ce} \title{Compute the classification error} \usage{ - ce(actual, predicted) +ce(actual, predicted) } \arguments{ - \item{actual}{ground truth vector} +\item{actual}{ground truth vector} - \item{predicted}{predicted vector} +\item{predicted}{predicted vector} } \description{ - This function computes the classification error between - two vectors +This function computes the classification error +between two vectors } diff --git a/R/man/f1.Rd b/R/man/f1.Rd index ff92f0a..024fce6 100644 --- a/R/man/f1.Rd +++ b/R/man/f1.Rd @@ -1,15 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{f1} \alias{f1} -\title{Compute the f1 score} +\title{Compute the f1 score +This function computes the f1 score between +two vectors.} \usage{ - f1(actual, predicted) +f1(actual, predicted) } \arguments{ - \item{actual}{ground truth vector} - - \item{predicted}{predicted vector} +\item{actual}{ground truth vector} + +\item{predicted}{predicted vector} } \description{ - This function computes the f1 score given the actual and predicted vectors. - f1 score is calculated after calculating Precision and Recall from the two vectors. +Compute the f1 score +This function computes the f1 score between +two vectors. } + diff --git a/R/man/ll.Rd b/R/man/ll.Rd index 010f8ac..8edc55b 100644 --- a/R/man/ll.Rd +++ b/R/man/ll.Rd @@ -1,16 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{ll} \alias{ll} \title{Compute the log loss} \usage{ - ll(actual, predicted) +ll(actual, predicted) } \arguments{ - \item{actual}{binary ground truth number or vector} +\item{actual}{binary ground truth number or vector} - \item{predicted}{predicted number or vector} +\item{predicted}{predicted number or vector} } \description{ - This function computes the elementwise log loss for a - number or a vector +This function computes the elementwise log loss for a +number or a vector } diff --git a/R/man/logLoss.Rd b/R/man/logLoss.Rd index 647dc2b..ad927a8 100644 --- a/R/man/logLoss.Rd +++ b/R/man/logLoss.Rd @@ -1,16 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{logLoss} \alias{logLoss} \title{Compute the mean log loss} \usage{ - logLoss(actual, predicted) +logLoss(actual, predicted) } \arguments{ - \item{actual}{binary ground truth vector} +\item{actual}{binary ground truth vector} - \item{predicted}{predicted vector} +\item{predicted}{predicted vector} } \description{ - This function computes the mean log loss between two - vectors +This function computes the mean log loss between +two vectors } diff --git a/R/man/mae.Rd b/R/man/mae.Rd index b039e7d..568f59d 100644 --- a/R/man/mae.Rd +++ b/R/man/mae.Rd @@ -1,18 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{mae} \alias{mae} -\title{Compute the mean absolute error#' +\title{Compute the mean absolute error This function computes the mean absolte error between two vectors} \usage{ - mae(actual, predicted) +mae(actual, predicted) } \arguments{ - \item{actual}{ground truth vector} +\item{actual}{ground truth vector} - \item{predicted}{vector} +\item{predicted}{vector} } \description{ - Compute the mean absolute error#' This function computes - the mean absolte error between two vectors +Compute the mean absolute error +This function computes the mean absolte error between +two vectors } diff --git a/R/man/mapk.Rd b/R/man/mapk.Rd index 72aa5e0..aa744b7 100644 --- a/R/man/mapk.Rd +++ b/R/man/mapk.Rd @@ -1,18 +1,20 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{mapk} \alias{mapk} \title{Compute the mean average precision at k} \usage{ - mapk(k, actual, predicted) +mapk(k, actual, predicted) } \arguments{ - \item{k}{max length of predicted sequence} +\item{k}{max length of predicted sequence} - \item{actual}{list of ground truth sets (vectors)} +\item{actual}{list of ground truth sets (vectors)} - \item{predicted}{list of predicted sequences (vectors)} +\item{predicted}{list of predicted sequences (vectors)} } \description{ - This function computes the mean average precision at k of - two lists of sequences. +This function computes the mean average precision at k +of two lists of sequences. } diff --git a/R/man/mse.Rd b/R/man/mse.Rd index dda963b..1b91d08 100644 --- a/R/man/mse.Rd +++ b/R/man/mse.Rd @@ -1,18 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{mse} \alias{mse} -\title{Compute the mean squared error#' +\title{Compute the mean squared error This function computes the mean squared error between two vectors} \usage{ - mse(actual, predicted) +mse(actual, predicted) } \arguments{ - \item{actual}{ground truth vector} +\item{actual}{ground truth vector} - \item{predicted}{predicted vector} +\item{predicted}{predicted vector} } \description{ - Compute the mean squared error#' This function computes - the mean squared error between two vectors +Compute the mean squared error +This function computes the mean squared error between +two vectors } diff --git a/R/man/msle.Rd b/R/man/msle.Rd index 125cbfe..88da271 100644 --- a/R/man/msle.Rd +++ b/R/man/msle.Rd @@ -1,16 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{msle} \alias{msle} \title{Compute the mean squared log error} \usage{ - msle(actual, predicted) +msle(actual, predicted) } \arguments{ - \item{actual}{ground truth vector} +\item{actual}{ground truth vector} - \item{predicted}{predicted vector} +\item{predicted}{predicted vector} } \description{ - This function computes the mean squared log error between - two vectors +This function computes the mean squared log error between +two vectors } diff --git a/R/man/rae.Rd b/R/man/rae.Rd index 207a6d3..138d127 100644 --- a/R/man/rae.Rd +++ b/R/man/rae.Rd @@ -1,21 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{rae} \alias{rae} \title{Compute the relative absolute error} \usage{ - rae(actual, predicted) +rae(actual, predicted) } \arguments{ - \item{actual}{ground truth vector} +\item{actual}{ground truth vector} - \item{predicted}{predicted vector} +\item{predicted}{predicted vector} } \description{ - This function computes the relative absolute error between two vectors. - The relative absolute error is just the total absolute error, - normalized by the error of the simple predictor that predicts - the average values, as described in Witten et al. (2011). -} -\references{ - Witten, Ian H, Eibe Frank, and Mark Hall (2011). Data Mining: Practical - Machine Learning Tools and Techniques. 3rd ed. Morgan Kaufman, p. 180. +This function computes the relative absolute error between +two vectors } + diff --git a/R/man/rmse.Rd b/R/man/rmse.Rd index 6605bc0..d7f28d8 100644 --- a/R/man/rmse.Rd +++ b/R/man/rmse.Rd @@ -1,18 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{rmse} \alias{rmse} -\title{Compute the root mean squared error#' +\title{Compute the root mean squared error This function computes the root mean squared error between two vectors} \usage{ - rmse(actual, predicted) +rmse(actual, predicted) } \arguments{ - \item{actual}{ground truth vector} +\item{actual}{ground truth vector} - \item{predicted}{predicted vector} +\item{predicted}{predicted vector} } \description{ - Compute the root mean squared error#' This function - computes the root mean squared error between two vectors +Compute the root mean squared error +This function computes the root mean squared error +between two vectors } diff --git a/R/man/rmsle.Rd b/R/man/rmsle.Rd index f5aa9bc..d49ae49 100644 --- a/R/man/rmsle.Rd +++ b/R/man/rmsle.Rd @@ -1,16 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{rmsle} \alias{rmsle} \title{Compute the root mean squared log error} \usage{ - rmsle(actual, predicted) +rmsle(actual, predicted) } \arguments{ - \item{actual}{ground truth vector} +\item{actual}{ground truth vector} - \item{predicted}{predicted vector} +\item{predicted}{predicted vector} } \description{ - This function computes the root mean squared log error - between two vectors +This function computes the root mean squared log error between +two vectors } diff --git a/R/man/rrse.Rd b/R/man/rrse.Rd index 9697d05..fa73f97 100644 --- a/R/man/rrse.Rd +++ b/R/man/rrse.Rd @@ -1,21 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{rrse} \alias{rrse} \title{Compute the root relative squared error} \usage{ - rrse(actual, predicted) +rrse(actual, predicted) } \arguments{ - \item{actual}{ground truth vector} +\item{actual}{ground truth vector} - \item{predicted}{predicted vector} +\item{predicted}{predicted vector} } \description{ - This function computes the root relative squared error between two vectors. - The root relative squared error is relative to what it would have been - if a simple predictor had been used. This simple predictor is - just the average of the actual values, as described in Witten et al. (2011). -} -\references{ - Witten, Ian H, Eibe Frank, and Mark Hall (2011). Data Mining: Practical - Machine Learning Tools and Techniques. 3rd ed. Morgan Kaufman, p. 180. +This function computes the root relative squared error between +two vectors } + diff --git a/R/man/rse.Rd b/R/man/rse.Rd index 16bdfd1..6b48b53 100644 --- a/R/man/rse.Rd +++ b/R/man/rse.Rd @@ -1,21 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{rse} \alias{rse} \title{Compute the relative squared error} \usage{ - rse(actual, predicted) +rse(actual, predicted) } \arguments{ - \item{actual}{ground truth vector} +\item{actual}{ground truth vector} - \item{predicted}{predicted vector} +\item{predicted}{predicted vector} } \description{ - This function computes the relative squared error between two vectors. - The relative squared error is relative to what it would have been - if a simple predictor had been used. This simple predictor is - just the average of the actual values, as described in Witten et al. (2011). -} -\references{ - Witten, Ian H, Eibe Frank, and Mark Hall (2011). Data Mining: Practical - Machine Learning Tools and Techniques. 3rd ed. Morgan Kaufman, p. 180. +This function computes the relative squared error between +two vectors } + diff --git a/R/man/se.Rd b/R/man/se.Rd index a442714..93d7979 100644 --- a/R/man/se.Rd +++ b/R/man/se.Rd @@ -1,16 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{se} \alias{se} \title{Compute the squared error} \usage{ - se(actual, predicted) +se(actual, predicted) } \arguments{ - \item{actual}{ground truth number or vector} +\item{actual}{ground truth number or vector} - \item{predicted}{predicted number or vector} +\item{predicted}{predicted number or vector} } \description{ - This function computes the elementwise squared error for - a number or a vector +This function computes the elementwise squared error for a +number or a vector } diff --git a/R/man/sle.Rd b/R/man/sle.Rd index 87b5198..6dbf121 100644 --- a/R/man/sle.Rd +++ b/R/man/sle.Rd @@ -1,16 +1,18 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/metrics.r \name{sle} \alias{sle} \title{Compute the squared log error} \usage{ - sle(actual, predicted) +sle(actual, predicted) } \arguments{ - \item{actual}{ground truth number or vector} +\item{actual}{ground truth number or vector} - \item{predicted}{predicted number or vector} +\item{predicted}{predicted number or vector} } \description{ - This function computes the elementwise squared log error - for a number or a vector +This function computes the elementwise squared log error for a +number or a vector }