Models¶
Metrics¶
compute_ece(y_true, proba, labels, n_bins=10)
¶
Compute macro-averaged multiclass Expected Calibration Error (one-vs-rest).
Source code in src/models/metrics.py
extract_feature_importance(pipe, X_cols)
¶
Extract feature importances from the 'clf' step of a sklearn Pipeline.
Source code in src/models/metrics.py
plot_feature_importance(df_imp, top_n=20, title='Feature Importance')
¶
Horizontal bar chart of top-N feature importances.
Source code in src/models/metrics.py
compute_segment_metrics(y_true, proba, labels, segments, segment_cols, min_samples=1)
¶
Compute logloss and brier score per segment value for each segment column.
Source code in src/models/metrics.py
plot_calibration_curves(y_true, proba, labels, label_names)
¶
One-vs-rest calibration reliability diagrams for each class.
Source code in src/models/metrics.py
Pipelines (sklearn)¶
WeightedXGBClassifier
¶
Bases: XGBClassifier
XGBClassifier extended to accept the sklearn-style class_weight parameter.
XGBoost does not support class_weight natively in its constructor.
This wrapper converts class_weight to a sample_weight array on
each :meth:fit call, mirroring the behaviour of sklearn estimators.
Source code in src/models/pipelines.py
get_xgb_params()
¶
Return XGBoost booster params, excluding sklearn-only class_weight.