JuliaAI / MLJXGBoostInterface.jl

MIT License
11 stars 5 forks source link

TypeError: in keyword argument watchlist #46

Closed rikhuijzer closed 10 months ago

rikhuijzer commented 10 months ago

When running the tests of this package, I get an error:

┌ Error: Problem fitting the machine machine(XGBoostClassifier(test = 1, …), …).
└ @ MLJBase ~/.julia/packages/MLJBase/fEiP2/src/machines.jl:682
[ Info: Running type checks...
[ Info: Type checks okay.
Binary Classification: Error During Test at /Users/rik/git/MLJXGBoostInterface.jl/test/runtests.jl:14
  Got exception outside of a @test
  TypeError: in keyword argument watchlist, expected AbstractDict, got a value of type NamedTuple{(), Tuple{}}
  Stacktrace:
    [1] fit(model::XGBoostClassifier, verbosity::Int64, X::NamedTuple{(:x1, :x2, :x3), Tuple{Vector{Float64}, Vector{Float64}, Vector{Float64}}}, y::CategoricalArrays.CategoricalVector{String, UInt32, String, CategoricalArrays.CategoricalValue{String, UInt32}, Union{}})
      @ MLJXGBoostInterface ~/git/MLJXGBoostInterface.jl/src/MLJXGBoostInterface.jl:165
    [2] fit_only!(mach::Machine{XGBoostClassifier, true}; rows::Nothing, verbosity::Int64, force::Bool, composite::Nothing)
      @ MLJBase ~/.julia/packages/MLJBase/fEiP2/src/machines.jl:680
    [3] fit_only!
      @ ~/.julia/packages/MLJBase/fEiP2/src/machines.jl:606 [inlined]
    [4] #fit!#63
      @ ~/.julia/packages/MLJBase/fEiP2/src/machines.jl:777 [inlined]
    [5] macro expansion
      @ ~/git/MLJXGBoostInterface.jl/test/runtests.jl:28 [inlined]
    [6] macro expansion
      @ ~/.julia/juliaup/julia-1.9.4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.9/Test/src/Test.jl:1498 [inlined]
    [7] top-level scope
      @ ~/git/MLJXGBoostInterface.jl/test/runtests.jl:15
    [8] include(fname::String)
      @ Base.MainInclude ./client.jl:478
    [9] top-level scope
      @ none:6
   [10] eval
      @ ./boot.jl:370 [inlined]
   [11] exec_options(opts::Base.JLOptions)
      @ Base ./client.jl:280
   [12] _start()
      @ Base ./client.jl:522
Test Summary:         | Error  Total  Time
Binary Classification |     1      1  3.1s
ERROR: LoadError: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.
in expression starting at /Users/rik/git/MLJXGBoostInterface.jl/test/runtests.jl:14
ERROR: Package MLJXGBoostInterface errored during testing

I'm opening this issue because this thing will probably come back even after we fix it because not everyone will run the same versions.

I'm investigating. The cause looks https://github.com/dmlc/XGBoost.jl/pull/193. It looks like it should probably be fixed at the XGBoost.jl side.

ExpandingMan commented 10 months ago

Sorry, this is my fault when I merged that. I will write a PR to get it to accept either AbstractDict or NamedTuple.

ExpandingMan commented 10 months ago

This patch should restore functionality for NamedTuple.

ablaom commented 10 months ago

@rikhuijzer Can this be closed in view of #47 ?