Skip to content

Internal API

General

EvoTrees.TrainNode Type
julia
TrainNode{S,V,M}

Carries training information for a given tree node

source
EvoTrees.EvoTree Type
julia
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:

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

Check model parameter if it's valid

source
EvoTrees.check_args Function
julia
check_args(args::Dict{Symbol,Any})

Check model arguments if they are valid

source
julia
check_args(model::EvoTypes)

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

source

Training utils

EvoTrees.init Function
julia
init(
    params::EvoTypes,
    dtrain,
    device::Type{<:Device}=CPU;
    target_name,
    feature_names=nothing,
    weight_name=nothing,
    offset_name=nothing
)

Initialise EvoTree

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

Initialise EvoTree

source
EvoTrees.grow_evotree! Function
julia
grow_evotree!(evotree::EvoTree{L,K}, cache, params::EvoTypes) where {L,K}

Given a instantiate

source
EvoTrees.get_best_split Function
julia
get_best_split(
    ::Type{L},
    node::TrainNode,
    js,
    params::EvoTypes,
    feattypes::Vector{Bool},
    monotone_constraints,
)

Generic fallback

source
EvoTrees.update_gains! Function
julia
update_gains!(
    ::Type{L},
    node::TrainNode,
    js,
    params::EvoTypes,
    feattypes::Vector{Bool},
    monotone_constraints,
)
source
EvoTrees.predict! Function
julia
predict!(pred::Matrix, tree::Tree, X)

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

source
EvoTrees.subsample Function
julia
subsample(left::AbstractVector, is::AbstractVector, mask_cond::AbstractVector{UInt8}, rowsample::AbstractFloat, rng)

Returns a view of selected rows ids.

source
EvoTrees.split_set_chunk! Function
julia
split_set_chunk!(
    left,
    right,
    is,
    bid,
    nblocks,
    x_bin,
    feat,
    cond_bin,
    feattype,
    offset,
    chunk_size,
)

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.

source

Histogram

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

Get the histogram breaking points of the feature data.

source
EvoTrees.binarize Function
julia
binarize(X::AbstractMatrix; feature_names, edges)
binarize(df; feature_names, edges)

Transform feature data into a UInt8 binarized matrix.

source
EvoTrees.update_hist! Function
julia
update_hist!
    GradientRegression
source
julia
update_hist!
    MLE2P
source
julia
update_hist!

Generic fallback - Softmax

source