ML.NET Model Builder Update Adds Notebooks in Visual Studio
Interactive notebooks, so vital to AI, data science and machine learning development projects, are coming to Microsoft's flagship Visual Studio IDE via an experimental extension.
Notebooks were popularized in the Jupyter scheme to support interactive data science and scientific computing across all programming languages, Wikipedia says, but are typically associated with Python. Native .NET Interactive Notebooks have emerged, however, and have proved popular in Visual Studio Code extensions for Python and .NET Interactive.
"They are great for data exploration and preparation, experimentation, model explainability, and even education," said Bri Achtman, program manager, .NET, in an Oct. blog post announcing updates to ML.NET, Microsoft's machine learning framework for .NET. "After talking to customers, the team decided to experiment with Interactive Notebooks in Visual Studio which has resulted in the new Notebook Editor extension!"
That brand-new extension is currently in the experimental preview stage, only working with the latest bits, Visual Studio 2022 Preview 4, which shipped last month.
Achtman discussed the notebook extension in the context of ML.NET's Model Builder, a UI tooling extension that leverages Automated Machine Learning (AutoML) to train and consume custom ML.NET models in .NET apps. It serves as one of two points of entry to use the new Notebook Editor tool, along with using the Add New Item dialog.
When generated from Model Builder, a notebook includes:
- The training pipeline for the model chosen by Model Builder so that developers can see how a model was trained, and easily re-train it
- Plots and graphs for data exploration and model explainability techniques so that devs can more easily understand and explain their data and model
When generated from the menu, a new notebook is empty.
Another Model Builder update affects the Consumption file that gets generated during model training, containing a Predict() method which developers can use to make predictions with a model in an end-user application, effectively abstracting away several steps needed to consume an ML.NET model:
- Initializing an MLContext
- Loading the model
- Creating a PredictionEngine
- Using the PredictionEngine and the model to make the prediction on the input data
"In the previously generated model consumption code, these steps all happened inside the Predict() method, meaning that these all happened every time the Predict() method was called," Achtman said. "This resulted in decreased performance on each prediction. So, we updated the code to make it a lot more efficient where all of these steps only happen once when using the Predict() method."
Achtman also provided an update on the dev team's efforts to address ML.NET "pain points" that were identified in a survey where users were asked about the biggest blockers/pain points/challenges reported by respondents when using ML.NET, as Visual Studio Magazine reported in June.
David Ramel is an editor and writer for Converge360.