Evovest/EvoTrees.jl

Boosted trees in Julia

Julia

201

851 commits

updated Sep 22, 2026

See the code

README

EvoTrees

DocumentationCI StatusDOI

A Julia implementation of boosted trees with CPU and GPU support. Efficient histogram based algorithms with support for multiple loss functions (notably multi-target objectives such as max likelihood methods).

R binding available.

Installation

Latest:

julia> Pkg.add(url="https://github.com/Evovest/EvoTrees.jl")

From General Registry:

julia> Pkg.add("EvoTrees")

Performance

Data consists of randomly generated Matrix{Float64}. Training is performed on 200 iterations.
Code to reproduce is available in benchmarks/regressor.jl.

  • Run Environment:
    • CPU: 12 threads on AMD Ryzen 5900X
    • GPU: NVIDIA RTX A4000
    • Julia: v1.10.8
  • Package versions:
    • EvoTrees: v0.18.3
    • XGBoost: v3.1.2 (Using the hist algorithm)

CPU:

nobsnfeatsmax_depthtrain_evoinfer_evotrain_xgbinfer_xgb
100k1060.360.060.210.03
100k10111.280.080.630.06
100k10060.790.080.790.03
100k100114.910.123.670.07
1M1062.490.311.600.24
1M10115.070.633.160.58
1M10065.820.695.530.26
1M1001118.781.1913.400.57
10M10626.453.3430.991.76
10M101151.886.2755.205.57
10M100685.056.4465.902.56
10M10011192.5812.18111.696.02

GPU:

nobsnfeatsmax_depthtrain_evoinfer_evotrain_xgbinfer_xgb
100k1060.660.010.240.00
100k10111.430.011.120.01
100k10060.930.030.470.03
100k100112.170.032.920.06
1M1061.370.050.580.03
1M10112.450.052.140.04
1M10062.770.302.300.28
1M100115.070.326.800.58
10M1067.530.443.830.18
10M101112.600.538.660.31
10M100621.933.3321.422.88
10M1001137.253.5741.985.91

MLJ Integration

See official project page for more info.

Quick start with internal API

A model configuration must first be defined, using one of the model constructor:

  • EvoTreeRegressor
  • EvoTreeClassifier
  • EvoTreeCount
  • EvoTreeMLE

Model training is performed using fit. It supports additional keyword arguments to track evaluation metric and perform early stopping. Look at the docs for more details on available hyper-parameters for each of the above constructors and other options training options.

Matrix features input

using EvoTrees
using EvoTrees: fit

config = EvoTreeRegressor(
    loss=:mse, 
    nrounds=100, 
    max_depth=6,
    nbins=32,
    eta=0.1)

x_train, y_train = rand(1_000, 10), rand(1_000)
m = fit(config; x_train, y_train)
preds = m(x_train)

DataFrames input

When using a DataFrames as input, features with elements types Real (incl. Bool) and Categorical are automatically recognized as input features. Alternatively, fnames kwarg can be used to specify the variables to be used as features.

Categorical features are treated accordingly by the algorithm: ordered variables are treated as numerical features, using split rule, while unordered variables are using ==. Support is currently limited to a maximum of 255 levels. Bool variables are treated as unordered, 2-levels categorical variables.

dtrain = DataFrame(x_train, :auto)
dtrain.y .= y_train
m = fit(config, dtrain; target_name="y");
m = fit(config, dtrain; target_name="y", fnames=["x1", "x3"]);

Shap

EvoTrees includes a Julia implementation of Linear TreeShap by Yu et al. (2022). It computes exact Shapley values for decision trees in O(LD) time.

shap_effects = EvoTrees.shap(m, dtrain)

Reference

Peng Yu, Chao Xu, Albert Bifet, Jesse Read Linear Tree Shap (2022). In Proceedings of 36th Conference on Neural Information Processing Systems.

Feature importance

Returns the normalized gain by feature.

features_gain = EvoTrees.importance(m)

Plot

Plot a model's ith tree. Plotting uses a Makie recipe and requires a backend such as CairoMakie or GLMakie:

using CairoMakie
treeplot(m)       # first boosting tree
treeplot(m, 2)
# equivalently, once a backend is loaded:
plot(m)
plot(m, 2)

Save/Load

EvoTrees.save(m, "data/model.bson")
m = EvoTrees.load("data/model.bson");
boosted-trees
decision-tree
gbrt
gradient-boosting
gradientboosting
julia
logistic
machine-learning
poisson
quantile
regression

Contributors

jeremiedb

715 commits

AdityaPandeyCN

36 commits

AJ0070

19 commits

svilupp

14 commits

