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

Problem with MLJ interface for KMedoidsClusterer #67

Closed
ablaom opened this issue Jan 28, 2024 · 1 comment
Closed

Problem with MLJ interface for KMedoidsClusterer #67

ablaom opened this issue Jan 28, 2024 · 1 comment

Comments

@ablaom
Copy link

ablaom commented Jan 28, 2024

import BetaML
using MLJTestInterface

@testset "generic mlj interface test" begin
    f, s = MLJTestInterface.test(
        [BetaML.Bmlj.KMeansClusterer,],
        MLJTestInterface.make_regression()[1];
        mod=@__MODULE__,
        verbosity=0, # bump to debug
        throw=true, # set to true to debug (`false` in CI)
    )
@test isempty(failures)
end

# generic mlj interface test: Error During Test at REPL[11]:1
#   Got exception outside of a @test
#   UndefVarError: `fitresults` not defined
#   Stacktrace:
#     [1] attempt(f::MLJTestInterface.var"#9#10"{BetaML.Bmlj.KMeansClusterer, Tuple{@NamedTuple{Rm::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, LStat::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}}}}, message::String; throw::Bool)

< parts omitted for clarity >
  
#   caused by: UndefVarError: `fitresults` not defined
#   Stacktrace:
#     [1] fitted_params(model::BetaML.Bmlj.KMeansClusterer, fitresult::@NamedTuple{classes::Vector{Int64}, centers::Matrix{Float64}, distanceFunction::BetaML.Bmlj.var"#13#15"})
#       @ BetaML.Bmlj ~/.julia/packages/BetaML/SPPMQ/src/Bmlj/Clustering_mlj.jl:175
#     [2] fitted_params(mach::MLJBase.Machine{BetaML.Bmlj.KMeansClusterer, true})
#       @ MLJBase ~/.julia/packages/MLJBase/mIaqI/src/machines.jl:820
#     [3] (::MLJTestInterface.var"#9#10"{BetaML.Bmlj.KMeansClusterer, Tuple{@NamedTuple{Rm::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, LStat::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}}}})()
#       @ MLJTestInterface ~/.julia/packages/MLJTestInterface/6i2JH/src/attemptors.jl:85
#     [4] attempt(f::MLJTestInterface.var"#9#10"{BetaML.Bmlj.KMeansClusterer, Tuple{@NamedTuple{Rm::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, LStat::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}}}}, message::String; throw::Bool)
#       @ MLJTestInterface ~/.julia/packages/MLJTestInterface/6i2JH/src/attemptors.jl:15
#     [5] #fitted_machine#8
#       @ ~/.julia/packages/MLJTestInterface/6i2JH/src/attemptors.jl:77 [inlined]
#     [6] fitted_machine
#       @ ~/.julia/packages/MLJTestInterface/6i2JH/src/attemptors.jl:75 [inlined]
#     [7] test(model_types::Vector{DataType}, data::@NamedTuple{Rm::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}, LStat::SubArray{Float64, 1, Matrix{Float64}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, true}}; mod::Module, level::Int64, throw::Bool, verbosity::Int64)                                                       
#       @ MLJTestInterface ~/.julia/packages/MLJTestInterface/6i2JH/src/test.jl:202
#     [8] macro expansion
#       @ REPL[11]:2 [inlined]
#     [9] macro expansion
#       @ /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
#    [10] top-level scope
#       @ REPL[11]:2
#    [11] eval
#       @ Core ./boot.jl:385 [inlined]
#    [12] eval_user_input(ast::Any, backend::REPL.REPLBackend, mod::Module)
#       @ REPL /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/REPL/src/REPL.jl:150                                                         
#    [13] repl_backend_loop(backend::REPL.REPLBackend, get_module::Function)
#       @ REPL /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/REPL/src/REPL.jl:246
#    [14] start_repl_backend(backend::REPL.REPLBackend, consumer::Any; get_module::Function)
#       @ REPL /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/REPL/src/REPL.jl:231
#    [15] run_repl(repl::AbstractREPL, consumer::Any; backend_on_current_task::Bool, backend::
# Any)                                                                                       
#       @ REPL /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/REPL/src/REPL.jl:389
#    [16] run_repl(repl::AbstractREPL, consumer::Any)
#       @ REPL /Applications/Julia-1.10.app/Contents/Resources/julia/share/julia/stdlib/v1.10/REPL/src/REPL.jl:375
#    [17] (::Base.var"#1013#1015"{Bool, Bool, Bool})(REPL::Module)
#       @ Base ./client.jl:432
#    [18] #invokelatest#2
#       @ Base ./essentials.jl:887 [inlined]
#    [19] invokelatest
#       @ Base ./essentials.jl:884 [inlined]
#    [20] run_main_repl(interactive::Bool, quiet::Bool, banner::Bool, history_file::Bool, color_set::Bool)                                                                            
#       @ Base ./client.jl:416
#    [21] exec_options(opts::Base.JLOptions)
#       @ Base ./client.jl:333
#    [22] _start()
#       @ Base ./client.jl:552
# Test Summary:              | Error  Total  Time
# generic mlj interface test |     1      1  6.6s
# ERROR: Some tests did not pass: 0 passed, 0 failed, 1 errored, 0 broken.
 
@sylvaticus
Copy link
Owner

Corrected and added this test on top of the already existing tests... thank you

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

2 participants