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

Old syntax xgboost() results in stack overflow #130

Open
alyst opened this issue Nov 5, 2022 · 1 comment
Open

Old syntax xgboost() results in stack overflow #130

alyst opened this issue Nov 5, 2022 · 1 comment

Comments

@alyst
Copy link

alyst commented Nov 5, 2022

On XGBoost.jl v2.0.0 the command xgmodel = xgboost(train_dmtx, 5000, gamma = 1) gives

[ Info: XGBoost: starting training.                                                                                                                                                                                             
ERROR: StackOverflowError:                                                                                                                                                                                                      
Stacktrace:                                                                                                                                                                                                                     
 [1] updateone!(b::Booster, data::DMatrix, a::Int64; kw::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:round_number, :watchlist), Tuple{Int64, Dict{String, DMatrix}}}}) (repeats 32465 times)                    
   @ XGBoost ~/.julia/packages/XGBoost/wlUNO/src/booster.jl:373                                                                                                                                                                 
 [2] #update!#59                                                                                                                                                                                                                
   @ ~/.julia/packages/XGBoost/wlUNO/src/booster.jl:390 [inlined]                                                                                                                                                               
 [3] xgboost(dm::DMatrix, a::Int64; num_round::Int64, watchlist::Dict{String, DMatrix}, kw::Base.Pairs{Symbol, Int64, Tuple{Symbol, Symbol}, NamedTuple{(:gamma, :silent), Tuple{Int64, Int64}}})                               
   @ XGBoost ~/.julia/packages/XGBoost/wlUNO/src/booster.jl:430                                                                                                                                                                 
 [4] top-level scope                                                                                                                                                                                                            
   @ REPL[7]:1                                                                                                                                                                                                                  

The method in question is

updateone!(b::Booster, data, a...; kw...) = updateone!(b, DMatrix(data), a...; kw...)

It is supposed to call the more specific updateone!(b::Booster, data::DMatrix, ...), but it also requires that the a... args match the signature of the more specific method, otherwise it will recurse.

@ExpandingMan
Copy link
Collaborator

I'm sure I thought having the generic method was terribly clever when I first wrote it but I agree this is too much of a footgun. I'll have to go through it a little carefully to make sure we have the right methods.

If anybody else wants to fix, I will accept the PR.

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