Create a visualization method that when given a pipeline displays a visual of the pipeline. This can work both for interactive and standard .NET projects.
API
Define pipeline
var pipeline =
mlContext.Transforms.Concatenate(outputColumnName:"Features", inputColumnNames: new [] {"Col1", "Col2" })
.Append(mlContext.Transforms.ReplaceMissingValues(outputColumnName:"Features",inputColumnName:"Features")
.Append(mlContext.Regression.Trainers.Sdca(labelColumnName:"Label", featureColumnName:"Features");
Interactive
pipeline
.NET project
pipeline.SaveToImage("image.png");
Samples
flowchart TB;
subgraph OutputColumns
OutputSchema[Score]
end
subgraph Pipeline
direction TB
Concatenate--Features-->ReplaceMissingValues
ReplaceMissingValues--Features-->Sdca
click Concatenate "https://docs.microsoft.com/dotnet/api/microsoft.ml.transformextensionscatalog.concatenate?view=ml-dotnet#microsoft-ml-transformextensionscatalog-concatenate(microsoft-ml-transformscatalog-system-string-system-string())"
click ReplaceMissingValues "https://docs.microsoft.com/dotnet/api/microsoft.ml.extensionscatalog.replacemissingvalues?view=ml-dotnet#microsoft-ml-extensionscatalog-replacemissingvalues(microsoft-ml-transformscatalog-microsoft-ml-inputoutputcolumnpair()-microsoft-ml-transforms-missingvaluereplacingestimator-replacementmode-system-boolean)"
click Sdca "https://docs.microsoft.com/dotnet/api/microsoft.ml.trainers.sdcaregressiontrainer?view=ml-dotnet"
end
subgraph InputColumns
InputSchema["Col1, Col2, Label"]
end
InputColumns-->Pipeline
Pipeline-->OutputColumns
Proposed Implementation
flowchart LR;
EstimatorChain --> Mermaid
Mermaid --> Markdig
Markdig --> HTML
HTML --> CustomFormatter
HTML --> Image
Take an ML.NET EstimatorChain and dynamically generate Mermaid diagram.
Process Mermaid diagram as Markdown using Markdig
Convert Mermaid diagram to HTML
Display HTML
If in interactive environment, register a custom formatter.
Create a visualization method that when given a pipeline displays a visual of the pipeline. This can work both for interactive and standard .NET projects.
API
Define pipeline
Interactive
.NET project
Samples
Proposed Implementation
EstimatorChain
and dynamically generate Mermaid diagram.