Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MLJ Readme example fails on v0.3.4 #32

Closed
ericphanson opened this issue Feb 29, 2024 · 1 comment
Closed

MLJ Readme example fails on v0.3.4 #32

ericphanson opened this issue Feb 29, 2024 · 1 comment

Comments

@ericphanson
Copy link
Collaborator

ericphanson commented Feb 29, 2024

julia> module Regression

       using CatBoost.MLJCatBoostInterface
       using DataFrames
       using MLJBase

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

       # Initialize MLJ Machine
       model = CatBoostRegressor(iterations = 2, learning_rate = 1, depth = 2)
       mach = machine(model, train_data, train_labels)

       # Fit model
       MLJBase.fit!(mach)

       # Get predictions
       preds = predict(model, eval_data)

       end # module
WARNING: replacing module Regression.
[ Info: Training machine(CatBoostRegressor(iterations = 2, ), ).
ERROR: MethodError: no method matching predict(::CatBoost.MLJCatBoostInterface.CatBoostRegressor, ::DataFrames.DataFrame)

Closest candidates are:
  predict(::CatBoost.MLJCatBoostInterface.CatBoostRegressor, ::Any, ::Any)
   @ CatBoost ~/.julia/packages/CatBoost/TiqIz/src/mlj_catboostregressor.jl:90
  predict(::CatBoost.MLJCatBoostInterface.CatBoostClassifier, ::Any, ::Any)
   @ CatBoost ~/.julia/packages/CatBoost/TiqIz/src/mlj_catboostclassifier.jl:100
  predict(::MLJBase.Machine, ::Any)
   @ MLJBase ~/.julia/packages/MLJBase/mIaqI/src/operations.jl:130
  ...

Stacktrace:
 [1] top-level scope
   @ REPL[10]:19

(jl_VyECfX) pkg> st
Status `/private/var/folders/jb/plyyfc_d2bz195_0rc0n_zcw0000gp/T/jl_VyECfX/Project.toml`
  [e2e10f9a] CatBoost v0.3.4
  [a93c6f00] DataFrames v1.6.1
  [a7f614a8] MLJBase v1.1.1
  [6099a3de] PythonCall v0.9.15
@ericphanson
Copy link
Collaborator Author

works, ty!

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
[ Info: Training machine(CatBoostRegressor(iterations = 2, ), ).
Main.Regression

julia> Regression.preds_class
2-element Vector{Float64}:
 15.625
 18.125

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant