API reference
The matrix API returns a tree or ensemble. StatsAPI wrappers add table encoding and stored training data. MLJ models integrate with machines and resampling. Start with Getting started for a complete fitting workflow.
Fit and predict
Use fit_tree for one tree and fit_boost for an ensemble. predict returns responses, while score returns values on the loss scale.
LinearTrees.fit_tree — Function
fit_tree(X, y, loss=MSE(); kwargs...) -> LinearTreeFit a linear model tree to the rows of numeric matrix X and target vector y. Columns are features. Targets must satisfy the domain of loss; feature values must be finite. Use predict for response-scale predictions and score for scores on the loss scale.
Keywords
weights=nothing: nonnegative frequency weights, with a positive total. The default gives every row weight one. Zero-weight rows are excluded.categorical=Int[]: columns containing positive integer category codes.rule=BIC(): node selection rule. SeeBICandGainRule.split_search=ExactSearch(): numeric threshold search.BinnedSearchandHybridSearchoffer approximate search for scalar-score losses.max_depth=12: maximum branching depth. UnsplitLINnodes add no depth.min_fit=10: minimum total row weight for another model-selection step.min_leaf=5: minimum total row weight on each side of a split.min_sum_hessian=1.0: stop below this total Hessian, summed over score coordinates.max_lin_chain=10: maximum number of consecutive unsplit linear nodes.truncate=true: bound score accumulation and each node's feature extrapolation.truncation_factor=3: parameter passed toscorebound. Must be at least one.features=1:size(X, 2): feature columns available for fitting. Prediction still expects the original matrix layout.nthreads=Threads.nthreads(): maximum number of available Julia threads to use.niter=5: node-refit iterations for non-smooth losses such asMADandQuantile. Smooth losses ignore this keyword.presort=nothing: optionalInt32matrix of stable sorted row indices, one column per original feature. Used by exact and local-bin search.
Nodes add score increments along a path. Model selection uses a quadratic surrogate for nonquadratic losses. Logistic updates also check true training loss before accepting a full step. No pruning pass follows growth.
For table inputs and stored encoders, use LinearTreeRegressorFit or LinearTreeClassifierFit through fit.
LinearTrees.fit_boost — Function
fit_boost(X, y, loss = MSE(); nrounds = 100, eta = 0.1, max_depth = 5,
min_fit = 10, min_leaf = 5, min_sum_hessian = 1.0,
lambda_slope = 1.0, lambda_intercept = 1.0, gamma = 0.0,
subsample = 1.0, colsample = 1.0, rng = Random.default_rng(),
weights = nothing, categorical = Int[], truncate = true,
Xval = nothing, yval = nothing, wval = nothing, patience = 10,
split_search = ExactSearch(), nthreads = Threads.nthreads()) -> LinearBoostSecond-order gradient boosting (Guryanov 2019) with the linear model tree as base learner. Each round computes the gradient and Hessian of loss at the ensemble score, freezes them into a Frozen target, and fits one tree with GainRule(lambda_slope, lambda_intercept, gamma), depth max_depth, and the row and column samples drawn from rng. The tree's raw score times eta is added to the ensemble. With Xval/yval, the validation deviance is recorded per round and fitting stops after patience rounds without improvement, keeping the trees up to the best round. Exact and node-local binned searches presort X once. HybridSearch prepares global bin IDs once from all positive-weight training rows, then selects the sampled rows' IDs each round. It supports numeric features and scalar losses. Sampled-out rows have weight zero for that tree only. history holds the per-round deviance and the ensemble's validated flag says whether it is the validation deviance, and so whether early stopping was in play.
For Quantile and MAD the frozen Hessian is the IRLS weight at the ensemble score, so a round is one IRLS step, not an exact L1 fit.
StatsAPI.predict — Function
predict(tree_or_ensemble, X; nthreads=Threads.nthreads())Prediction on the response scale, linkinv(tree_or_ensemble.loss, score).
predict(tree_or_ensemble, X; nthreads=Threads.nthreads())Softmax override: n × K matrix of class probabilities, linkinv applied row by row to the K-1-vector score.
LinearTrees.predict! — Function
In-place Softmax prediction into an n × K matrix.
LinearTrees.score — Function
score(tree_or_ensemble, X; clip=true, nthreads=Threads.nthreads())Raw path sum per row on the link scale. clip=false returns the additive unclipped sum. Rows split into nthreads contiguous blocks when there are at least PARALLEL_MIN_ROWS of them; each row writes only its own output slot, so the result matches the serial loop exactly.
score(tree_or_ensemble, X; clip=true, nthreads=Threads.nthreads())Softmax override: n × (K-1) matrix of raw reference-class logits.
Fitted models and node kinds
These types describe the stored model. Fit models through the functions above.
LinearTrees.LinearTree — Type
Fitted tree. lo, hi are the stored first-truncation bounds on the score scale. base is the SHAP empty-coalition value. truncate == false disables both clamps at prediction.
LinearTrees.LinearBoost — Type
LinearBoost{T,V,L}A gradient boosting ensemble of Frozen-loss linear model trees. The score is f0 + eta Σ_t score(trees[t], x), clamped to [lo, hi] (the base loss's scorebound on the training target) when truncate, then passed through the base loss's link. history[t] is the validation deviance after round t when validation data was given, else the training deviance; validated says which, so a reader can tell whether early stopping was in play. Build with fit_boost.
LinearTrees.nrounds — Function
Number of trees in the ensemble.
LinearTrees.Node — Type
One node of a linear model tree. Coefficients have type V, which is the feature type T for scalar-score losses and SVector{K-1,T} for softmax. Categorical split nodes keep a packed left-level mask in the tree's mask pool at words catstart:catstart+catwords-1. Numeric nodes have catwords == 0.
LinearTrees.ModelKind — Type
Per-node model kind. LIN nodes have one child and add no depth.
LinearTrees.CON — Constant
Constant node: one intercept, no split.
LinearTrees.LIN — Constant
Single line across the whole node: a x + b. One child, no added depth.
LinearTrees.PCON — Constant
Two constants, one per side of a threshold.
LinearTrees.BLIN — Constant
Broken line, continuous at the threshold: basis [x, 1, max(x - t, 0)].
LinearTrees.PLIN — Constant
Two independent lines, one per side of a threshold.
Model selection and split search
Selection rules compare node models. Search policies choose numeric thresholds. See Tree fitting and Performance for their distinct roles.
LinearTrees.BIC — Type
PILOT's BIC rule: n log(dev/n) + dof(kind) log(n) with dof per kind (con, lin, pcon, blin, plin). The defaults are the paper's (1, 2, 5, 5, 7).
LinearTrees.MinDeviance — Type
Test-only rule: pick the lowest surrogate deviance among kinds, never stop on con.
LinearTrees.GainRule — Type
GainRule(; lambda_slope = 1.0, lambda_intercept = 1.0, gamma = 0.0)Boosting's selection rule (Guryanov 2019, eq. 12 and 13). Offers con, pcon, and plin. The regularised deviance of a fit is `Σ h (z − a x − b)²
- lambdaslope a² + lambdaintercept b²`, obtained by adding the two ridges
to the Gram sums in fit_lin and fit_con. A split's score is its children's regularised deviance plus gamma per coefficient coordinate, so a split is taken exactly when its gain over the parent's constant fit exceeds gamma. BIC's dof penalty and dmin floor play no part.
LinearTrees.SplitSearch — Type
Policy for choosing the numeric thresholds evaluated during tree fitting.
LinearTrees.ExactSearch — Type
ExactSearch()Evaluate every eligible numeric threshold. This is the default split search.
LinearTrees.BinnedSearch — Type
BinnedSearch(; nbins=64, refine=true)Approximate numeric split search for scalar-score losses. Build at most nbins equal-count bins within each node, keeping tied values together. Evaluate bin edges using sufficient statistics of the original feature values and responses. Weights retain their frequency meaning. Categorical search remains exact.
With refine=true, scan all eligible row boundaries in the two bins adjacent to the winning coarse split. No refinement runs when a constant or unsplit line wins. Nodes with at most nbins rows use exact search.
This can change the chosen model and predictions. It does not guarantee the exact optimum or an error bound. nbins must be at least two. Vector-score losses, including Softmax, require ExactSearch().
LinearTrees.HybridSearch — Type
HybridSearch(; nbins=64)Approximate numeric split search for scalar-score losses. Assign rows to at most nbins equal-count bins once per fit, keeping equal feature values in the same bin. Tree nodes scan these global bins and refine the best coarse boundary over its two adjacent occupied bins. Nodes with at most nbins rows use exact search.
The sufficient statistics use the original feature values and responses, and weights retain their frequency meaning. This can change the selected model and predictions; it does not guarantee the exact optimum or an error bound. Use ExactSearch() or BinnedSearch() for categorical features, and ExactSearch() for vector-score losses. nbins must lie in 2:65535. Boosting reuses bins from all positive-weight training rows across rounds.
Loss types and functions
See Loss functions for target domains and prediction scales.
LinearTrees.Loss — Type
A twice-differentiable or IRLS-approximated loss. Implement gradhess!, linkinv, initscore, deviance, scorebound, and validate_target.
LinearTrees.MSE — Type
Squared-error loss for a real-valued target. Identity link.
LinearTrees.Huber — Type
Huber loss with transition δ: quadratic within δ of the target, linear beyond it. Identity link.
LinearTrees.Quantile — Type
Pinball (quantile) loss at quantile τ. Non-smooth: fit by IRLS. Identity link.
LinearTrees.MAD — Type
Mean absolute deviation loss. Non-smooth: fit by IRLS. Identity link.
LinearTrees.Logistic — Type
Logistic (binomial cross-entropy) loss for a {0,1} target. Logit link.
LinearTrees.Poisson — Type
Poisson deviance loss for a non-negative integer count target. Log link.
LinearTrees.NegBin — Type
Negative binomial deviance loss with dispersion θ, for an overdispersed count target. Log link.
LinearTrees.Gamma — Type
Gamma deviance loss for a positive real target. Log link.
LinearTrees.Tweedie — Type
Tweedie deviance loss with power ρ ∈ (1, 2), for a non-negative target with a point mass at zero. Log link.
LinearTrees.Softmax — Type
Softmax(K)K-class softmax with class K as the reference at logit zero. Diagonal Hessian. K is a type parameter so the coefficient type SVector{K-1,T} is known at compile time and every fit specialises on it.
LinearTrees.Frozen — Type
Frozen{V}() <: LossBoosting's per-tree loss. Each target row is a pair (z0, h0) of working response and frozen Hessian at the ensemble score, both of type V, so one tree minimises Σ w h0 (f − z0)² / 2: the second-order objective of a boosting round with z0 = −g0 / h0. gradhess! returns g = (f − z0) h0 and h = h0, including exact zero components, the start score is zero, the score bounds are infinite so truncate = true keeps only the feature clamp, and the loss is smooth so no IRLS refit runs. A tree fitted with Frozen predicts its raw score; only a LinearBoost gives it a link.
LinearTrees.gradhess! — Function
gradhess!(g, h, loss, y, f)Unweighted g = ∂ℓ/∂f and h = max(∂²ℓ/∂f², HMIN) per row. Frozen preserves its supplied Hessian, including zero. The caller applies frequency weights after any floor.
gradhess!(g, h, ::Softmax, y, f)Per-row cross-entropy gradient and diagonal Hessian against the K-1 reference-class logits, with integer class labels y in 1:K.
LinearTrees.linkinv — Function
linkinv(loss, s)Map raw score s to the response scale: the identity for MSE, Huber, Quantile, and MAD, the logistic sigmoid for Logistic, exp for the count and rate losses, and class probabilities for Softmax.
LinearTrees.initscore — Function
initscore(::Softmax, y, w)Log-odds of each non-reference class against the reference class K, from the weighted class frequencies.
StatsAPI.deviance — Function
deviance(loss, y, f, w)Weighted 2 Σ w[i] pointloss(loss, y[i], f[i]), the model's reported deviance on the score scale f.
deviance(m::LinearTreeClassifierFit)Training deviance against m's stored coded target: 0/1 (positive class classes[1]) for a two-class Logistic fit, the 1-based sorted-class index for a Softmax fit. score(m.tree, m.X) returns a plain Matrix for Softmax, so each row is repacked into the SVector pointloss needs.
LinearTrees.scorebound — Function
scorebound(loss, y; truncation_factor=3)(lo, hi) score-scale clamp bounds fit to the training target y, used when fit_tree's truncate is set. With half-width B = (max(y) - min(y)) / 2, truncation_factor pads each side by (truncation_factor - 1) * B, so the bounds are [min(y) - (truncation_factor - 1) B, max(y) + (truncation_factor - 1) B].
LinearTrees.validate_target — Function
validate_target(loss, y)Throw ArgumentError if y is not finite everywhere or does not satisfy loss's domain (e.g. {0,1} for Logistic, non-negative integers for Poisson); otherwise return nothing.
LinearTrees.issmooth — Function
issmooth(loss)true when loss has a well-defined Hessian everywhere and fits by Newton steps; false for the L1-type losses (Quantile, MAD), which fit by IRLS.
The LossFunctions.jl adapter
LinearTrees.AdaptedLoss — Type
Adapter around a LossFunctions.SupervisedLoss. Margin losses receive targets in {0,1} and are re-expressed with t = 2y - 1. The pointwise loss, gradient, and hessian are multiplied by scale.
LinearTrees.IdentityLink — Type
Score-space link between the tree's raw score and the value the inner loss expects.
LinearTrees.LogitLink — Type
Score-space link marking the tree's raw score as a logit, for a margin loss.
LinearTrees.LogLink — Type
Score-space link marking the tree's raw score as a log mean, for PoissonLoss.
LinearTrees.canonical_scale — Function
Newton-step scale that lines an inner loss up with the matching native Loss.
Interpretation
These functions describe fitted scores. See Interpretation for reconstruction identities and the effect of clipping.
LinearTrees.feature_importance — Function
feature_importance(tree)Surrogate-deviance drop per feature, normalised to sum to one. Zeros when no node has positive gain.
feature_importance(boost)Positive split gains summed over every tree, normalised to sum to one.
StatsAPI.coeftable — Function
coeftable(tree, x)Intercept and per-feature slopes of the unclipped score at x. A feature clamped at x contributes zero slope and its piece value goes to the intercept. Categorical pieces are constants.
coeftable(boost, x)Intercept and per-feature slopes of the unclipped ensemble score at x: f0 plus eta times the sum of each tree's coeftable.
LinearTrees.shap — Function
shap(tree, X; nthreads=Threads.nthreads()) -> ShapResultPath-dependent TreeSHAP values for every row of X against every feature of tree, on the unclipped score scale. Each row's SHAP values sum to score_row(tree, X, i, false) - result.base, the game's efficiency identity.
shap(boost, X; nthreads=Threads.nthreads()) -> ShapResultPath-dependent TreeSHAP for a LinearBoost; see shap!.
LinearTrees.shap! — Function
shap!(values, clipped, tree, X; nthreads=Threads.nthreads())In-place shap: write into values (n × p, or n × p × (K-1) for Softmax) and clipped (Vector{Bool}, length n), then return a ShapResult wrapping them.
shap!(values, clipped, boost, X; nthreads=Threads.nthreads())In-place shap for an ensemble: eta times the sum of every tree's path-dependent SHAP values, base f0 + eta Σ expected_score(tree), so each row sums to score(boost, x; clip = false) − base. clipped[i] is true when the ensemble clamp changed row i. One PathPool per row block, reused across the ensemble's trees.
LinearTrees.ShapResult — Type
ShapResult{A,B,C}values is n × p for scalar-score trees, n × p × (K-1) for Softmax. base is the game's empty-coalition value, expected_score(tree); fit_tree stores the same number in tree.base. clipped[i] is true when the score bound changed row i's prediction.
LinearTrees.expected_score — Function
expected_score(tree) -> VCover-weighted game_value(tree, ·, ∅) over the whole tree: at each split the absent feature's piece is evaluated at the node's xmean on both children, weighted by cover(child) / cover(parent). Independent of x. fit_tree stores it in tree.base. shap/shap! recompute it from the nodes (O(nodes)) so a hand-built tree whose base field is stale still satisfies the efficiency identity.
StatsAPI and Tables.jl
LinearTrees.LinearTreeRegressorFit — Type
LinearTreeRegressorFit{Tr}A fit_tree result wrapped with its input encoder and training data as a StatsAPI.RegressionModel. Build with fit(LinearTreeRegressorFit, X, y; loss=MSE(), weights=nothing, unseen=:error, kwargs...), where X is a matrix or a Tables.jl table and kwargs forward to fit_tree.
LinearTrees.LinearTreeClassifierFit — Type
LinearTreeClassifierFit{Tr,C}A fit_tree result for a categorical target, wrapped as a StatsAPI.StatisticalModel. Build with fit(LinearTreeClassifierFit, X, y; weights=nothing, unseen=:error, kwargs...). classes = sort(unique(y)) fixes both the label-to-code map and the column order of predict's probability matrix. Two classes fit a single Logistic tree with classes[1] (the first sorted class) as the positive outcome; predict returns hcat(p1, 1 .- p1), so column k is still P(classes[k]). Three or more classes fit a Softmax tree with classes[k] at coordinate k.
LinearTrees.LinearBoostRegressorFit — Type
LinearBoostRegressorFit{B}A fit_boost result wrapped with its input encoder and training data as a StatsAPI.RegressionModel. Build with fit(LinearBoostRegressorFit, X, y; loss=MSE(), weights=nothing, unseen=:error, Xval=nothing, yval=nothing, wval=nothing, kwargs...); Xval may be a matrix or table and is encoded like X; kwargs forward to fit_boost.
LinearTrees.LinearBoostClassifierFit — Type
LinearBoostClassifierFit{B,C}A fit_boost result for a categorical target, with the same class conventions as LinearTreeClassifierFit: classes[1] is the Logistic positive outcome for two classes, and column k of predict is P(classes[k]). Build with fit(LinearBoostClassifierFit, X, y; weights=nothing, unseen=:error, Xval=nothing, yval=nothing, wval=nothing, kwargs...).
StatsAPI.fit — Function
fit(LinearTreeRegressorFit, X, y; loss=MSE(), weights=nothing, unseen=:error, kwargs...)
fit(LinearTreeClassifierFit, X, y; weights=nothing, unseen=:error, kwargs...)Fit a LinearTreeRegressorFit or LinearTreeClassifierFit from a matrix or Tables.jl table X and a target y. kwargs forward to fit_tree. unseen is :error (default) or :right, applied to a categorical level absent from training at predict time.
StatsAPI.nobs — Function
Number of rows passed to fit, zero-weight rows included.
StatsAPI.dof — Function
dof(m)Count of stored coefficients across every node: 1 for CON, 2 for LIN or PCON, 3 for BLIN, 4 for PLIN, times K-1 for a Softmax fit. A parameter count, not an effective degrees of freedom, and unrelated to BIC's per-kind selection penalty of the same name.
StatsAPI.weights — Function
Training row weights, as stored (ones when fit was called with no weights).
StatsAPI.residuals — Function
Training residuals y - predict(tree, X), on the response scale.
MLJ
LinearTrees.LinearTreeRegressor — Type
LinearTreeRegressorA model type for constructing a linear tree regressor, based on LinearTrees.jl, and implementing the MLJ model interface.
From MLJ, the type can be imported using
LinearTreeRegressor = @load LinearTreeRegressor pkg=LinearTreesDo model = LinearTreeRegressor() to construct an instance with default hyper-parameters. Provide keyword arguments to override hyper-parameter defaults, as in LinearTreeRegressor(loss=...).
LinearTreeRegressor fits a PILOT-style linear model tree for a continuous or count target, generalised to any twice-differentiable loss.
Hyperparameters
loss::Loss = MSE(): the loss to fit; seeMSE,Huber,Quantile,MAD,Poisson,NegBin,Gamma,Tweedie.rule::SelectionRule = BIC(): model-kind selection rule at each node.max_depth::Int = 12: maximum tree depth.min_samples_split::Int = 10: minimum total weight in a node to attempt a split.min_samples_leaf::Int = 5: minimum total weight required in each child.min_sum_hessian::Float64 = 1.0: minimum summed hessian in a node to attempt a split.max_lin_chain::Int = 10: maximum consecutivelinfits along one root-to-node path.truncate::Bool = true: clamp predictions to the training score range.truncation_factor::Float64 = 3.0: half-range multiplier for the truncation bounds.
Operations
predict(mach, Xnew): return the predicted response forXnew.
Fitted parameters
The fields of fitted_params(mach) are:
tree: the fittedLinearTree.
Report
The fields of report(mach) are:
feature_importances: split-gain feature importances, as infeature_importance.kind_counts: a count of fitted nodes byModelKind.
See also LinearTreeClassifier.
LinearTrees.LinearTreeClassifier — Type
LinearTreeClassifierA model type for constructing a linear tree classifier, based on LinearTrees.jl, and implementing the MLJ model interface.
From MLJ, the type can be imported using
LinearTreeClassifier = @load LinearTreeClassifier pkg=LinearTreesDo model = LinearTreeClassifier() to construct an instance with default hyper-parameters. Provide keyword arguments to override hyper-parameter defaults, as in LinearTreeClassifier(rule=...).
LinearTreeClassifier fits a PILOT-style linear model tree for a finite (two- or many-class) target: a Logistic tree for two classes, a Softmax tree for three or more.
Hyperparameters
rule::SelectionRule = BIC(): model-kind selection rule at each node.max_depth::Int = 12: maximum tree depth.min_samples_split::Int = 10: minimum total weight in a node to attempt a split.min_samples_leaf::Int = 5: minimum total weight required in each child.min_sum_hessian::Float64 = 1.0: minimum summed hessian in a node to attempt a split.max_lin_chain::Int = 10: maximum consecutivelinfits along one root-to-node path.truncate::Bool = true: clamp predictions to the training score range.truncation_factor::Float64 = 3.0: half-range multiplier for the truncation bounds.
Operations
predict(mach, Xnew): return the predicted class distribution forXnew, as aUnivariateFinite. Usepredict_mode(mach, Xnew)for point predictions.
Fitted parameters
The fields of fitted_params(mach) are:
tree: the fittedLinearTree.
Report
The fields of report(mach) are:
feature_importances: split-gain feature importances, as infeature_importance.kind_counts: a count of fitted nodes byModelKind.
See also LinearTreeRegressor.
LinearTrees.LinearBoostRegressor — Type
LinearBoostRegressorA model type for constructing a linear boost regressor, based on LinearTrees.jl, and implementing the MLJ model interface.
From MLJ, the type can be imported using
LinearBoostRegressor = @load LinearBoostRegressor pkg=LinearTreesDo model = LinearBoostRegressor() to construct an instance with default hyper-parameters. Provide keyword arguments to override hyper-parameter defaults, as in LinearBoostRegressor(loss=...).
LinearBoostRegressor fits a gradient-boosted ensemble of linear model trees for a continuous or count target. MLJ iteration controls nrounds; this model does not expose validation early stopping, for which use IteratedModel.
Hyperparameters
loss::Loss = MSE(): scalar-response loss, such asMSE,Huber,Quantile,MAD,Poisson,NegBin,Gamma, orTweedie.nrounds::Int = 100: number of boosting rounds.eta::Float64 = 0.1: shrinkage per round.max_depth::Int = 5: maximum base-tree depth.min_samples_split::Int = 10: minimum node weight for a split.min_samples_leaf::Int = 5: minimum child weight.min_sum_hessian::Float64 = 1.0: minimum node Hessian sum.lambda_slope::Float64 = 1.0: slope penalty.lambda_intercept::Float64 = 1.0: intercept penalty.gamma::Float64 = 0.0: split-gain penalty.subsample::Float64 = 1.0: row-sampling fraction.colsample::Float64 = 1.0: feature-sampling fraction.truncate::Bool = true: clamp predictions to the training score range.rng::Union{AbstractRNG,Integer} = default_rng(): random source; an integer starts a freshXoshiroon each fit.
Fitted parameters and report
fitted_params(mach).boost is the fitted LinearBoost. report(mach) holds feature_importances, nrounds, and per-round history; the history is also available through training_losses(mach).
See also LinearBoostClassifier.
LinearTrees.LinearBoostClassifier — Type
LinearBoostClassifierA model type for constructing a linear boost classifier, based on LinearTrees.jl, and implementing the MLJ model interface.
From MLJ, the type can be imported using
LinearBoostClassifier = @load LinearBoostClassifier pkg=LinearTreesDo model = LinearBoostClassifier() to construct an instance with default hyper-parameters. Provide keyword arguments to override hyper-parameter defaults, as in LinearBoostClassifier(split_search=...).
LinearBoostClassifier fits a gradient-boosted ensemble of linear model trees for a finite target. It uses Logistic loss for two classes and Softmax for three or more. MLJ iteration controls nrounds; this model does not expose validation early stopping, for which use IteratedModel.
Hyperparameters
nrounds::Int = 100: number of boosting rounds.eta::Float64 = 0.1: shrinkage per round.max_depth::Int = 5: maximum base-tree depth.min_samples_split::Int = 10: minimum node weight for a split.min_samples_leaf::Int = 5: minimum child weight.min_sum_hessian::Float64 = 1.0: minimum node Hessian sum.lambda_slope::Float64 = 1.0: slope penalty.lambda_intercept::Float64 = 1.0: intercept penalty.gamma::Float64 = 0.0: split-gain penalty.subsample::Float64 = 1.0: row-sampling fraction.colsample::Float64 = 1.0: feature-sampling fraction.truncate::Bool = true: clamp predictions to the training score range.rng::Union{AbstractRNG,Integer} = default_rng(): random source; an integer starts a freshXoshiroon each fit.
Operations
predict(mach, Xnew) returns a UnivariateFinite; use predict_mode for point predictions.
Fitted parameters and report
fitted_params(mach).boost is the fitted LinearBoost. report(mach) holds feature_importances, nrounds, and per-round history; the history is also available through training_losses(mach).
See also LinearBoostRegressor.
Printing and serialisation
LinearTrees.TreeView — Type
A named view of a tree for AbstractTrees traversal and printing.
LinearTrees.to_dict — Function
to_dict(tree)JSON-friendly form: nodes as vectors of field dictionaries, loss as a name plus parameters. Three encodings keep every field JSON-safe:
- Every
Real-valued field (threshold, lcoef, lintercept, rcoef, rintercept, xmin, xmax, cover, xmean, gain, lo, hi, base) goes throughjsonnum: finite values becomeFloat64, non-finite values become the string"Inf","-Inf", or"NaN", and anSVectorfield maps elementwise into aVector{Any}. - Integer fields (
feature, left, right, catstart, catwords, model) store asInt, restored to their struct field type (Int32orModelKind) byfrom_dict. catmasks(UInt64, may use the top bit) store as lowercase hex strings viastring(m; base = 16), since a plain integer would overflowInt64and lose exactness in a JSON parser; restored withparse(UInt64, s; base = 16).
LinearTrees.from_dict — Function
from_dict(d) -> LinearTreeInverse of to_dict. Throws ArgumentError for an unrecognised format version, element type, or loss name.
Index
LinearTrees.BLINLinearTrees.CONLinearTrees.LINLinearTrees.PCONLinearTrees.PLINLinearTrees.AdaptedLossLinearTrees.BICLinearTrees.BinnedSearchLinearTrees.ExactSearchLinearTrees.FrozenLinearTrees.GainRuleLinearTrees.GammaLinearTrees.HuberLinearTrees.HybridSearchLinearTrees.IdentityLinkLinearTrees.LinearBoostLinearTrees.LinearBoostClassifierLinearTrees.LinearBoostClassifierFitLinearTrees.LinearBoostRegressorLinearTrees.LinearBoostRegressorFitLinearTrees.LinearTreeLinearTrees.LinearTreeClassifierLinearTrees.LinearTreeClassifierFitLinearTrees.LinearTreeRegressorLinearTrees.LinearTreeRegressorFitLinearTrees.LogLinkLinearTrees.LogisticLinearTrees.LogitLinkLinearTrees.LossLinearTrees.MADLinearTrees.MSELinearTrees.MinDevianceLinearTrees.ModelKindLinearTrees.NegBinLinearTrees.NodeLinearTrees.PoissonLinearTrees.QuantileLinearTrees.ShapResultLinearTrees.SoftmaxLinearTrees.SplitSearchLinearTrees.TreeViewLinearTrees.TweedieLinearTrees.canonical_scaleLinearTrees.expected_scoreLinearTrees.feature_importanceLinearTrees.fit_boostLinearTrees.fit_treeLinearTrees.from_dictLinearTrees.gradhess!LinearTrees.initscoreLinearTrees.issmoothLinearTrees.linkinvLinearTrees.nroundsLinearTrees.predict!LinearTrees.scoreLinearTrees.scoreboundLinearTrees.shapLinearTrees.shap!LinearTrees.to_dictLinearTrees.validate_targetStatsAPI.coeftableStatsAPI.devianceStatsAPI.dofStatsAPI.fitStatsAPI.nobsStatsAPI.predictStatsAPI.residualsStatsAPI.weights