bin_editor
Headless state machine for editing bin boundaries, with an optional anywidget-based UI.
BinEditor
BinEditor(
bin_specs: dict[str, dict[str, Any]],
features: DataFrame,
target: Series,
time_periods: Series | None = None,
weights: Series | None = None,
stability_threshold: float = 0.1,
)
Headless state machine for editing bin boundaries.
Works identically in plain Python scripts, notebooks, and agents. All
edits are logged per feature with undo support. Call accept() to export
the final bin specs dict for use with WOETransformer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bin_specs
|
dict[str, dict[str, Any]]
|
Initial bin specifications — a dict produced by
|
required |
features
|
DataFrame
|
Feature DataFrame matching the features in |
required |
target
|
Series
|
Binary target series (0/1 or float). |
required |
time_periods
|
Series | None
|
Optional time series for temporal stability metrics. |
None
|
weights
|
Series | None
|
Optional sample weight series. |
None
|
stability_threshold
|
float
|
RSI threshold used to flag unstable bins in the state dict (does not block edits). |
0.1
|
Note
All state is accessible via state(feat), which returns a FeatureState
dataclass with attributes bins, n_bins, counts, event_rates,
woe, iv, dtype, groups, and temporal.