API reference

The top-level API measures instability for arbitrary fitted procedures and includes one representative-model selector plus fixed-design linear calibration tools. Inclusion means the implementation and workflow are supported; it does not imply a universal stabilization guarantee.

Bootstrap audits

bootstrap_predictions

Refit a model on bootstrap resamples and return every prediction it made.

bootstrap_instability

Measure how much a model's predictions move when the training data is perturbed.

bootstrap_predictions returns every refitted prediction and the per-case statistics. bootstrap_instability returns aggregate summaries and Monte Carlo standard errors.

Model-selection frontier

stability_frontier

Sweep a parameter grid and return the validation-score/instability tradeoff.

pareto_front

Keep the configurations no other configuration beats on both axes.

The score used to construct a frontier is a validation score. It is not a final test-set performance estimate.

Tree-structure audits

split_features

Return the multiset of features tested down to a given depth.

split_feature_paths

Return the feature sequence each row is tested against on its way to a leaf.

explanation_instability

How much the structure changes across independently fitted trees.

root_agreement

Fraction of fits that test the most common root feature.

path_agreement

Fraction of rows routed through the same feature sequence by most fits.

Read structural instability beside prediction instability. A consistently shallow or inaccurate tree can have perfectly stable structure.

Plots

Install plotting dependencies with pip install "stable-cart[plots]".

plot_prediction_instability

Draw the instability plot: original prediction against resampled predictions.

plot_mape_by_prediction

Show instability as a function of predicted value: who the model is unsure about.

plot_stability_frontier

Plot one or more model families on the validation-score/stability plane.

Supported estimator and analytic tools

RepresentativeEstimator supports multiclass classification and selects a single fitted candidate by validation-set prediction centrality. Its observed stability benefit is task dependent. The linear functions are exact or calibrated calculations under their documented fixed-design assumptions; they are not general estimators.

RepresentativeEstimator

Select one fitted estimator closest to a candidate-pool centroid.

linear_instability

Analytic prediction instability of least squares, conditional on the design.

linear_frontier

Trace an oracle or plug-in frontier for fixed-design linear prediction.

shrinkage_coefficients

Coefficients of the estimator that achieves the frontier point at mu.