loss_calculate: Calculate Loss Based on Selected Objective Function

View source: R/objective_function.R

loss_calculateR Documentation

Calculate Loss Based on Selected Objective Function

Description

Compute the loss between predictive and actual values using a selected objective function. Supported objecive functions used in this functions are: "SMAPE', "MAPE", "RMSE", and "MAE".

Usage

loss_calculate(preds, actuals, objective)

Arguments

preds

A numeric vector of predicted values.

actuals

A numeric vector of actual (true) values.

objective

A string character that indicates the loss function type: "SMAPE", "MAPE", "RMSE", or "MAE".

Value

A numeric value that represent the computed loss.

Examples

preds <- c(80, 120, 180)
actuals <- c(95, 115, 177)
loss_calculate(preds, actuals, "RMSE")


metaSVR documentation built on Aug. 21, 2025, 5:58 p.m.