fit_reference
from compileml.reference import fit_reference
Fit the reference model a compiled artifact ought to beat.
Args:
X: Training rows.
y: Binary outcomes.
kind: Only "woe_logit" today — supervised binning,
weight-of-evidence encoding, then logistic regression.
max_bins: Maximum bins per feature (shallow by design).
cv: Folds used to choose C. The WOE tables are refit inside each
fold, so the choice is not made against leaked encodings.
Returns: A :class:`ReferenceModel` carrying the fitted pipeline plus the tables and information values that make it reviewable.
Parameters#
| Name | Type | Default | Kind |
|---|---|---|---|
| X | — | required | positional |
| y | — | required | positional |
| kind | str | 'woe_logit' | keyword-only |
| feature_names | — | None | keyword-only |
| max_bins | int | 8 | keyword-only |
| min_samples_leaf | float | 0.02 | keyword-only |
| cv | int | 3 | keyword-only |
| C_grid | — | (0.01, 0.1, 1.0, 10.0) | keyword-only |
| random_state | int | 42 | keyword-only |
Returns#
compileml.reference.woe.ReferenceModel
Raises#
- ValueError
Read from the function body and the private helpers it calls, not inferred. A function that raises nothing has no section here.
Example#
from compileml.reference import fit_referencefrom compileml.validate import validate_artifact ref = fit_reference(X_train, y_train)report = validate_artifact(artifact, X_holdout, y_holdout, reference=ref)