R/regr_medse.R

Defines functions medse

Documented in medse

#' @title Median Squared Error
#'
#' @details
#' The Median Squared Error is defined as \deqn{
#'   \mathop{\mathrm{median}} \left[ \left( t_i - r_i \right)^2 \right].
#' }{
#'   median((t - r)^2).
#' }
#'
#' @templateVar mid medse
#' @template regr_template
#'
#' @inheritParams regr_params
#' @template regr_example
#' @export
medse = function(truth, response, ...) {
  assert_regr(truth, response = response)
  median(.se(truth, response))
}

#' @include measures.R
add_measure(medse, "Median Squared Error", "regr", 0, Inf, TRUE, obs_loss = "se")

Try the mlr3measures package in your browser

Any scripts or data that you put into this service are public.

mlr3measures documentation built on Sept. 12, 2024, 7:20 a.m.