| scr_coarse_classing | R Documentation |
Opens a lab on an scr_select() result. Inside it the analyst inspects
the optimal bins of any binned variable (scr_classing_view()), proposes
new breaks or groupings (scr_classing_propose()), reads the comparison
against the optimal bins, accepts or discards each proposal with a
mandatory reason (scr_classing_accept(), scr_classing_discard()),
chooses the final variable list (scr_classing_choose()) and commits
everything to a new scr_result (scr_classing_apply()) that the rest
of the pipeline consumes unchanged: scr_scorecard(), scr_apply(),
scr_sql(), scr_export().
scr_coarse_classing(
x,
features = NULL,
laplace = 0,
max_iv_loss = NULL,
author = Sys.info()[["user"]]
)
x |
An object from |
features |
Variables the lab covers. Default: every variable that
reached binning ( |
laplace |
Smoothing added to the bin counts when recomputing WOE.
|
max_iv_loss |
Advisory threshold: a manual bin whose hold-out IV
falls more than this fraction below the optimal one raises
|
author |
Free text recorded in the ledger. |
An scr_classing object (the lab), with a print method that
summarizes the session: variables touched, before/after IV, verdicts,
reasons, pending proposals and the final choice.
A manual bin is recomputed on the training rows only (hold-out rows
can never define a bin), with the engine's own WOE formula
(ln(%event / %non-event), event-oriented, so glm coefficients stay
positive), then revalidated on the hold-out with the bins frozen (IV, PSI
with both thresholds, unbinned share) and screened with the eight
engine rules, so the lab and the pipeline can never disagree. Numeric
intervals are right-closed, (a, b], exactly as the engine and its SQL.
Re-declaring the optimal cut points of a numeric reproduces the engine's
WOE exactly; for a categorical the engine applies a small internal
smoothing of its own, so the raw log-ratio of the lab differs from it in
the third decimal.
An empty bin, a degenerate bin (no events or no non-events, unless
laplace > 0), a bin below lab_min_bin_pct_hard, a manual IV crossing
iv_max (the lab must not manufacture leakage), a category left
unassigned, a missing reason. Those block the proposal (BLOCKED);
accepting one needs override = TRUE, and the override is itself a
ledger row.
Other classing:
scr_classing_accept(),
scr_classing_apply(),
scr_classing_choose(),
scr_classing_propose(),
scr_classing_spec(),
scr_classing_view(),
scr_decisions()
cfg <- scr_config(verbose = FALSE, nthread = 1, use_ranger = FALSE,
xgb_rounds = 60, n_boot = 20)
res <- scr_select(scr_demo, "default", config = cfg, drop = "id",
date_col = "ref_date")
lab <- scr_coarse_classing(res)
lab
scr_classing_view(lab, "ds_region")
p <- scr_classing_propose(lab, "ds_region",
groups = list(edge = c("NORTH", "SOUTH"),
core = c("EAST", "WEST", "CENTRE")))
p
lab <- scr_classing_accept(lab, p, reason = "edge/core is what pricing uses")
lab <- scr_classing_choose(lab, drop = "vl_score_10",
reason = "not available at decision time")
lab
res2 <- scr_classing_apply(lab)
scr_selected(res2)
scr_selected(res2, which = "consensus")
sc <- scr_scorecard(res2)
sc$model_card$binning_algorithm
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.