-
Notifications
You must be signed in to change notification settings - Fork 156
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
ERROR: LoadError: BoundsError: pkg = DecisionTree #607
Comments
The above code works well with the Crabs dataset. It's probably an issue with your dataset. Can you share your dataset?? |
hi there, Thank you for your time. Here are two files. X.csv was created with CSV.write and it is the X data frame. The y.csv file was created by saving the categorical vector to data frame and then CSV.write it. Do not get confuse that the X dataframe as a column named y which is NOT the target. I am using Base.invokelatest because fit!(mtm) is generating error ERROR: LoadError: MethodError: no method matching fit(::Pipeline565, ::Int64, ::DataFrame, ::CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}}) |
hi to make a bit it more clear, perhaps. here is my function that calls the fit @Everywhere function fitAndPredict(
end |
@drcxcruz thanks for reporting. I can reproduce the error on my PC. It occurs when |
you are very good! thank you so much! I am glad we found it! no rush from my side, just curious, when could we expect a fix in production? |
Hopefully soon. Had a second look at it and found that the issue was ultimately caused by resampling. During cross-validation some samples only had a single class causing trouble when computing |
@OkonSamuel Thanks for investigating. In principle we should not have a problem with missing classes, because the measure takes a categorical array and a UnivariateFiniteArray which track all the classes. Do you have a minimum working example? |
@ablaom I just opened a PR at MLJBase#fixes branch with the solution. |
@drcxcruz This new version of MLJBase should hopefully fix the problem: JuliaRegistries/General#18317 If so please close. |
thank you for fixing this so quickly! |
Describe the bug
hello again,
I am puzzled as to why I am getting the following error. My data seems fine and the code works with the load_crabs test set. It could be a data type issue. Do you have any comments, please? Thank you so much. (The @Everywhere are a must)
To Reproduce
[ Info: Training Machine{ProbabilisticTunedModel{Grid,…}} @120.
[ Info: Attempting to evaluate 2 models.
Evaluating over 2 metamodels: 0%[> ] ETA: N/A ERROR: LoadError: BoundsError
Stacktrace:
[1] getindex at .\number.jl:78 [inlined]
[2] getter at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\univariate_finite\arrays.jl:137 [inlined]
[3] _broadcast_getindex_evalf at .\broadcast.jl:631 [inlined]
[4] _broadcast_getindex at .\broadcast.jl:604 [inlined]
[5] getindex at .\broadcast.jl:564 [inlined]
[6] macro expansion at .\broadcast.jl:910 [inlined]
[7] macro expansion at .\simdloop.jl:77 [inlined]
[8] copyto! at .\broadcast.jl:909 [inlined]
[9] copyto! at .\broadcast.jl:864 [inlined]
[10] copy at .\broadcast.jl:840 [inlined]
[11] materialize at .\broadcast.jl:820 [inlined]
[12] broadcasted(::typeof(pdf), ::MLJBase.UnivariateFiniteArray{Multiclass{2},Int64,UInt32,Float64,1}, ::CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}}) at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\univariate_finite\arrays.jl:138
[13] broadcast at .\broadcast.jl:758 [inlined]
[14] (::BrierScore{UnivariateFinite})(::MLJBase.UnivariateFiniteArray{Multiclass{2},Int64,UInt32,Float64,1}, ::CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}}, ::Nothing) at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\measures\finite.jl:183
[15] BrierScore at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\measures\finite.jl:173 [inlined]
[16] value at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\measures\measures.jl:78 [inlined]
[17] value(::BrierScore{UnivariateFinite}, ::MLJBase.UnivariateFiniteArray{Multiclass{2},Int64,UInt32,Float64,1}, ::DataFrame, ::CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}}, ::Nothing) at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\measures\measures.jl:64
[18] (::MLJBase.var"#264#269"{DataFrame,CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}},MLJBase.UnivariateFiniteArray{Multiclass{2},Int64,UInt32,Float64,1}})(::BrierScore{UnivariateFinite}) at .\none:0
[19] iterate at .\generator.jl:47 [inlined]
[20] collect_to!(::Array{Array{Float64,1},1}, ::Base.Generator{Array{MLJBase.Measure,1},MLJBase.var"#264#269"{DataFrame,CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}},MLJBase.UnivariateFiniteArray{Multiclass{2},Int64,UInt32,Float64,1}}}, ::Int64, ::Int64) at .\array.jl:711
[21] collect_to_with_first!(::Array{Array{Float64,1},1}, ::Array{Float64,1}, ::Base.Generator{Array{MLJBase.Measure,1},MLJBase.var"#264#269"{DataFrame,CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}},MLJBase.UnivariateFiniteArray{Multiclass{2},Int64,UInt32,Float64,1}}}, ::Int64) at .\array.jl:689
[22] collect(::Base.Generator{Array{MLJBase.Measure,1},MLJBase.var"#264#269"{DataFrame,CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}},MLJBase.UnivariateFiniteArray{Multiclass{2},Int64,UInt32,Float64,1}}}) at .\array.jl:670
[23] (::MLJBase.var"#get_measurements#268"{Array{Tuple{Array{Int64,1},UnitRange{Int64}},1},Nothing,Int64,Array{MLJBase.Measure,1},typeof(predict),Bool,DataFrame,CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}}})(::Machine{Pipeline407}, ::Int64) at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\resampling.jl:779
[24] #248 at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\resampling.jl:644 [inlined]
[25] _mapreduce(::MLJBase.var"#248#249"{MLJBase.var"#get_measurements#268"{Array{Tuple{Array{Int64,1},UnitRange{Int64}},1},Nothing,Int64,Array{MLJBase.Measure,1},typeof(predict),Bool,DataFrame,CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}}},Machine{Pipeline407},Int64,ProgressMeter.Progress}, ::typeof(vcat), ::IndexLinear, ::UnitRange{Int64}) at .\reduce.jl:400
[26] _mapreduce_dim at .\reducedim.jl:312 [inlined]
[27] #mapreduce#580 at .\reducedim.jl:307 [inlined]
[28] mapreduce at .\reducedim.jl:307 [inlined]
[29] _evaluate!(::MLJBase.var"#get_measurements#268"{Array{Tuple{Array{Int64,1},UnitRange{Int64}},1},Nothing,Int64,Array{MLJBase.Measure,1},typeof(predict),Bool,DataFrame,CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}}}, ::Machine{Pipeline407}, ::CPU1{Nothing}, ::Int64, ::Int64) at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\resampling.jl:643
[30] evaluate!(::Machine{Pipeline407}, ::Array{Tuple{Array{Int64,1},UnitRange{Int64}},1}, ::Nothing, ::Nothing, ::Int64, ::Int64, ::Array{MLJBase.Measure,1}, ::typeof(predict), ::CPU1{Nothing}, ::Bool) at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\resampling.jl:796
[31] evaluate!(::Machine{Pipeline407}, ::CV, ::Nothing, ::Nothing, ::Int64, ::Int64, ::Array{MLJBase.Measure,1}, ::Function, ::CPU1{Nothing}, ::Bool) at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\resampling.jl:859
[32] fit(::Resampler{CV,Pipeline407}, ::Int64, ::DataFrame, ::CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}}) at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\resampling.jl:959
[33] fit_only!(::Machine{Resampler{CV,Pipeline407}}; rows::Nothing, verbosity::Int64, force::Bool) at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\machines.jl:416
[34] #fit!#80 at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\machines.jl:461 [inlined]
[35] event(::Pipeline407, ::Machine{Resampler{CV,Pipeline407}}, ::Int64, ::Grid, ::Nothing, ::NamedTuple{(:models, :fields, :parameter_scales),Tuple{Array{Pipeline407,1},Array{Expr,1},Array{Symbol,1}}}) at C:\Users\BCP.julia\packages\MLJTuning\TShXP\src\tuned_models.jl:257
[36] #6 at C:\Users\BCP.julia\packages\MLJTuning\TShXP\src\tuned_models.jl:291 [inlined]
[37] iterate at .\generator.jl:47 [inlined]
[38] _collect(::Array{Pipeline407,1}, ::Base.Generator{Array{Pipeline407,1},MLJTuning.var"#6#7"{Machine{Resampler{CV,Pipeline407}},Int64,Grid,Nothing,NamedTuple{(:models, :fields, :parameter_scales),Tuple{Array{Pipeline407,1},Array{Expr,1},Array{Symbol,1}}},ProgressMeter.Progress}}, ::Base.EltypeUnknown, ::Base.HasShape{1}) at .\array.jl:678
[39] collect_similar at .\array.jl:607 [inlined]
[40] map at .\abstractarray.jl:2072 [inlined]
[41] assemble_events(::Array{Pipeline407,1}, ::Machine{Resampler{CV,Pipeline407}}, ::Int64, ::Grid, ::Nothing, ::NamedTuple{(:models, :fields, :parameter_scales),Tuple{Array{Pipeline407,1},Array{Expr,1},Array{Symbol,1}}}, ::CPU1{Nothing}) at C:\Users\BCP.julia\packages\MLJTuning\TShXP\src\tuned_models.jl:290
[42] build(::Nothing, ::Int64, ::Grid, ::Pipeline407, ::NamedTuple{(:models, :fields, :parameter_scales),Tuple{Array{Pipeline407,1},Array{Expr,1},Array{Symbol,1}}}, ::Int64, ::CPU1{Nothing}, ::Machine{Resampler{CV,Pipeline407}}) at C:\Users\BCP.julia\packages\MLJTuning\TShXP\src\tuned_models.jl:454
[43] fit(::MLJTuning.ProbabilisticTunedModel{Grid,Pipeline407}, ::Int64, ::DataFrame, ::CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}}) at C:\Users\BCP.julia\packages\MLJTuning\TShXP\src\tuned_models.jl:491
[44] fit_only!(::Machine{MLJTuning.ProbabilisticTunedModel{Grid,Pipeline407}}; rows::Nothing, verbosity::Int64, force::Bool) at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\machines.jl:416
[45] fit_only! at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\machines.jl:384 [inlined]
[46] #fit!#80 at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\machines.jl:461 [inlined]
[47] fit!(::Machine{MLJTuning.ProbabilisticTunedModel{Grid,Pipeline407}}) at C:\Users\BCP.julia\packages\MLJBase\CcEkh\src\machines.jl:459
[48] #invokelatest#1 at .\essentials.jl:712 [inlined]
[49] invokelatest at .\essentials.jl:711 [inlined]
[50] fitAndPredict(::MLJTuning.ProbabilisticTunedModel{Grid,Pipeline407}, ::DataFrame, ::CategoricalArray{Int64,1,UInt32,Int64,CategoricalValue{Int64,UInt32},Union{}}) at C:\Users\BCP.julia\dev\
Expected behavior
no error or a clearer error message as to what is wrong :)
Additional context
Versions
(@v1.4) pkg> status
Status
C:\Users\BCP\.julia\environments\v1.4\Project.toml
[336ed68f] CSV v0.7.4
[324d7699] CategoricalArrays v0.8.1
[aaaa29a8] Clustering v0.14.1
[861a8166] Combinatorics v1.0.2
[a93c6f00] DataFrames v0.21.4
[7806a523] DecisionTree v0.10.7
[31c24e10] Distributions v0.23.5
[f6006082] EvoTrees v0.4.9
[da1fdf0e] FreqTables v0.4.0
[38e38edf] GLM v1.3.9
[0e44f5e4] Hwloc v1.0.3
[09f84164] HypothesisTests v0.10.0
[7073ff75] IJulia v1.21.2
[b1bec4e5] LIBSVM v0.4.0
[7acf609c] LightGBM v0.3.1
[add582a8] MLJ v0.12.0
[6ee0df7b] MLJLinearModels v0.5.0
[d491faf4] MLJModels v0.11.2
[e1d29d7a] Missings v0.4.3
[42b8e9d4] ParallelKMeans v0.1.8
[14b8a8f1] PkgTemplates v0.7.6
[54e16d92] PrettyPrinting v0.2.0
[1a8c2f83] Query v0.12.2
[612083be] Queryverse v0.6.1
[8523bd24] ShapML v0.3.0 #master (https://github.com/nredell/ShapML.jl)
[2913bbd2] StatsBase v0.33.0
[bd369af6] Tables v1.0.4
[112f6efa] VegaLite v2.2.0
[009559a3] XGBoost v1.1.1
The text was updated successfully, but these errors were encountered: