Skip to contents

Records the feature schema and per-feature training ranges, then calls fit_model(x, y) on the (optionally imputed and scaled) numeric matrix. Imputation and scaling use column means / standard deviations learned on x.

Usage

fit_scoring_pipeline(
  x,
  y,
  fit_model,
  feature_names = names(x),
  impute = FALSE,
  scale = FALSE,
  metadata = list(),
  strict = TRUE
)

Arguments

x

Training data frame (numeric feature columns).

y

Outcome vector.

fit_model

function(x, y) returning a function(x) that gives the positive-class probability.

feature_names

Columns of x to use (default: all, in order).

impute

If TRUE, missing values are replaced by the training column mean.

scale

If TRUE, features are standardised with the training mean and standard deviation.

metadata

Free-form list stored with the bundle (cohort definition, git sha, training dates, ...).

strict

If TRUE (default) columns not in the schema raise an error instead of being dropped.

Value

An omop_scoring_pipeline.