Skip to contents

Validates the frame against the bundle's feature contract (validate_feature_frame()), fills remaining NA with each feature's impute value, blends and calibrates. Mirror of Python score_cohort.

Usage

score_cohort(
  bundle,
  features,
  key_columns = NULL,
  on_violation = "raise",
  return_validation = FALSE,
  check_concepts = NULL,
  unit_check = FALSE
)

Arguments

bundle

A model_bundle or a bundle directory path.

features

A data.frame, or the path of a .csv / .parquet file (parquet needs the arrow package).

key_columns

Columns to return alongside the score (default: non-feature columns ending in _id).

on_violation

"raise", "clip" or "nullify".

return_validation

If TRUE, return list(scores =, validation =).

check_concepts

A DBI connection, a registry or a registry JSON file: first check the custom concept ids recorded in the bundle's feature spec against this site's (validate_bundle_concepts()) and stop on a mismatch.

unit_check

If TRUE, warn when a lab's median is more than 3x off the reference median (check_unit_sanity()).

Value

A data.frame with the key columns, prob and risk_tier.