Machine Learning in C# (.NET): From Basics to Production
Machine Learning in C# (.NET): From Basics to Production
Summary:
The book "Machine Learning in C# (.NET)" is a practical guide for .NET developers who want to integrate artificial intelligence into their applications without switching to Python. The author, Alexey Ignatiev, consistently guides the reader from the basics of statistics and linear algebra to creating full-fledged training and inference pipelines on the .NET platform.
What this book is about
- ML.NET: installation, configuration, working with AutoML and custom trainers.
- Machine learning tasks: regression, binary and multiclass classification, clustering (K-Means), anomaly detection.
- Working with data: loading from CSV, SQL, NoSQL; cleaning, normalization, one-hot encoding, feature engineering.
- Neural networks: implementation of multilayer perceptron, convolutional networks (CNN) for images, and recurrent networks (LSTM) for time series based on TensorFlow.NET and SciSharp.
- ONNX: export/import of models, integration of ready-made neural networks from PyTorch or TensorFlow into C#.
- Deployment: publishing a model as a microservice (ASP.NET Core Web API), using it in desktop (WPF/WinForms) and mobile (Xamarin/MAUI) applications.
- Performance: multithreading, GPU acceleration (CUDA), benchmarking, and A/B testing of models.
Who this book is for
The book is intended for C# developers with any level of ML experience:
- Beginners — will find step-by-step instructions and ready-made examples from scratch.
- Experienced — will learn how to optimize pipelines, work with big data, and embed ML into existing architecture.
- Data Scientists transitioning to .NET — will understand how to adapt familiar techniques to the Microsoft ecosystem.
What you will learn
- How to build a housing price prediction model in 30 minutes.
- How to train a classifier for text sentiment analysis.
- How to deploy a model in a Docker container on Azure/AWS.
- How to use pre-trained neural networks for object recognition in photos.
- How to avoid common mistakes: overfitting, class imbalance, data leakage.
All code examples are available in the GitHub repository and have been tested on .NET 8/9. The book contains over 50 practical tasks and 3 end-to-end projects: from data analysis to a ready-made web application.
Important: the book does not require prior knowledge of Python or mathematics beyond the school level — necessary formulas are explained at an intuitive level with visualizations.