compileml.reference

fit_reference

def fit_reference(X, y, *, kind: str = 'woe_logit', feature_names=None, max_bins: int = 8, min_samples_leaf: float = 0.02, cv: int = 3, C_grid=(0.01, 0.1, 1.0, 10.0), random_state: int = 42) -> compileml.reference.woe.ReferenceModel

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#

NameTypeDefaultKind
X—requiredpositional
y—requiredpositional
kindstr'woe_logit'keyword-only
feature_names—Nonekeyword-only
max_binsint8keyword-only
min_samples_leaffloat0.02keyword-only
cvint3keyword-only
C_grid—(0.01, 0.1, 1.0, 10.0)keyword-only
random_stateint42keyword-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#

python
from compileml.reference import fit_reference
from compileml.validate import validate_artifact
 
ref = fit_reference(X_train, y_train)
report = validate_artifact(artifact, X_holdout, y_holdout, reference=ref)

Worked example: fit_reference →