Evovest/EvoTrees.jl

Boosted trees in Julia

Julia

201

851 commits

updated Sep 22, 2026

See the code

README

EvoTrees

DocumentationCI StatusDOI

A Julia implementation of boosted trees with CPU and GPU support. Efficient histogram based algorithms with support for multiple loss functions (notably multi-target objectives such as max likelihood methods).

R binding available.

Installation

Latest:

julia> Pkg.add(url="https://github.com/Evovest/EvoTrees.jl")

From General Registry:

julia> Pkg.add("EvoTrees")

Performance

Data consists of randomly generated Matrix{Float64}. Training is performed on 200 iterations.
Code to reproduce is available in benchmarks/regressor.jl.

  • Run Environment:
    • CPU: 12 threads on AMD Ryzen 5900X
    • GPU: NVIDIA RTX A4000
    • Julia: v1.10.8
  • Package versions:
    • EvoTrees: v0.18.3
    • XGBoost: v3.1.2 (Using the hist algorithm)

CPU:

nobsnfeatsmax_depthtrain_evoinfer_evotrain_xgbinfer_xgb
100k1060.360.060.210.03
100k10111.280.080.630.06
100k10060.790.080.790.03
100k100114.910.123.670.07
1M1062.490.311.600.24
1M10115.070.633.160.58
1M10065.820.695.530.26
1M1001118.781.1913.400.57
10M10626.453.3430.991.76
10M101151.886.2755.205.57
10M100685.056.4465.902.56
10M10011192.5812.18111.696.02

GPU:

nobsnfeatsmax_depthtrain_evoinfer_evotrain_xgbinfer_xgb
100k1060.660.010.240.00
100k10111.430.011.120.01
100k10060.930.030.470.03
100k100112.170.032.920.06
1M1061.370.050.580.03
1M10112.450.052.140.04
1M10062.770.302.300.28
1M100115.070.326.800.58
10M1067.530.443.830.18
10M101112.600.538.660.31
10M100621.933.3321.422.88
10M1001137.253.5741.985.91

MLJ Integration

See official project page for more info.

Quick start with internal API

A model configuration must first be defined, using one of the model constructor:

  • EvoTreeRegressor
  • EvoTreeClassifier
  • EvoTreeCount
  • EvoTreeMLE

Model training is performed using fit. It supports additional keyword arguments to track evaluation metric and perform early stopping. Look at the docs for more details on available hyper-parameters for each of the above constructors and other options training options.

Matrix features input

using EvoTrees
using EvoTrees: fit

config = EvoTreeRegressor(
    loss=:mse, 
    nrounds=100, 
    max_depth=6,
    nbins=32,
    eta=0.1)

x_train, y_train = rand(1_000, 10), rand(1_000)
m = fit(config; x_train, y_train)
preds = m(x_train)

DataFrames input

When using a DataFrames as input, features with elements types Real (incl. Bool) and Categorical are automatically recognized as input features. Alternatively, fnames kwarg can be used to specify the variables to be used as features.

Categorical features are treated accordingly by the algorithm: ordered variables are treated as numerical features, using split rule, while unordered variables are using ==. Support is currently limited to a maximum of 255 levels. Bool variables are treated as unordered, 2-levels categorical variables.

dtrain = DataFrame(x_train, :auto)
dtrain.y .= y_train
m = fit(config, dtrain; target_name="y");
m = fit(config, dtrain; target_name="y", fnames=["x1", "x3"]);

Shap

EvoTrees includes a Julia implementation of Linear TreeShap by Yu et al. (2022). It computes exact Shapley values for decision trees in O(LD) time.

shap_effects = EvoTrees.shap(m, dtrain)

Reference

Peng Yu, Chao Xu, Albert Bifet, Jesse Read Linear Tree Shap (2022). In Proceedings of 36th Conference on Neural Information Processing Systems.

Feature importance

Returns the normalized gain by feature.

features_gain = EvoTrees.importance(m)

Plot

Plot a model's ith tree. Plotting uses a Makie recipe and requires a backend such as CairoMakie or GLMakie:

using CairoMakie
treeplot(m)       # first boosting tree
treeplot(m, 2)
# equivalently, once a backend is loaded:
plot(m)
plot(m, 2)

Save/Load

EvoTrees.save(m, "data/model.bson")
m = EvoTrees.load("data/model.bson");
boosted-trees
decision-tree
gbrt
gradient-boosting
gradientboosting
julia
logistic
machine-learning
poisson
quantile
regression

Contributors

jeremiedb

715 commits

AdityaPandeyCN

36 commits

AJ0070

19 commits

svilupp

14 commits

Languages

Julia

100.0%