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

Need better error validation for improper inputs #62

Open
ViralBShah opened this issue Apr 18, 2019 · 0 comments
Open

Need better error validation for improper inputs #62

ViralBShah opened this issue Apr 18, 2019 · 0 comments

Comments

@ViralBShah
Copy link
Collaborator

I provided an improper data structure for labels to and got the following error. I was providing a vector of tuples instead of what it expects. I think validating the types of the inputs and providing a better error message would be helpful.

julia> bst = xgboost(s, 20, label = labels, eta = 1, max_depth = 2)
ERROR: MethodError: no method matching (::getfield(XGBoost, Symbol("#_setinfo#8")))(::Ptr{Nothing}, ::String, ::Array{Tuple{Vararg{String,N} where N},1})
Closest candidates are:
  _setinfo(::Ptr{Nothing}, ::String, ::Array{#s12,1} where #s12<:Number) at /Users/viral/.julia/packages/XGBoost/udvqz/src/xgboost_lib.jl:10
Stacktrace:
 [1] (::getfield(XGBoost, Symbol("##DMatrix#6#10")){getfield(XGBoost, Symbol("#_setinfo#8"))})(::Base.Iterators.Pairs{Symbol,Array{Tuple{Vararg{String,N} where N},1},Tuple{Symbol},NamedTuple{(:label,),Tuple{Array{Tuple{Vararg{String,N} where N},1}}}}, ::Type, ::SparseMatrixCSC{Float64,Int64}, ::Bool) at /Users/viral/.julia/packages/XGBoost/udvqz/src/xgboost_lib.jl:40
 [2] (::getfield(Core, Symbol("#kw#Type")))(::NamedTuple{(:label,),Tuple{Array{Tuple{Vararg{String,N} where N},1}}}, ::Type{DMatrix}, ::SparseMatrixCSC{Float64,Int64}, ::Bool) at ./none:0 (repeats 2 times)
 [3] makeDMatrix(::SparseMatrixCSC{Float64,Int64}, ::Array{Tuple{Vararg{String,N} where N},1}) at /Users/viral/.julia/packages/XGBoost/udvqz/src/xgboost_lib.jl:137
 [4] #xgboost#20(::Array{Tuple{Vararg{String,N} where N},1}, ::Array{Any,1}, ::Array{Any,1}, ::Array{Any,1}, ::Type, ::Type, ::Array{Any,1}, ::Base.Iterators.Pairs{Symbol,Int64,Tuple{Symbol,Symbol},NamedTuple{(:eta, :max_depth),Tuple{Int64,Int64}}}, ::typeof(xgboost), ::SparseMatrixCSC{Float64,Int64}, ::Int64) at /Users/viral/.julia/packages/XGBoost/udvqz/src/xgboost_lib.jl:147
 [5] (::getfield(XGBoost, Symbol("#kw##xgboost")))(::NamedTuple{(:label, :eta, :max_depth),Tuple{Array{Tuple{Vararg{String,N} where N},1},Int64,Int64}}, ::typeof(xgboost), ::SparseMatrixCSC{Float64,Int64}, ::Int64) at ./none:0
 [6] top-level scope at none:0
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