R/regr_sse.R

Defines functions sse

Documented in sse

#' @title Sum of Squared Errors
#'
#' @details
#' The Sum of Squared Errors is defined as \deqn{
#'   \sum_{i=1}^n \left( t_i - r_i \right)^2.
#' }{
#'   sum((t - r)^2).
#' }
#'
#' @templateVar mid sse
#' @template regr_template
#'
#' @inheritParams regr_params
#' @template regr_example
#' @export
sse = function(truth, response, ...) {
  assert_regr(truth, response = response)
  sum(.se(truth, response))
}

#' @include measures.R
add_measure(sse, "Sum of Squared Errors", "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.