Skip to content

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

Open
@CESARDELATORRE

Description

@CESARDELATORRE

CONTEXT:

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

#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<ReadOnlyMemory<char>> slotNames = default;
            engine.OutputSchema[nameof(IrisPrediction.Score)].GetSlotNames(ref slotNames);
            // Key names represent original values for PredictedLabel column.
            VBuffer<ReadOnlyMemory<char>> 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): #2233

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Priority of the issue for triage purpose: Needs to be fixed at some point.enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions