ContinuousEncoder docstring: wrong `drop_last` default and nonexistent `ordered_factors` option

オープン 初心者向け
#109 コメント 1 件 リアクション 1 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@ablaom がすでに取り組んでいます。

2026年11月30日 から。

  • #110 @ablaom による — オープン

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
88/100
issue の種類
ドキュメント
明瞭さ
明確に書かれている
活発さ
活発
領域
documentation

調査の方向性

src/transformers/other_transformers/continuous_encoder.jl にある ContinuousEncoder の docstring、特に Protocol と Hyper-parameters のセクションを読んでください。drop_last の記載されたデフォルト値を訂正し、one_hot_ordered_factors=true が順序付き因子の one-hot エンコーディングを有効にすることを明確にし、途切れているオプションの説明を完成させてください。Issue に示されている struct のデフォルト値およびサポートされるキーワードの動作とテキストが一致したら完了です。

索引モデルが issue の本文から書いたものです。

説明

documentation

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:

  1. Hyper-parameters section (L132): drop_last=true, while the actual default is false.
  2. Protocol section (L97-L100): an OrderedFactor is coerced to Continuous "unless ordered_factors=false is specified, in which case one-hot encode it". There is no ordered_factors field, and the logic is the other way round: you get one-hot encoding by passing one_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 (dev at d3e3db3)
  • MLJBase v1.15.4, CategoricalArrays v1.1.1
  • Julia 1.13.3
主要言語
Julia
スター
1
フォーク
5
平均マージ
1日 4時間
マージ済み PR(30日)
6

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

JuliaAI/MLJTransforms.jl のほかの issue

JuliaAI/MLJTransforms.jl の issue をすべて見る

似ている issue

Julia の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。