JuliaAI / JuliaAI/DecisionTree.jl
AdaBoostStumpClassifier MethodError: zero(::Type{Symbol})
Open
Nobody has claimed this yet.
bug
- Dominant language
- Julia
- Stars
- 364
- Forks
- 100
- PR merge metrics
- No merged PRs in 30d
Description
The function fit! fails with number of iterations > 5.
bdt = let
_model = AdaBoostStumpClassifier(; n_iterations = 10)
fit!(_model, X_train, y_train)
end
fails with an error,
MethodError: no method matching zero(::Type{Symbol})
The function `zero` exists, but no method is defined for this combination of argument types.
Closest candidates are:
zero(::Type{Union{}}, Any...)
@ Base number.jl:310
zero(::Type{Dates.DateTime})
@ Dates ~/.julia/juliaup/julia-1.11.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Dates/src/types.jl:458
zero(::Type{Pkg.Resolve.VersionWeight})
@ Pkg ~/.julia/juliaup/julia-1.11.5+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/Pkg/src/Resolve/versionweights.jl:15
...
It depends on dataset to train, see MWE, it works on one set, fails on the other
MWE
begin
using Random
using DataFrames
using DecisionTree
Random.seed!(1234)
end
function classify_signal_background(x, y)
# Sinusoidal boundary
# if sin(2.5π * (x - 0.55)) / 5 + 0.3 + 0.4x < y < 0.7 + 0.4x # note: this one has no problem
if (x-0.25)^2 + (y-0.25)^2 < 0.05 || (x-0.65)^2 + (y-0.65)^2 < 0.05
return :signal
else
return :background
end
end
const features = [:f1, :f2];
df = let
_df = DataFrame(rand(500, 2), features)
transform!(_df, features => ByRow(classify_signal_background) => :y)
end
bdt = let
_model = AdaBoostStumpClassifier(; n_iterations = 40)
X_train = df[:,features] |> Matrix
y_train = df[:, :y]
fit!(_model,X_train, y_train)
end
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the AdaBoostStumpClassifier implementation and its fit! method, then run the supplied Julia MWE with both datasets and iteration counts. Trace the failing path that produces zero(::Type{Symbol}); done means fitting succeeds for the reproduced labeled data with n_iterations greater than 5.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100