Invoking code on kernels
In this final section of the chapter, we’ll build a magic command that can take an IEnumerable<string> and represent it visually as a Mermaid flowchart, using a sequence of steps. This will work by taking in any IEnumerable<string> in the C# kernel, building a string of Mermaid code, and then sending that Mermaid code to the Mermaid kernel for rendering.
Let’s start by defining a simple sequence of steps:
string[] steps = new[]
{
"Load Data",
"Train / Test Split",
"Training",
"Evaluation",
"Inferencing"
}; These steps are hopefully familiar by this point in the book, as they represent the typical steps of a machine learning model training process. Next, let’s build a C# method to take in a sequence of items and generate Mermaid syntax from them:
string...