Skip to content

Visualization of FastTree Results from RegressionExperiment (Descicion Tree Visualization) #5761

Closed as not planned

Description

@0xclx

System information

  • OS version/distro: Windows 10
  • .NET Version (eg., dotnet --info): .NET 5.0

Issue

Assuming we create a new RegressionExperiment, generate some Test and Training Data and after Executing the Experiment we see that a FastTreeRegression was the BestRun of the ExperimentResult<RegressionMetrics>.

In Scikit (Python), you can directly let the Library Plot the Descicion Tree, but in ML.NET I haven't found such a possibility yet.
Is there a simple way that I am missing to create some kind of data structure (or JSON) that would print the descicion tree? Favorably with Labels and the threshhold value.

I have found other issues concerning this Problem but they all were closed without an actual solution in 2018 or 2019, so this didn't help me at all, sadly.

I know we can extract the Transformer and corresponding TreeEnsemble from a RunDetail<RegressionMetrics> via some ugly casting (((PredictionTransformerBase<Microsoft.ML.Trainers.FastTree.FastTreeRegressionModelParameters>)((TransformerChain<IPredictionTransformer<object>>)bestRun.Model)), but I sadly do not know where to go from there.

And since I am not too familiar with the API as well - Is there any built-in way on receiving the Information on how the descicion tree(s) is/are built up which can also be used to visualize as a graph?

Source code / logs

What I am doing at the moment looks something like this:

RegressionExperiment experiment = context.Auto().CreateRegressionExperiment(60 * 10);
var trainTestData = CreateTrainTestData(); //Create some testdata with TrainTestSplit

ExperimentResult<RegressionMetrics> experimentResult = experiment.Execute(trainTestData.TrainSet, "Label")

//We assume we will always get a FastDescicionTree for the example
var transformer = ((PredictionTransformerBase<Microsoft.ML.Trainers.FastTree.FastTreeRegressionModelParameters>)((TransformerChain<IPredictionTransformer<object>>)bestRun.Model).LastTransformer;
var ensemble = transformer.Model.TrainedTreeEnsemble;

//Now, how to visualize?

Activity

  1. added
    Priority:3Work that is nice to have
    area-TreesTree-based trainers, including FastTree and LightGBM
    and removed on Sep 8, 2026
  2. matouskozak commented on Oct 23, 2026

    @matouskozak
    Member

    Triage: There is no built-in tree plot, but the FastTree regression model exposes TrainedTreeEnsemble.Trees which could be helpful for this task. We currently do not have capacity to invest into built-in visualization.

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:3Work that is nice to havearea-TreesTree-based trainers, including FastTree and LightGBMquestionFurther information is requestedyellowmaintenance only

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions