dotnet / dotnet/machinelearning

Visualization of FastTree Results from RegressionExperiment (Descicion Tree Visualization)

Open
#5,761 0 comments 0 reactions 0 assignees View on GitHub
area-Trees Priority:3 question
Dominant language
C#
Stars
9.4k
Forks
2k
Avg merge
2d 20h
Merged PRs (30d)
11

Description

### 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`.

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` via some ugly casting (`((PredictionTransformerBase)((TransformerChain>)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:
```csharp
RegressionExperiment experiment = context.Auto().CreateRegressionExperiment(60 * 10);
var trainTestData = CreateTrainTestData(); //Create some testdata with TrainTestSplit

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

//We assume we will always get a FastDescicionTree for the example
var transformer = ((PredictionTransformerBase)((TransformerChain>)bestRun.Model).LastTransformer;
var ensemble = transformer.Model.TrainedTreeEnsemble;

//Now, how to visualize?
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.