dotnet / dotnet/machinelearning-samples
The Iris classification sample way of reusing the "Label" column is confusing
- Lenguaje dominante
- PowerShell
- Estrellas
- 4.7k
- Forks
- 2.7k
- Merge medio
- 2 d 22 h
- PR fusionados (30 d)
- 1
Descripción
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 😄
Guía de contribución
Línea de trabajo
Comienza en samples/csharp/getting-started/MulticlassClassification_Iris y revisa el uso de MapValueToKey y MapKeyToValue en la canalización de entrenamiento. Después, lee la sección enlazada «Consume model» para comparar el acceso basado en anotaciones con la asignación de predicciones propuesta. Confirma qué pasos son necesarios y actualiza el ejemplo para que el manejo de la etiqueta y de la etiqueta predicha sea claro y coherente.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- csharp, machine-learning
- Área
- machine-learning
- Tipo de issue
- Refactorización
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100