Skip to contents

Calculates goodness-of-fit metrics (MSE, RMSE, MAE, R2) on preprocessed data, supporting fine-grained control over feature and target preprocessing states.

Usage

ml_evaluate(object, ...)

# S4 method for class 'feature_data'
ml_evaluate(
  object,
  model,
  subset = c("all", "test", "train"),
  xprep = c("both", "scale", "transform", "none"),
  yprep = c("both", "scale", "transform", "none"),
  to_original_scale = FALSE,
  ...
)

Arguments

object

A `feature_data` object.

...

Additional arguments passed to `predict()`.

model

A fitted machine learning model (e.g., Keras, nnet, lm).

subset

Data subset to evaluate (`"all"`, `"train"`, or `"test"`).

xprep

Preprocessing state for predictor features (`"both"`, `"scale"`, `"transform"`, `"none"`).

yprep

Preprocessing state for target variable (`"both"`, `"scale"`, `"transform"`, `"none"`).

to_original_scale

Logical; if `TRUE`, evaluates performance on original physical units (overrides `yprep` to `"none"` for target comparison).

Value

A named numeric vector of evaluation metrics (MSE, RMSE, MAE, R2).

Details

Bias (Mean Error) is calculated as mean(observed - predicted). Positive values indicate systematic underprediction by the model.

Methods (by class)

  • ml_evaluate(feature_data): Evaluate performance metrics for a `feature_data` object.