Skip to content

Exposing the tree for multiclass classification #6370

Closed

Description

@oberma-schueco

Hey.

We are currently porting our Code from the Accord framework to ML.net and struggle to do so. In the Accord.net framework we are using the C4.5 decision tree algorithm to process our data and so we were looking into multiclass trainers from ML.net.

With Accord.net we have the ability to inspect the trained tree and expose this via text form to the user. Are we able to get the same information with ML.net?

After reading into #4275 we are actively looking into the LightGBM trainer, but I am only able to find the trained tree ensemble for all the other options except the multiclass classification version of LightGBM.

Activity

  1. ghost added
    untriagedNew issue has not been triaged
    on Oct 12, 2022
  2. michaelgsharp commented on Nov 28, 2022

    @michaelgsharp
    Contributor

    So you should be able to use the same steps for LightGBM as you do the other tree models. When we use LightGBM after training we actually convert it to the same representation as the other tree models.

    @luisquintanilla any other suggestions?

  3. oberma-schueco commented on Nov 30, 2022

    @oberma-schueco
    Author

    @michaelgsharp What method are you using exactly? For all the LightGBM extensions there are ModelParameters that expose the tree, except for the multiclass version of it. And that is what we are actually looking into.

    Can you explain how you do the conversion? Maybe there is a conversion from multiclass to another method?

  4. added this to the ML.NET 3.0 milestone on Mar 29, 2023
  5. ghost removed
    untriagedNew issue has not been triaged
    on Mar 29, 2023
  6. luisquintanilla commented on Mar 29, 2023

    @luisquintanilla
    Contributor

    Hi @sp44rk,

    Thanks for this issue. We've added this to our backlog.

  7. ghost removed
    untriagedNew issue has not been triaged
    on Jan 23, 2024
  8. modified the milestones: ML.NET 4.0, ML.NET 5.0 on Jan 16, 2025
  9. added
    Priority:1Work that is critical for the release, but we could probably ship without
    area-TreesTree-based trainers, including FastTree and LightGBM
    and removed on Sep 8, 2026
  10. matouskozak commented on Oct 23, 2026

    @matouskozak
    Member

    Triage:
    I see two possible workarounds are:

    • Export to ONNX and write code to read the tree structure and display it as text. This requires a compatible model and custom parsing.
    • Train separate binary models, one per class, and inspect each model’s TrainedTreeEnsemble. You would need to combine their predictions yourself.

    Hope this helps a bit, feel free to reach out if you still have issues.

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

    Priority:1Work that is critical for the release, but we could probably ship withoutarea-TreesTree-based trainers, including FastTree and LightGBMenhancementNew feature or requestquestionFurther information is requestedyellowmaintenance only

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions