Skip to content

Settings Reference

Complete reference for all training, evaluation and threshold settings.

TrainSettings

Required Parameters

Parameter Type Description
out_folder string Directory to save trained models and label stats
train_files list Paths to training data files (.csv or .parquet)

Optional Parameters

Parameter Default Description
n 1 Number of trees to build per target class
max_parallel_where 100 A tree whose spore count reaches this limit is scored through several SQL statements instead of one; raise it to reduce batching
max_depth 100 Maximum tree depth (prevents overfitting)
frac_eval_cat 0.5 Fraction of data for bin evaluation vs weight-based grouping
max_eval_fit 1000 Maximum rows sampled per node
min_eval_fit 10 Minimum samples before stopping recursion
n_dims 3 Feature combinations to evaluate (1=single, 2=pairs, 3=triplets)
n_cat 3 Number of bins per feature
calcs_per_dim 5000 Maximum combinations to evaluate per dimension
spore_diff 1.0 Branch-merge distance for the winning split's bin combinations: adjacent combinations (sorted by their target/non-target diff) are merged while their difference stays below spore_diff and at least two branches remain. 0.0 keeps every observed combination as its own branch (fan-out); >= 1.0 collapses the split into a binary split
score_method "diff_dir_1.5" Scoring method for split candidates: "diff_all_<exp>" (dimension-neutral, 0.5 * sum(\|p-q\|^exp)), "diff_dir_<exp>" (directional, max of target/non-target sums), "lift_dir_<exp>" (directional mass-weighted log-likelihood lift n * abs(ln(n / E))**exp, dominant side wins), "hellinger" (Hellinger distance). Exponent <exp> is one of 1.0, 1.5, 2.0; default is "diff_dir_1.5" (entropy-style weighting on the plain p - q difference)
smoothing 0.0 Laplace smoothing alpha for the proportion estimates used in candidate scoring. 0 disables smoothing; when active, all scoring methods use Laplace-smoothed proportions. The left/neutral/right classification always uses the raw proportions
leaf_score "log_odds" Formula for the leaf (spore) scores. "log_odds" stores Laplace-smoothed log-odds ln((target + leaf_alpha) / (non_target + leaf_alpha)) — unbounded, comparable across targets, exactly antisymmetric under swapping target and non-target; designed for mean combination, where softmax over the per-target scores yields approximate posteriors. "weakened_diff" keeps the legacy signed target rate scaled by 1 - ln(n) / n (bounded to [-1, 1])
leaf_alpha 0.5 Pseudo-count (Beta prior concentration) of the Laplace smoothing for leaf_score="log_odds". 0.5 is the Jeffreys prior, 1.0 the Laplace prior. Larger values shrink small leaves stronger towards the balanced score 0
min_split_improvement 0.0 Minimum relative improvement (e.g. 0.05 = 5%) a multi-dimensional candidate (dim >= 2) needs to beat the current best split. 0 disables the requirement
pair_corr_filter True Filter correlated feature combinations per node: a candidate whose joint table lets both classes concentrate on a dominant bin masks its 1D-weakest feature for the rest of the node
pair_corr_min_main 0.9 Minimum share of BOTH classes inside the dominant bin (per remaining-feature cell, summed over all cells) for a candidate to count as correlated. Mirrors the 1D is_diff_to_low threshold
pair_corr_max_features None Limit the dim-2 candidate search to the top-K features by 1D score. Useful for wide datasets where all pairs are too many
n_rep 5 Number of random split repetitions. Each multi-dimensional feature combination is evaluated once per repetition with correctly aligned count rows; higher values reduce statistical fluctuations but increase training time

Example: TrainSettings

# Minimum required

out_folder: my_model

train_files:

  - /path/to/train.csv

# With all options

n: 10

out_folder: my_model

max_parallel_where: 100

max_depth: 15

frac_eval_cat: 0.5

max_eval_fit: 1000

min_eval_fit: 50

n_dims: 3

n_cat: 5

calcs_per_dim: 5000

score_method: diff_dir_1.5

smoothing: 0.0

min_split_improvement: 0.0

pair_corr_filter: true

pair_corr_min_main: 0.9

pair_corr_max_features: null

spore_diff: 1.0

n_rep: 5

train_files:

  - /path/to/train.csv

EvalSettings

Required Parameters

Parameter Type Description
in_folders list Directories containing trained models
out_folder string Directory for evaluation results
test_files list Paths to test/evaluation data files (.csv or .parquet)

Optional Parameters

Parameter Default Description
out_file null Output file path (.csv or .parquet)
keep_cols [] Columns to include in output
max_parallel_where 100 Legacy cut-models: split SQL into batches once a tree has at least this many spores. Models with structured conditions are scored natively and ignore it
same_target_pilz_comb_method mean Combine the n trees per target label by mean or max (mean is more robust — a single outlier tree otherwise dominates)
different_target_pilz_comb_method max Combine per-target scores into a prediction: max takes the highest score, youden predicts the largest threshold margin with majority-class fallback (thresholds are derived on the fly from the stored leaf counts, no threshold files)

Example: EvalSettings

# Minimum required

in_folders:

  - model

out_folder: results

test_files:

  - /path/to/test.csv

# With all options

in_folders:

  - model_v1

  - model_v2

out_folder: results

out_file: predictions.csv

keep_cols:

  - customer_id

  - date

max_parallel_where: 500

test_files:

  - /path/to/test.csv

Decision Thresholds

Decision thresholds are derived on the fly from the leaf counts stored in each tree (n_target/n_non_target): every tree contributes its Youden-optimal threshold, mean combination compares each target score against the mean of its trees' thresholds, maximum combination compares each tree score against its own threshold. No threshold files are written or read; training only persists label_stats.json (label counts and majority class) as the fallback prediction when no threshold margin is positive.

Parameter Guide

n_rep and n_dims together

n_rep applies to complete split candidates, not only to individual features. For example, with n_dims: 2 and n_rep: 3, every pair is built and evaluated three times using the matching repetition of each feature. The median candidate of that pair is then compared with the other possible splits. This preserves row alignment while retaining the stabilizing effect of repeated random splits.

The calcs_per_dim limit counts feature combinations. Increasing n_rep therefore increases the work per combination, but does not change how many combinations the limit permits.

train_files / test_files

Setting Where Description
train_files TrainSettings Data used to build the trees
test_files EvalSettings Data used for evaluation / inference

n: Number of Trees

Value Effect
1 Fast, baseline
3-5 Good balance
10+ More accurate, slower

max_depth

Value Effect
5-10 Shallow, fast, general
10-15 Medium
15+ Deep, may overfit

n_dims

Value Effect
1 Single features only
2 Feature pairs
3+ Complex interactions

n_cat

Value Effect
2-3 Few bins, general
3 Default
10+ Many bins, specific

calcs_per_dim

Value Effect
null No limit
1000 Quick
10000 Thorough
100000+ Exhaustive

n_rep: Repetitions per Candidate

Controls how many times the data is randomly split into count and group sets. Each repetition computes a candidate independently; the median result across all repetitions is selected. For multi-dimensional candidates, features are combined only with their matching repetition, preventing count rows from different shuffles from being paired.

Value Effect
1 No repetition, fast
3 Light smoothing
5 Default, good balance
10+ Very stable cuts, slower

score_method: Split Scoring

Controls how the discriminating power of a split candidate is computed. All methods are built on the plain proportion difference diff_plain = p - q:

Value Effect
"diff_all_1.0" Dimension-neutral sum 0.5 * sum(|p - q|).
"diff_all_1.5" 0.5 * sum(|p - q|**1.5) — dampens near-zero cells, emphasizes strong ones
"diff_all_2.0" 0.5 * sum((p - q)**2) — quadratic, strongest cells dominate
"diff_dir_1.0" Directional: sums |p - q| separately for target-favouring and non-target-favouring bins and takes the dominant side
"diff_dir_1.5" (default) Entropy-style weighting abs(p - q) * sqrt(abs(p - q)), directional (dominant side wins). Not dimension-neutral
"diff_dir_2.0" Squared directional sum on p - q, dominant side wins
"lift_dir_1.0" Directional expected log-likelihood lift n * abs(ln(n / E)) per direction (E the expected count under independence, n/m the pseudo-count-augmented cell counts), dominant side wins. Evidence-weighted via the cell counts; empty cells contribute exactly 0, pure cells stay bounded by n * ln(1/pi). At exp = 1.0 the sums are the directional parts of the G deviance (G = 2 * n_total * mutual information)
"lift_dir_1.5" Directional log-lift n * abs(ln(n / E))**1.5, dominant side wins
"lift_dir_2.0" Directional log-lift n * abs(ln(n / E))**2, dominant side wins
"hellinger" Hellinger distance 0.5 * sum((sqrt(p) - sqrt(q))**2). Dimension-neutral and less sensitive to noise in sparsely populated bins

smoothing: Laplace Smoothing

When smoothing is greater than zero, every bin combination receives the pseudo-count smoothing on both sides before the proportions used by all scoring methods are computed. This dampens the effect of sparsely populated cells on the candidate ranking. The left/neutral/right classification always uses the raw proportions, so the resulting model structure is unaffected by smoothing.

