question

AlanIwashita-4101 avatar image
0 Votes"
AlanIwashita-4101 asked AlanIwashita-4101 commented

ML.net How do I get value string for more than just the predicted result?

Forgive me... I am a beginner at this. I created & trained a model with the wizard. It is a text classification model. I would like to know the top 5 predictions and their scores. The default code is...


     public static ModelOutput Predict(ModelInput input)
     {
         ModelOutput result = PredictionEngine.Value.Predict(input);
         return result;
     }

result gives the string of the top prediction and an array of floats which I assume is the scores of the possible answers (I could be wrong). How would I find out what the second best answer's string?

dotnet-ml-big-data
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

AlanIwashita-4101 avatar image
0 Votes"
AlanIwashita-4101 answered AlanIwashita-4101 commented

I may have found the answer to my own question...
https://blog.hompus.nl/2020/09/14/get-all-prediction-scores-from-your-ml-net-model/

I still need to try it out, but since there's other watchers I thought I'd share it.

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

The solution from Michael Hompus (and whomever he got it from) works. As with much of the code you find on the web, it needed to be tweaked a little for the constructs of my program. But wow, never would have known that label buffer trick without reading his webpage.

0 Votes 0 ·