Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiclass classification - Prediction Output #4513

hahsm opened this issue Dec 1, 2019 · 1 comment


Copy link

@hahsm hahsm commented Dec 1, 2019


The following code helps to get the predicted label with score. Is there any way that I can get additional details (columns) of each prediction based on score. What are the columns that I could include as output in a multiclass prediction (other than Label and Score). Can I include additional columns from DataSet in my output?

private static Dictionary<string, float> GetScoresWithLabelsSorted(DataViewSchema schema, string name, float[] scores)
Dictionary<string, float> result = new Dictionary<string, float>();

        var column = schema.GetColumnOrNull(name);

        var slotNames = new VBuffer<ReadOnlyMemory<char>>();
        column.Value.GetSlotNames(ref slotNames);
        var x = slotNames.GetIndices();

        var num = 0;
        foreach (var denseValue in slotNames.DenseValues())
            result.Add(denseValue.ToString(), scores[num++]);

        return result.OrderByDescending(c => c.Value).ToDictionary(i => i.Key, i => i.Value);

This comment has been minimized.

Copy link

@codemzs codemzs commented Dec 2, 2019

You can also get probabilities. Yes you can include columns from dataset in your output. Refer to this example to see how to extract probabilities.

@codemzs codemzs closed this Dec 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.