dotnet / dotnet/machinelearning-samples

The Iris classification sample way of reusing the "Label" column is confusing

オープン
#830 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る
主要言語
PowerShell
スター
4.7k
フォーク
2.7k
平均マージ
2日 22時間
マージ済み PR(30日)
1

説明

As mentioned by this ML.NET user, the way the [Iris Multiclassification sample](https://github.com/dotnet/machinelearning-samples/tree/master/samples/csharp/getting-started/MulticlassClassification_Iris) reuses the "Label" column is confusing:

https://github.com/dotnet/machinelearning/issues/5264#issuecomment-652487403.

The problem is that in the sample, we have this:
```C#
.Append(mlContext.Transforms.Conversion.MapKeyToValue(outputColumnName: nameof(IrisData.Label) , inputColumnName: "KeyColumn"));

```
Which the user interpreted that it was mapping the result of the prediction to the `Label` field.

What that step is doing is to actually map the key version of `Label` back to the original value of `Label` itself. Still, I don't know why this step is necessary, since the Label column itself is never modified (the MapValueToKey used at the beginning of the pipeline is actually mapping the Label column into a new KeyColumn, so no need to map back those values).

The lack of a `MapKeyToValue` that actually mapped back the values of "PredictedLabel" was what confused the user.

Furthermore, I also find strange that later when [consuming the model](https://github.com/dotnet/machinelearning-samples/tree/master/samples/csharp/getting-started/MulticlassClassification_Iris#4-consume-model) the approach to get the values for the key "PredictedLabel" column is to actually get the annotations. Which is somewhat a weird approach, since I'd find using a `MapKeyToValue` to be more user-friendly.

I guess a closer look to this is needed to determine if there's a reason behind those decisions. But at first look it seems that they're unnecessary, and it would be less confusing for users if we get rid of them. Thanks 😄

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

samples/csharp/getting-started/MulticlassClassification_Iris から始め、トレーニング パイプラインでの MapValueToKey と MapKeyToValue の使用方法を確認します。次に、リンクされている「Consume model」セクションを読んで、アノテーション ベースのアクセスと提案されている予測マッピングを比較します。必要な手順を確認し、ラベルと予測ラベルの扱いが明確かつ一貫するようにサンプルを更新します。

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

評価

技術スタック
csharp, machine-learning
領域
machine-learning
issue の種類
リファクタリング
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

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

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