dotnet / dotnet/machinelearning

Simplify post-prediction schema info to make user-friendly prediction's info such as list of ranked predicted labels/categories

Open
#2,278 4 comments 0 reactions 0 assignees View on GitHub
area-Core enhancement Priority:2
Dominant language
C#
Stars
9.4k
Forks
2k
Avg merge
2d 20h
Merged PRs (30d)
11

Description

**CONTEXT:**

In this PR (and probably, available in 0.10), we're allowing the user to get some schema info after predicting:

https://github.com/dotnet/machinelearning/pull/2250

That way a user can get, for example, get the list of the predicted labels in a multi-class classification and related that to the list/array of scores.

That's very useful for business cases where you want to automatically predict/assign a product to multiple categories, for example, instead of predicting a single category/label.

However, the current user's code needs to be like the following, using not user-friendly types such as VBuffer, etc.:

```
// Slot names on top of Score column represent original labels for i-th value in Score array.
VBuffer> slotNames = default;
engine.OutputSchema[nameof(IrisPrediction.Score)].GetSlotNames(ref slotNames);
// Key names represent original values for PredictedLabel column.
VBuffer> keys = default;
engine.OutputSchema[nameof(IrisPrediction.PredictedLabel)].GetKeyValues(ref keys);

Assert.True(slotNames.GetItemOrDefault(0).ToString() == "Iris-setosa");
Assert.True(slotNames.GetItemOrDefault(1).ToString() == "Iris-versicolor");
Assert.True(slotNames.GetItemOrDefault(2).ToString() == "Iris-virginica");
```

**REQUEST:**

The ask is to simplify it and provide types and simpler API with user-friendly data-types that are familiar for regular .NET developers.

Also, a more straightforward way to relate the list of labels with their related scores. Maybe returning a single array/list with both concepts coming along (labels-scores) instead of separated arrays/lists?

-------------
Related info
-------------

This topic is related with this original issue, too:
Multi-class classification returning ranked list of possible labels): https://github.com/dotnet/machinelearning/issues/2233

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.