Repository navigation
Releases
Releases · rafapras/bettertrees
0.3.0
Highlights
- Faster Interleaved Tree Models at scale: fused L1-resident column-major Numba kernel (
best_leaf_cuts_T) and single-pass logistic gradient computation innode_hist_margin(bit-for-bit identical predictions; fits 1.00M × 31 rows in ~5.3 s and 1.66M × 11 rows in ~4.4 s on 4 cores at 16 cuts). - Native categorical splits:
CategoricalInterleavedTreeClassifier(aliasCategoricalFIGSClassifier), automatically dispatched byBudgetClassifier(max_splits=b, categorical_features="auto")on DataFrames with categorical/string columns (purely numeric inputs stay bit-for-bit identical):- Fisher-optimal Newton ratio ordering with rare-in-leaf pooling (
min_cat_weight) and Rissanen MDL subset complexity regularization (cat_dof_penalty). - Separate
missing (NaN)vsother / unseencategory codes so unseen test-time categories route to the majority side of each split. - Automatic
min_cat_coverageguardrail keeping near-unique strings/ISO-8601 timestamps chronologically ordered via leak-freesearchsortedbinning and exact SQL string comparisons. - Optional
max_subset_sizecap for bounded, compact categorical rules.
- Fisher-optimal Newton ratio ordering with rare-in-leaf pooling (
- SQL & scikit-learn fixes:
to_sql()defaults tonull_safe=True, supports customscore_col/proba_col, zero-tree edge cases, and categorical + timestamp SQL;FastDecisionTreeClassifierCVadds theallow_nantag and sklearn delegation (predict_log_proba,get_depth,get_n_leaves,feature_importances_);RashomonFIGSClassifieruses leaf-order-invariant structural deduplication (_forest_key). - Experimental & Lab: new families in
bettertrees.experimental(HingeFIGSClassifier,CausalFIGS,BudgetRegressor/FIGSRegressor/SumOfOptimalTreesRegressor,rashomon_mcr) and research archive inbettertrees.lab(LookaheadFIGSClassifier,CompactTreeBoosterV2,L2FIGSClassifier,SparseTreeSumClassifier,ResidualRatioFIGSClassifier). - Docs & Examples: new
examples/05_categorical_and_sql.ipynbnotebook and stacked 38-dataset benchmark report indocs/BENCHMARKS.md.
0.2.0
as_tree_sum(model, X): one entry point that reads LightGBM, XGBoost, CatBoost and
scikit-learn tree models (HistGradientBoostingClassifier,GradientBoostingClassifier,
DecisionTreeClassifier) as a bettertrees sum with the same raw score (tested for
equality), so the whole interpretation API applies to them. Cuts that send missing
values right are refused when the feature has missing values inX; categorical
splits are refused.- Scorecard views on every sum:
segments(X)(the data marked tree by tree: the rule of
each leaf and its points),profiles(X)(best, modal, median and worst client, observed
or the feasible extremes found by branch and bound, plus any clients chosen with
rows=),plot_profiles(X),plot_trees()andplot_growth()(the order of the cuts:
the ITM records it while growing asgrowth_; boosters grow one tree after another).
plot_trees(x)writes the client's value next to every cut on its path. Every plot
starts from the base, adds one leaf per tree in the same units and says in a legend line
what each mark means. Points in the credit convention (offset,pdo) or raw logit;
badchooses the class the score counts against andbad_labelnames it in the plots
(e.g. "default"). - New example notebook
04_scorecard_views.