Internal API

General

EvoTrees.TrainNodeType
TrainNode{S,V,M}

Carries training information for a given tree node

EvoTrees.EvoTreeType
EvoTree{L,K}

An EvoTree holds the structure of a fitted gradient-boosted tree.

Fields

  • trees::Vector{Tree{L,K}}
  • info::Dict

EvoTree acts as a functor to perform inference on input data:

pred = (m::EvoTree; ntree_limit=length(m.trees))(x)
EvoTrees.check_parameterFunction
check_parameter(::Type{<:T}, value, min_value::Real, max_value::Real, label::Symbol) where {T<:Number}

Check model parameter if it's valid

EvoTrees.check_argsFunction
check_args(args::Dict{Symbol,Any})

Check model arguments if they are valid

check_args(model::EvoTypes{L}) where {L}

Check model arguments if they are valid (eg, after mutation when tuning hyperparams) Note: does not check consistency of model type and loss selected

Training utils

EvoTrees.initFunction
init(
    params::EvoTypes,
    dtrain,
    device::Type{<:Device}=CPU;
    target_name,
    fnames=nothing,
    w_name=nothing,
    offset_name=nothing
)

Initialise EvoTree

init(
    params::EvoTypes,
    x_train::AbstractMatrix,
    y_train::AbstractVector,
    device::Type{<:Device}=CPU;
    fnames=nothing,
    w_train=nothing,
    offset_train=nothing
)

Initialise EvoTree

EvoTrees.grow_evotree!Function
grow_evotree!(evotree::EvoTree{L,K}, cache, params::EvoTypes{L}, ::Type{<:Device}=CPU) where {L,K}

Given a instantiate

EvoTrees.update_gains!Function
update_gains!(
    loss::L,
    node::TrainNode{T},
    js::Vector,
    params::EvoTypes, K, monotone_constraints) where {L,T,S}

Generic fallback

EvoTrees.predict!Function
predict!(pred::Matrix, tree::Tree, X)

Generic fallback to add predictions of tree to existing pred matrix.

EvoTrees.subsampleFunction
subsample(out::AbstractVector, mask::AbstractVector, rowsample::AbstractFloat)

Returns a view of selected rows ids.

EvoTrees.split_set_chunk!Function
Multi-threaded split_set!
    Take a view into left and right placeholders. Right ids are assigned at the end of the length of the current node set.

Histogram

EvoTrees.get_edgesFunction
get_edges(X::AbstractMatrix{T}; fnames, nbins, rng=Random.TaskLocalRNG()) where {T}
get_edges(df; fnames, nbins, rng=Random.TaskLocalRNG())

Get the histogram breaking points of the feature data.

EvoTrees.binarizeFunction
binarize(X::AbstractMatrix; fnames, edges)
binarize(df; fnames, edges)

Transform feature data into a UInt8 binarized matrix.

EvoTrees.update_hist!Function
update_hist!
    GradientRegression
update_hist!
    MLE2P
update_hist!
    Generic fallback - Softmax