CHAPTER 1
Introduction
Creating applications that stand out has become increasingly complex over the past few years, primarily since apps have become more intelligent. From applications that can make recommendations to apps that can make predictions or recognize specific intents, machine learning is now baked into (almost) every significant app out there.
If you are a .NET developer and have wondered how to get into machine learning (ML) and create models without knowing how machine learning works behind the scenes, you've come to the right place. ML.NET is a cross-platform library specifically designed for .NET developers with little to no experience with the theory behind machine learning.
ML.NET began as an internal-only Microsoft library named TMSN just a few months after C# and .NET version 1.0 were released in 2002. The TMSN library proved popular and evolved into an internal TLC system ("The Learning Code"). The TLC library was then used as the basis for a publicly available command line tool named MAML (Microsoft Azure Machine Learning). The MAML library was then used as the basis for the first version of the publicly available ML.NET library.
ML.NET allows .NET developers to reuse existing skills and integrate ML capabilities into .NET applications. These include performing sentiment analysis, creating product recommendations, creating price predictions, performing object detection, detecting fraudulent transactions, segmenting customers into groups, forecasting sales, performing image classification, and running many other forecasting and machine-learning activities.
ML.NET can also be extended to work with popular ML libraries, such as TensorFlow, ONNX, and Infer.NET, delivering high accuracy and outstanding performance.
Beyond that, ML.NET powers various well-known Microsoft products, such as Microsoft Defender, Outlook, Bing, Power Apps, and Power BI, among others.
So, whether you're off to build the next-generation dating app, create a financial market analysis and prediction application, or anything in between, and want to infuse the power of machine learning into your .NET app, using ML.NET is a great way to go.
This book aims to get you started with ML.NET and show you how to integrate this framework into a .NET application. Working with ML.NET does not require any machine learning theoretical know-how or experience; however, it is essential to have some intermediate C# coding knowledge, such as a solid understanding of classes, interfaces, objects, and method-chaining.
Overall, ML.NET empowers .NET developers who do not have previous machine learning experience to add the power of machine learning algorithms to .NET apps with little effort. Given that machine learning is a complex, broad, and ever-expanding subject, I’ll present the topics throughout this book using an easy-to-understand language and describing the fundamental concepts behind this technology with an approachable and friendly vocabulary for .NET developers with no prior ML experience.
The book's overall goal is to make an incredibly complex topic easy for anyone in the .NET community to understand, digest, and quickly get up to speed with. Therefore, this book is not a deep and thorough dive into the complex world of machine learning and the theory behind it. It’s more like a cheat sheet for .NET developers to get a basic-enough understanding of what machine learning is and how to use it within a .NET application.
So, if this sounds like music to your ears, join me on this journey, and let's explore ML.NET together.
This book’s approach
This book will look at ML.NET from a different angle (compared to what you’ll find written anywhere else about ML.NET). I will use some of the great features within Visual Studio, specifically Model Builder, to generate the code we’ll explore throughout this book. Model Builder is a Visual Studio extension that is an easy-to-use wrapper over the AutoML set of APIs that automatically generate ML.NET code.
Instead of breaking our heads trying to learn the classes and methods required to build different types of machine-learning models, the idea is to let the automated features of the framework do the heavy lifting, so we can learn from the generated code.
Overall, we’ll use Model Builder to generate various models, inspect the code generated for each, and compare how they differ. This approach will give us insights into how the code varies (from model to model) depending on the machine-learning algorithms and scenarios employed.
Note: All the code snippets explained throughout this book will exclude unnecessary using statements and first-line comments that are auto-generated. This is to show the code as concisely as possible.
Note: The book’s GitHub repository includes all the Visual Studio projects, code, and datasets used throughout the book. Note that these projects were created using Visual Studio 2022 Enterprise. You can use Visual Studio 2022 Community Edition (free), too.
- 1800+ high-performance UI components.
- Includes popular controls such as Grid, Chart, Scheduler, and more.
- 24x5 unlimited support by developers.