I'm new to all the packages referenced here, sorry I can't diagnose.
Environment:
julia version 1.10.4
cat Project.toml
[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Term = "22787eb5-b846-44ae-b979-8e399b8463ab"
XGBoost = "009559a3-9522-5dbb-924b-0b6ed2b22bb9"
pkg> st
Status ...etc
[a93c6f00] DataFrames v1.6.1
[22787eb5] Term v2.0.6
[009559a3] XGBoost v2.5.1
I tried out the TLDR example in the docs:
using DataFrames, XGBoost, Term
# training set of 100 datapoints of 4 features
(X, y) = (randn(100,4), randn(100))
# create and train a gradient boosted tree model of 5 trees
bst = xgboost((X, y), num_round=5, max_depth=6, objective="reg:squarederror")
# obtain model predictions
ŷ = predict(bst, X)
df = DataFrame(randn(100,3), [:a, :b, :y])
# can accept tabular data, will keep feature names
bst = xgboost((df[!, [:a, :b]], df.y))
# display importance statistics retaining feature names
importancereport(bst)
╭───────────┬────────────┬──────────┬───────────┬──────────────┬───────────────╮
│ feature │ gain │ weight │ cover │ total_gain │ total_cover │
├───────────┼────────────┼──────────┼───────────┼──────────────┼───────────────┤
│ "b" │ 1.16553 │ 82.0 │ 34.7073 │ 95.5735 │ 2846.0 │
├───────────┼────────────┼──────────┼───────────┼──────────────┼───────────────┤
│ "a" │ 0.918156 │ 108.0 │ 26.463 │ 99.1608 │ 2858.0 │
╰───────────┴────────────┴──────────┴───────────┴──────────────┴───────────────╯
So far so good
trees(bst)
#... stack trace in next comment
I'm new to all the packages referenced here, sorry I can't diagnose.
Environment:
I tried out the TLDR example in the docs:
So far so good