JuliaAI / CatBoost.jl

Julia wrapper of the python library CatBoost for boosted decision trees
MIT License
11 stars 3 forks source link

Fix MLJ example in docs #33

Closed tylerjthomas9 closed 4 months ago

tylerjthomas9 commented 4 months ago

Ref #32

I somehow did not commit the change to update the README.md example (the main reason I opened the previous PR). This should fix it. I apologize for the sloppiness.

julia> module Regression

       using CatBoost.MLJCatBoostInterface
       using DataFrames
       using MLJBase

       # Initialize data
       train_data = DataFrame([[1, 4, 30], [4, 5, 40], [5, 6, 50], [6, 7, 60]], :auto)
       train_labels = [10.0, 20.0, 30.0]
       eval_data = DataFrame([[2, 1], [4, 4], [6, 50], [8, 60]], :auto)

       # Initialize CatBoostClassifier
       model = CatBoostRegressor(; iterations=2, learning_rate=1.0, depth=2)
       mach = machine(model, train_data, train_labels)

       # Fit model
       MLJBase.fit!(mach)

       # Get predictions
       preds_class = MLJBase.predict(mach, eval_data)

       end # module
WARNING: replacing module Regression.
[ Info: Training machine(CatBoostRegressor(iterations = 2, …), …).
Main.Regression