Skip to content

FastForestOva has its prediction value in Score[1] instead of Score[0] #6037

Closed

Description

@andrasfuchs

System Information (please complete the following information):

  • OS & Version: Windows 11
  • ML.NET Version: ML.NET v1.7
  • .NET Version: .NET 6.0
  • ML.NET Model Builder: ML.NET Model Builder 2022 v16.9.2.2205603

Describe the bug
Usually the probabilities of the trained models are stored in the Score values of the ModelOutput class (generated by ML.NET Model Builder). The first item in that array of floats is the prediction value when we use the FastTreeOva or LightGbmMulti algorithms, but interestingly it is the second item in that array if we use FastForestOva.
I'm not 100% sure that it is a bug, but I would expect consistency in this regard among the different algorithms.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Solution Explorer
  2. Right click on the project, add Machine Learning Model
  3. Start training your model, and stop at the different times to have different algorithms as best
  4. Test the generated classes by running them with your input data and show the ModelOutput.Score array
  5. Observe the different values and their meaning, especially for the FastForestOva algorithm

Expected behavior
I would expect all the algorithms to return their prediction values in the same order.

Screenshots, Code, Sample Projects
Accuracy is calculated based on OutputModel.Score[0] values and IsAttached uses LightGbmMulti, IsNotAttached uses FastForestOva. They both had 99+% accuracy during training.
image

Additional context
I could test FastTreeOva, LightGbmMulti and FastForestOva: the first two had their prediction value in Score[0], and FastForestOva had its in Score[1].

Activity

  1. michaelgsharp commented on Jan 10, 2022

    @michaelgsharp
    Contributor

    I would agree that consistency is important... we will have to see what is causing this.

    @JakeRadMSFT is this possibly due to how model builder is generating the Model Output file? Or do we need to go dig through the ML.NET code and see whats going on?

  2. michaelgsharp commented on Jan 10, 2022

    @michaelgsharp
    Contributor

    @andrasfuchs would you be able to share your training pipeline? Both with this one and #6035?

  3. andrasfuchs commented on Jan 11, 2022

    @andrasfuchs
    ContributorAuthor

    Sure, I use Visual Studio 2022 v17.0.4 with the ML.NET Model Builder 2022 v16.9.2.2205603 extension. I have a C# console application that includes these mbconfigs to generate the ML models:
    https://drive.google.com/file/d/1CZJitEjEd3GEhBbHZUMOgEbRg3GaPsMD/view?usp=sharing

    Here you can find the data that I used for training and for the model accuracy measurements:
    https://drive.google.com/file/d/1C2Of2UIHN2y7l5J-SvEvacFhTAHMCCcm/view?usp=sharing

    My source code is work in progress, but you can check it out here:
    https://github.com/andrasfuchs/BioBalanceDetector/tree/master/Software/Source/BBDProto08/BBD.SleepLogger

    Let me know if you need anything more!

  4. andrasfuchs commented on Jan 19, 2022

    @andrasfuchs
    ContributorAuthor

    Hi guys, did you have the chance to look into this? Do you need any more data from me to reproduce the problem?

  5. changed the title [-]FastForestOva has its prediction value in Score[1] instead on Score[0][/-] [+]FastForestOva has its prediction value in Score[1] instead of Score[0][/+] on Feb 16, 2022
  6. added
    area-TreesTree-based trainers, including FastTree and LightGBM
    needs-author-actionMore information or action is needed from the author
    and removed on Sep 8, 2026
  7. dotnet-policy-service commented on Sep 8, 2026

    @dotnet-policy-service
    Contributor

    This issue has been marked needs-author-action and may be missing some important information.

  8. matouskozak commented on Oct 23, 2026

    @matouskozak
    Member

    Triage: I think that Score contains one value per class, in label-key order rather than confidence order. Score[0] is therefore not necessarily the predicted class’s score. Changing trainers with the same fitted label mapping should preserve the meaning of each slot. You can inspect the mapping using the prediction engine.

    I'll close this issue as it's quite old and might not be relevant anymore but feel free to re-open if you encounter unexpected behavior again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-TreesTree-based trainers, including FastTree and LightGBMyellowmaintenance only

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions