ContinuousEncoder docstring: wrong `drop_last` default and nonexistent `ordered_factors` option
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 1/5
- 見積もり時間
- 1時間未満
- 初心者へのやさしさ
- 88/100
- issue の種類
- ドキュメント
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
調査の方向性
src/transformers/other_transformers/continuous_encoder.jl にある ContinuousEncoder の docstring、特に Protocol と Hyper-parameters のセクションを読んでください。drop_last の記載されたデフォルト値を訂正し、one_hot_ordered_factors=true が順序付き因子の one-hot エンコーディングを有効にすることを明確にし、途切れているオプションの説明を完成させてください。Issue に示されている struct のデフォルト値およびサポートされるキーワードの動作とテキストが一致したら完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Julia
- スター
- 1
- フォーク
- 5
- 平均マージ
- 1日 4時間
- マージ済み PR(30日)
- 6
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
JuliaAI/MLJTransforms.jl のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
JuliaAI/MLJTransforms.jl#113 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
JuliaAI/MLJTransforms.jl#108 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
JuliaAI/MLJTransforms.jl#107 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
next breaking release
難易度 1/5 1時間未満 初心者へのやさしさ 58/100
JuliaAI/MLJTransforms.jl#111 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 72/100
JuliaAI/MLJTransforms.jl#106 ·
メンテナーはふだん 1 日以内に返信
JuliaAI/MLJTransforms.jl の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
-
question
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
brown-ccv/Chamber.jl#272 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
JuliaAstro/SolarPosition.jl#143 ·
-
distributions
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
JuliaBayes/Wren.jl#404 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信