Skip to contents

Model-performance assessment implemented as a function distinct from training. Supports several built-in metrics and user-supplied custom metrics.

Usage

morie_ml_assess(
  fit,
  x,
  y,
  metrics = if (fit$type == "logistic") c("accuracy", "roc_auc", "brier") else c("rmse",
    "mae", "r2"),
  custom = NULL
)

Arguments

fit

A morie_ml_fit.

x

Predictors.

y

True responses.

metrics

Character vector of built-in metric names ("accuracy", "roc_auc", "brier", "rmse", "mae", "r2").

custom

Optional named list of function(y, pred) custom metrics (ML5.4b).

Value

A named numeric vector of metric values.

Examples

m <- morie_ml_train(morie_ml_model("linear", "gd"),
                    mtcars[c("hp", "wt")], mtcars$mpg)
morie_ml_assess(m, mtcars[c("hp", "wt")], mtcars$mpg,
                metrics = c("rmse", "r2"))
#>      rmse        r2 
#> 2.4688545 0.8267855