ContinuousEncoder docstring: wrong `drop_last` default and nonexistent `ordered_factors` option
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 88/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- documentation
Research direction
Read the ContinuousEncoder docstring in src/transformers/other_transformers/continuous_encoder.jl, especially the Protocol and Hyper-parameters sections. Correct the stated drop_last default, clarify that one_hot_ordered_factors=true enables one-hot encoding for ordered factors, and finish the truncated option description. Done when the text matches the struct defaults and supported keyword behavior shown in the issue.
Written by the indexing model from the issue text.
Description
The docstring for ContinuousEncoder has the same kind of problem that #57 fixed for OneHotEncoder, plus a reference to a keyword that doesn't exist.
In src/transformers/other_transformers/continuous_encoder.jl the struct is
@with_kw_noshow mutable struct ContinuousEncoder <: Unsupervised
drop_last::Bool = false
one_hot_ordered_factors::Bool = false
end
but the docstring says:
- Hyper-parameters section (L132):
drop_last=true, while the actual default isfalse. - Protocol section (L97-L100): an
OrderedFactoris coerced toContinuous"unlessordered_factors=falseis specified, in which case one-hot encode it". There is noordered_factorsfield, and the logic is the other way round: you get one-hot encoding by passingone_hot_ordered_factors=true.
Also the one_hot_ordered_factors bullet ends mid-sentence ("...coerce it directly to a (single) Continuous feature using the order").
Example
using MLJBase, MLJTransforms, CategoricalArrays
m = ContinuousEncoder()
@show m.drop_last m.one_hot_ordered_factors
X = (name=categorical(["Danesh", "Lee", "Mary", "John"]),
grade=categorical(["A", "B", "A", "C"], ordered=true),
height=[1.85, 1.67, 1.5, 1.67])
W = MLJBase.transform(fit!(machine(ContinuousEncoder(), X), verbosity=0), X)
@show keys(W)
W2 = MLJBase.transform(fit!(machine(ContinuousEncoder(one_hot_ordered_factors=true), X), verbosity=0), X)
@show keys(W2)
ContinuousEncoder(ordered_factors=false)
Output:
m.drop_last = false
m.one_hot_ordered_factors = false
keys(W) = (:name__Danesh, :name__John, :name__Lee, :name__Mary, :grade, :height)
keys(W2) = (:name__Danesh, :name__John, :name__Lee, :name__Mary, :grade__A, :grade__B, :grade__C, :height)
ERROR: LoadError: MethodError: no method matching ContinuousEncoder(; ordered_factors::Bool)
This method does not support all of the given keyword arguments (and may not support any).
Closest candidates are:
ContinuousEncoder(; drop_last, one_hot_ordered_factors) got unsupported keyword argument "ordered_factors"
So with the defaults all four name levels are kept (no column dropped), and following the protocol text literally just errors.
Expected
The docstring should say drop_last=false, and the protocol bullet should read something like "unless one_hot_ordered_factors=true is specified, in which case one-hot encode it". The example at the bottom already passes drop_last=true explicitly, so it's fine as is.
Versions
- MLJTransforms v0.2.4 (
devat d3e3db3) - MLJBase v1.15.4, CategoricalArrays v1.1.1
- Julia 1.13.3
- Dominant language
- Julia
- Stars
- 1
- Forks
- 5
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 6
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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.
More from JuliaAI/MLJTransforms.jl
-
TargetEncoder: m = :auto uses the inverse of the empirical Bayes ratio and gives NaN for single-row levelsPossibly taken @EssamWisam claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
JuliaAI/MLJTransforms.jl#113 · 1 reaction · 1 assignee ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
JuliaAI/MLJTransforms.jl#108 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
JuliaAI/MLJTransforms.jl#107 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 57/100
JuliaAI/MLJTransforms.jl#116 ·
Maintainers usually reply within 1 day
-
next breaking release
Difficulty 1/5 Under an hour Newbie friendliness 58/100
JuliaAI/MLJTransforms.jl#111 ·
Maintainers usually reply within 1 day
All issues in JuliaAI/MLJTransforms.jl
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
oscar-system/Oscar.jl#6572 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
-
question
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
brown-ccv/Chamber.jl#272 ·
-
SubsidenceForcing: a model cannot be constructed on ReactantState (scalar indexing in the eager horizontal average)Possibly taken @dkytezab claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
NumericalEarth/Breeze.jl#1297 · 1 comment ·
Maintainers usually reply within 1 day