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!"

Visual Studio 2022 Notebook Editor
[Click on image for larger view.] Visual Studio 2022 Notebook Editor (source: Microsoft).

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.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus


  • Creating Reactive Applications in .NET

    In modern applications, data is being retrieved in asynchronous, real-time streams, as traditional pull requests where the clients asks for data from the server are becoming a thing of the past.

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

Subscribe on YouTube