Value Effect
0.0 (default) No smoothing
1.0 Standard Laplace smoothing (add-one)
5.0+ Strong prior — sparse cells barely contribute to the score

min_split_improvement: Dimensional Barrier

A multi-dimensional candidate (dim >= 2) is only selected when its score exceeds the current best split by at least this relative factor. This prevents sparse higher-dimensional combinations from winning purely due to score noise.

Value Effect
0.0 (default) Any improvement counts, a candidate only needs to be strictly better
0.05 A 2D/3D split must beat the best split by at least 5%
0.1 Conservative — only clearly better combinations are used

pair_corr_filter: 2D Correlation Filter

Extends the 1D is_diff_to_low check to feature combinations. In every dimension stage (dim 2..=n_dims) each evaluated candidate checks its joint correlation table: for every candidate position, the cells are grouped by the remaining features and the share of each class inside the dominant bin of that position is summed. When BOTH classes put more than pair_corr_min_main of their mass into the dominant bins, one feature of the combination is redundant given the rest and the 1D-weakest feature of the candidate is masked immediately — it is no longer used for any following combination of this node, and the triggering candidate itself is excluded. The mask only lives in the current node: the next node starts fresh with all features.

Effects:

  • calcs_per_dim only counts combinations that are actually evaluated — combinations containing a masked feature are skipped without consuming budget, so the budget stretches further for the meaningful candidates.
  • The check runs on the candidate's median repetition table and costs nothing extra (the table is computed for scoring anyway).
  • With n_dims: 1 no pair filtering happens (there are no combination stages).
  • The 1D-best feature can never be masked (it is never the weakest member of a combination).
Value Effect
true (default) Correlated combinations prune the feature pool per node
false All features stay eligible for every combination

pair_corr_min_main works like the 1D threshold of is_diff_to_low (0.9): higher values only prune near-deterministic dependencies, lower values prune more aggressively. pair_corr_max_features limits the pair stage (dim 2) to the top-K features by 1D score — a useful guard for wide datasets (e.g. pixel features) where the number of pairs grows quadratically.

spore_diff: Branch Condensation

The winning split is defined by the bin combinations of its correlation table. Two combinations are merged into one branch when the adjacent pair with the smallest difference in target/non-target rate (diff) stays below spore_diff:

  • The observed combinations are sorted by diff — the regularized normalized difference (n*M - m*N - sqrt(n)*M - sqrt(m)*N - n*sqrt(M) - m*sqrt(N)) / (n*M + m*N) with target/non-target cell counts n/m and totals N/M, clamped to 0 on the dominating side. The square-root penalty terms keep underpopulated cells at 0 until they gather enough evidence. The pair with the smallest gap is merged first; the merged diff is recomputed from the summed counts with the same regularized formula.
  • Merging continues until the smallest remaining gap reaches spore_diff or at least two observed branches remain — a split always has at least two real branches (plus an optional residual), never one.
  • The residual branch (combinations never observed in the count sample, segment .n) is never merged into.
  • 0.0 keeps every observed combination as its own branch — the pure fan-out split.
  • >= 1.0 collapses the observed combinations into a binary split.

With spore_diff: 0.0 every branch is its own recursive subtree (depth segment .<i>), and the combinations that were NOT observed in the count sample are grouped into a single residual subtree (segment .n). Section depth is dot-separated (e.g. 0, 0.3, 0.3.n), so the decision path of a leaf is reconstructed exactly.

Effects:

  • Spores keep the standard l/n/r encoding disabled; the extended dot-encoded depth is the only encoding.
  • Each branch subtree scores itself via its own sample read.
  • A split observed across all possible combinations has no residual branch.
  • Best for sparse high-dimensional tables: with spore_diff: 0.0 the split does not cluster distinct cells into groups; with the default 1.0 it collapses into a clean binary split.
Value Effect
0.0 One branch per observed cell; residual n groups the unobserved cells (fan-out)
0 < spore_diff < 1 Greedy adjacent merge below the distance; intermediate fan-out
>= 1.0 (default) All observed combinations condensed into a binary split

Quick Reference Table

flowchart LR subgraph "Simple Problem" S1[n: 1] --> S2[n_dims: 1] --> S3[n_cat: 3] --> S4[max_depth: 10] end subgraph "Normal Problem" N1[n: 3-5] --> N2[n_dims: 2] --> N3[n_cat: 5] --> N4[max_depth: 15] end subgraph "Complex Problem" C1[n: 10+] --> C2[n_dims: 3+] --> C3[n_cat: 8+] --> C4[max_depth: 20] end