R/regr_ae.R

Defines functions .ae ae

Documented in ae

#' @title Absolute Error (per observation)
#'
#' @details
#' Calculates the per-observation absolute error as \deqn{
#'   \left| t_i - r_i \right|.
#' }{
#'   abs(t - r).
#' }
#'
#' @templateVar mid ae
#' @template regr_template
#' @inheritParams regr_params
#'
#' @export
ae = function(truth, response, ...) {
  assert_regr(truth, response)
  .ae(truth, response)
}

.ae = function(truth, response) {
  abs(truth - response)
}

#' @include measures.R
add_measure(ae, "Absolute Error (per observation)", "regr", 0, Inf, TRUE, aggregated = FALSE)
mlr-org/mlr3measures documentation built on Sept. 12, 2024, 6:35 p.m.