dotnet / dotnet/machinelearning-modelbuilder

Provide list of labels related to score array

Open
#1,350 5 comments 0 reactions 0 assignees View on GitHub
Code Example? ML Feature Request Priority:1 Reported by: Customer Stale
Dominant language
Dockerfile
Stars
285
Forks
66
PR merge metrics
No merged PRs in 30d

Description

An image classification gives the following output:

```
public class ModelOutput
{
// ColumnName attribute is used to change the column name from
// its default value, which is the name of the field.
[ColumnName("PredictedLabel")]
public String Prediction { get; set; }
public float[] Score { get; set; }
}
```

If a model classifies two labels, the first one is related to the first array item and the second to the second array item.

But, from a programmer/model user perspective, I do not know what is what...

I have to program something like this:

```
...
Console.WriteLine($"This is a {predictionResult.Prediction} with a reliabilty of {GetPercentage(predictionResult)}% (Time: {sw.ElapsedMilliseconds}ms)");

Console.WriteLine("=============== End of process, hit any key to finish ===============");
Console.ReadKey();
}

private static double GetPercentage(ModelOutput predictionResult)
{
if (predictionResult.Prediction.ToUpper() == "HEAD")
{
return predictionResult.Score[0] * 100;
}

if (predictionResult.Prediction.ToUpper() == "TAIL")
{
return predictionResult.Score[1] * 100;
}

return -1;
}
```

Please provide a list (array?) of the labels te be expected related to the array index of the prediction outcome.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.