compileml

compile_selected

def compile_selected(X, y, *, ceiling=None, ceiling_oof=None, ceiling_scores=None, ceiling_budget: dict | None = None, reference='woe', partitions='stratified', date=None, group=None, row_id=None, grid: dict | None = None, monotone_constraints=None, selection_metric: str = 'gini', tie_se: float = 1.0, n_boot: int = 200, k_folds: int = 5, min_select_events: int = 300, n_bands: int = 10, feature_names=None, reasons: dict | None = None, sample_weight=None, allow_below_floor: bool = False, eps_warn: float = 10.0, duplicate_threshold: float = 0.01, backend: str = 'hist', learning_rate: float = 0.2, seed: int = 42, build_kwargs: dict | None = None) -> compileml.select.SelectionResult

from compileml import compile_selected

Compile the whitebox whose target and configuration were chosen on Select.

Args: X, y: All rows and binary outcomes; the function partitions them. ceiling: A callable (X_fit, y_fit) -> fitted model. It is called once, its configuration is frozen, and that configuration is refit k_folds times for cross-fitted soft targets. One search plus K fits — never K searches. ceiling_oof, ceiling_scores: For users who can only supply predictions: out-of-fold predictions used as soft targets, and the ceiling's scores used for retention, both full-length. Provenance then records cross_fitted: "user_asserted". ceiling_budget: Free-form dict recorded in provenance — trials, CV scheme, search space — so retention is comparable across artifacts. reference: "woe" fits the WoE logistic floor inside Fit; a float is a champion scorecard's Gini; None skips the floor gate, with a warning. partitions: "stratified", or an explicit dict of index arrays. date, group, row_id: Arrays (or column names, when X has columns). date makes Report the latest slice; group keeps one applicant in one partition; row_id turns partition overlap into a hard failure. grid: See :func:`default_grid`. selection_metric: "gini" (default) or "brier". tie_se: Width of the tie band in standard errors. min_select_events: Below this many events in Select, selection uses nested cross-validation over Fit ∪ Select instead, with a warning. allow_below_floor: Build the artifact even if the selected configuration does not beat the floor on Select. eps_warn: Provisional events-per-split threshold below which the grid should hold interior α values; a diagnostic, never an input. duplicate_threshold: Maximum share of Select and Report rows whose content also appears in an earlier partition. backend: "hist" (the fast histogram backend) or "gbr".

Returns: A :class:`SelectionResult`. Call .report() once for the figure.

Parameters#

NameTypeDefaultKind
X—requiredpositional
y—requiredpositional
ceiling—Nonekeyword-only
ceiling_oof—Nonekeyword-only
ceiling_scores—Nonekeyword-only
ceiling_budgetdict | NoneNonekeyword-only
reference—'woe'keyword-only
partitions—'stratified'keyword-only
date—Nonekeyword-only
group—Nonekeyword-only
row_id—Nonekeyword-only
griddict | NoneNonekeyword-only
monotone_constraints—Nonekeyword-only
selection_metricstr'gini'keyword-only
tie_sefloat1.0keyword-only
n_bootint200keyword-only
k_foldsint5keyword-only
min_select_eventsint300keyword-only
n_bandsint10keyword-only
feature_names—Nonekeyword-only
reasonsdict | NoneNonekeyword-only
sample_weight—Nonekeyword-only
allow_below_floorboolFalsekeyword-only
eps_warnfloat10.0keyword-only
duplicate_thresholdfloat0.01keyword-only
backendstr'hist'keyword-only
learning_ratefloat0.2keyword-only
seedint42keyword-only
build_kwargsdict | NoneNonekeyword-only

Returns#

compileml.select.SelectionResult

Raises#

  • ValueError

Read from the function body and the private helpers it calls, not inferred. A function that raises nothing has no section here.

Worked example: compile_selected →