Leanpub Header

Skip to main content

Machine Learning for C# Developers Made Easy (The Course)

Build smart applications with ML.NET

The instructor has published 100% of this course.Last updated on 2026-10-10

Helping C# and .NET developers to learn how to do machine learning and become highly sought-after (and well-paid) AI engineers. No prior experience of ML required!

Minimum price

$19.00

$29.00

You pay

Author earns

$

Also available for 1 course credit with a Learner Membership

PDF
EPUB
WEB
About

About

About the Course

Create production-quality machine learning models in C# without leaving the .NET ecosystem.

Machine Learning for C# Developers is a practical course that teaches you how to build powerful machine learning (ML) models using your existing C# and .NET skills—no Python required! Through hands-on lessons, you’ll explore the ML.NET framework and build a virtual assistant that can recognize objects, classify software errors, estimate salaries from job descriptions, and more.

In this course, you’ll learn how to:

  • Apply machine learning fundamentals to practical development problems
  • Understand supervised learning, unsupervised learning, and reinforcement learning
  • Build and train machine learning models using C# code
  • Automate model selection and training with automated machine learning (AutoML)

Machine learning helps you forecast trends, model customer behavior, and uncover patterns in your data so you can make more informed decisions. It also enables applications such as personalized product recommendations, image recognition, and text classification.

This course brings those capabilities into the .NET ecosystem. You’ll work through practical examples that connect machine learning concepts to familiar development techniques, using ML.NET and AutoML to simplify the process of building and training models.

Designed for C# developers who want to add machine learning to their applications, Machine Learning for C# Developers helps you turn your existing programming skills into practical ML expertise.

Share this course

Instructor

About the Instructor

Fiodar Sazanavets

Fiodar Sazanavets is a senior software engineer specializing in AI systems, distributed applications, and data-intensive software. A former Microsoft engineer and fourt-time Microsoft MVP, he has more than a decade of professional experience designing and building production systems across a wide range of industries.

His core areas of expertise include Python, .NET, cloud technologies, distributed systems, and modern AI engineering. Throughout his career, he has worked on systems ranging from railway passenger information platforms and distributed IoT clusters to e-commerce applications and financial transaction-processing systems. He has also led engineering teams, mentored developers, and helped organizations translate complex technical requirements into reliable software that solves real business problems.

Alongside his engineering work, Fiodar is passionate about technical education. He writes books, creates online courses, mentors developers, and regularly publishes practical software engineering content. His teaching focuses on the skills developers need to build real-world systems: architecture, reliability, cloud engineering, AI, and production software development.

He writes about software engineering and AI at fiodar.substack.com/.

The Leanpub Podcast

Episode 340

An Interview with Fiodar Sazanavets

Material

Course Material

  • 1. ML.NET: C# developer’s gateway to machine learning

  • 1.1 What is ML.NET?

  • Exercise 1

  • 1.2 Why is machine learning in demand?

  • 1.3 What makes ML.NET powerful?

  • 1.3.1 The main benefits of choosing ML.NET

  • 1.3.2 What makes ML.NET easier to use than alternatives

  • Exercise 2

  • 1.4 Where can ML.NET be used?

  • 1.4.1 Building products and services

  • 1.4.2 Automating internal tasks

  • Exercise 3

  • 1.5 Organizations that use ML.NET

  • 1.5.1 How ML.NET helps Power BI identify key influencers

  • 1.5.2 Other organizations that rely on ML.NET

  • Exercise 4

  • 1.6 How can ML.NET build a useful model?

  • 1.6.1 Selecting a task

  • 1.6.2 Preparing the data

  • 1.6.3 Training and evaluating the model

  • 1.6.4 Using trained models

  • Exercise 5

  • 1.7 Installing ML.NET

  • 1.7.1 Minimal system requirements

  • 1.7.2 Installing ML.NET via the command line

  • 1.7.3 Updating the tool

  • 1.7.4 Installing Model Builder in Visual Studio

  • Exercise 6

  • Summary

  • Exercise 7

  • Quiz 1

    1 attempt allowed

  • 2. Machine learning fundamentals

  • 2.1 Types of machine learning

  • Exercise 8

  • 2.2 Supervised machine learning

  • 2.2.1 Regression

  • 2.2.2 Classification

  • Exercise 9

  • 2.3 Unsupervised machine learning

  • 2.3.1 Clustering

  • 2.3.2 Anomaly detection

  • 2.3.3 Association rule learning

  • Exercise 10

  • 2.4 Reinforcement machine learning

  • 2.4.1 The reinforcement learning process

  • Exercise 11

  • 2.4.2 Exploitation and exploration

  • Exercise 12

  • 2.4.3 Reinforcement learning applications

  • Exercise 13

  • 2.5 Using ML.NET for supervised learning

  • 2.5.1 Training a classification model

  • 2.5.2 Auto-generated ML.NET project

  • Listing 2.1 ML.NET classification project structure

  • 2.5.3 Retraining the classification model

  • Listing 2.2 Method for retraining a pipeline

  • Listing 2.3 Method for building a pipeline

  • 2.5.4 Consuming a trained classification model

  • Listing 2.4 Model input data object

  • Listing 2.5 Model output data object

  • Exercise 14

  • 2.6 Using ML.NET for unsupervised learning

  • Listing 2.6 Input data object

  • Listing 2.7 Output data object

  • Listing 2.8 Preparing model inputs and outputs

  • Listing 2.9 Building the pipeline

  • Listing 2.10 Creating input object for a prediction

  • Exercise 15

  • Summary

  • Exercise 16

  • Quiz 2

    1 attempt allowed

  • 3. Selecting a problem for ML to solve

  • 3.1 Selecting an ML task

  • 3.1.1 Deciding between supervised and unsupervised training

  • 3.1.2 Choosing a supervised learning task

  • 3.1.3 Choosing an unsupervised learning task

  • Exercise 17

  • 3.2 Supervised training tasks available in ML.NET

  • 3.2.1 Binary and multiclass classification

  • 3.2.2 Image classification

  • 3.2.3 Regression

  • 3.2.4 Recommendation

  • 3.2.5 Forecasting

  • 3.2.6 Other supervised learning tasks supported by ML.NET

  • Exercise 18

  • 3.3 Unsupervised training tasks available in ML.NET

  • 3.3.1 The usage of clustering in ML.NET

  • 3.3.2 The usage of anomaly detection in ML.NET

  • Exercise 19

  • 3.4 Evaluating the training results

  • 3.4.1 Quality metrics for supervised learning

  • 3.4.2 Accuracy metrics for unsupervised learning

  • 3.4.3 Accuracy metrics in ML.NET

  • Exercise 20

  • Summary

  • Exercise 21

  • Quiz 3

    1 attempt allowed

  • 4. Training a virtual assistant

  • 4.1 Setting up our project

  • Listing 4.1 CLI interface placeholder

  • Exercise 22

  • 4.2 Classifying inputs

  • 4.2.1 Training the classification model

  • 4.2.2 Reviewing the classification pipeline

  • Listing 4.2 Multiclass classification pipeline

  • 4.2.3 Making our model consumable

  • Class library

  • Listing 4.3 Tech support classification

  • 4.2.4 Interacting with the model

  • Listing 4.4 Application start-up code with classification

  • Exercise 23

  • 4.3 Estimating numeric values

  • 4.3.1 Training the regression model

  • 4.3.2 Reviewing the regression pipeline

  • Listing 4.5 Regression training pipeline

  • 4.3.3 Adding the regression capabilities to the virtual assistant

  • Listing 4.6 Tech support classification

  • Listing 4.7 Application start-up code with a regression task

  • Exercise 24

  • 4.4 Adding recommendation engine

  • 4.4.1 Training the recommendation model

  • 4.4.2 Reviewing the recommendation pipeline

  • Listing 4.8 Recommendation pipeline

  • 4.4.3 Adding the recommendation capabilities to the virtual assistant

  • Listing 4.9 Recommendation logic

  • Listing 4.10 Application startup code with recommendation

  • 4.5 Teaching our assistant to perform forecasting

  • 4.5.1 Training the forecasting model

  • 4.5.2 Reviewing the forecasting pipeline

  • Listing 4.11 Forecasting training pipeline

  • 4.5.3 Enabling forecasting in the virtual assistant app

  • Listing 4.12 Forecasting consumption logic

  • Listing 4.13 Complete application startup logic

  • Summary

  • Exercise 25

  • Quiz 4

    1 attempt allowed

  • 5. Detecting patterns with unsupervised learning

  • 5.1 Detecting patterns in the data

  • Listing 5.1 Input data item

  • Listing 5.2 Output data item

  • Listing 5.3 data transfer object with input data

  • 5.1.1 Adding clustering code

  • Listing 5.4 Cluster data storage

  • 5.1.2 Adding the model consumption code

  • Listing 5.5 Cluster prediction class

  • 5.1.3 Adding the model to the virtual assistant

  • Listing 5.6 Adding the predictor to the virtual assistant

  • Listing 5.7 Application start-up code with clustering

  • 5.1.4 Testing clustering functionality

  • Exercise 26

  • 5.2 Detecting anomalies

  • Listing 5.8 Anomaly detection input data item

  • Listing 5.9 Anomaly detection output

  • 5.2.1 Adding anomaly detection code

  • Listing 5.10 The entry method for anomaly detection

  • 5.2.2 Adding anomaly detector to the virtual assistant

  • Listing 5.11 Anomaly detection consumption logic

  • Listing 5.12 Complete application entry point logic

  • 5.2.3 Testing our anomaly detection logic

  • Exercise 27

  • 5.3 Removing noise in the data

  • Exercise 28

  • 5.4 Project: building our own clustering models

  • 5.4.1 Building a real estate categorization model

  • Listing 5.13 Input data object for clustering model

  • 5.4.2 Building a code smells categorization model

  • Exercise 29

  • Summary

  • Exercise 30

  • Quiz 5

    1 attempt allowed

  • 6. Building an intelligent chatbot

  • 6.1 Introduction to natural language processing

  • 6.2 Applying sentence similarity

  • 6.2.1 Training a sentence similarity model

  • Listing 6.1 Input data for sentence similarity

  • Listing 6.2 Output data for sentence similarity

  • Listing 6.3 Training pipeline for sentence similarity

  • 6.2.2 Consuming the sentence similarity model

  • Listing 6.4 Prediction engine for sentence similarity

  • 6.2.3 Adding sentence similarity checker to the virtual assistant

  • Listing 6.5 Sentence Comparer helper class

  • 6.2.4 Pre-processing sentence similarity data

  • 6.2.5 extracting features from text tokens

  • 6.2.6 Determining the similarity between two sentences

  • Exercise 31

  • 6.3 Applying text classification

  • 6.4 Teaching the chatbot to answer questions

  • Listing 6.6 Chatbot input processor

  • 6.4.1 Hallucinations in AI and where they come from

  • Exercise 32

  • 6.5 Named entity recognition technique

  • 6.5.1 Training a NER model with ML.NET

  • Listing 6.7 NER input class

  • Listing 6.8 NER output class

  • Listing 6.9 NER label class

  • Listing 6.10 seeding label data

  • Listing 6.11 training data processor

  • Listing 6.12 Application entry point

  • 6.5.2 Using the NER model

  • 6.5.3 How NER works

  • 6.5.4 Practical applications of NER

  • 6.5.5 An example of a NER training model

  • Exercise 33

  • 6.6 Project: refining chatbot capabilities

  • 6.6.1 Enhancing the training data

  • 6.6.2 Guarding against hallucinations

  • Listing 6.13 Text classification output class

  • 6.6.3 Incorporating NER in our chatbot

  • Exercise 34

  • Summary

  • Exercise 35

  • Quiz 6

    1 attempt allowed

  • 7. Computer vision and making sense of images

  • 7.1 Training an image classification model

  • 7.1.1 A brief overview of TensorFlow

  • 7.1.2 Training pipeline for image classification

  • Listing 7.1 Image classification pipeline

  • Listing 7.2 Loading image data from folders

  • Listing 7.3 Image classification input object

  • Listing 7.4 Image classification output object

  • 7.1.3 Consuming image classification model

  • Listing 7.5 Console interface for image

  • Exercise 36

  • 7.2 Training an object detection model

  • 7.2.1 Training pipeline for object detection

  • Listing 7.6 Object detection training pipeline

  • Listing 7.7 Object detection training process

  • Listing 7.8 Object detection input model

  • Listing 7.9 Object detection output model

  • 7.2.2 Consuming an object detection model

  • Listing 7.10 Using a trained object detection model

  • Exercise 37

  • 7.3 Integrating with TensorFlow for image classification

  • 7.3.1 Adding TensorFlow integration

  • Listing 7.11 TensorFlow Inception settings

  • Listing 7.12 Input data

  • Listing 7.13 Prediction data structure

  • Exercise 38

  • 7.4 How computer vision works

  • 7.4.1 Image classification: recognizing what’s in an image

  • 7.4.2 Object detection: locating and identifying objects

  • Exercise 39

  • 7.5 Project: building an intelligent shopping system

  • Exercise 40

  • Summary

  • Exercise 41

  • Quiz 7

    1 attempt allowed

  • 8. Adding models to any .NET apps with Model Builder

  • 8.1 Introduction to Model Builder

  • 8.1.1 Adding a model to an existing business workflow

  • Listing 8.1 Refund processor workflow orchestrator function

  • 8.1.2 System bottlenecks

  • 8.1.3 Training the model

  • 8.1.4 Using Model Builder to enhance human-in-the-loop flow

  • Exercise 42

  • 8.2 Choosing a model to train

  • 8.2.1 Computer vision

  • 8.2.2 Natural language processing

  • Exercise 43

  • 8.3 Fine-tuning the model and evaluating its results

  • Exercise 44

  • 8.4 Project: building a complex ML app

  • Summary

  • Quiz 8

    1 attempt allowed

  • 9. AutoML: the engine behind the automated training process

  • 9.1 Getting started with AutoML

  • 9.1.1 Initial setup

  • 9.1.2 Loading the training data

  • 9.1.3 Obtaining the embeddings

  • 9.1.4 Building and configuring the training pipeline

  • 9.1.5 Running AutoML experiments

  • 9.1.6 Evaluating results

  • Exercise 45

  • 9.2 Tasks AutoML supports

  • 9.2.1 A practical AutoML pattern you can reuse

  • Listing 9.1 Reusable AutoML template

  • 9.2.2 Regression with AutoML

  • Listing 9.2 Regression pipeline in AutoML

  • 9.2.3 Binary classification with AutoML

  • Listing 9.3 Binary classification pipleine in AutoML

  • 9.2.4 Multiclass classification with AutoML

  • Listing 9.4 Multiclass classification pipleine in AutoML

  • 9.2.5 Recommendation with AutoML (and the common fallback)

  • Listing 9.5 Recommendation pipleine in AutoML

  • Listing 9.6 Recommendation pipleine in AutoML with Matrix Factorization trainer

  • 9.3 Playing with sweepable estimator and search space

  • 9.3.1 Tuning the sweepable pipeline: include or exclude trainers

  • Listing 9.7 Including and excluding trainers

  • 9.3.2 Tuning the search space: change the range AutoML sweeps

  • Listing 9.8 Configuring the search space

  • 9.3.3 Creating a custom sweepable estimator

  • Listing 9.9 Custom sweepable estimator

  • 9.3.4 Combining default pipelines with custom sweepable estimators

  • Listing 9.10 Default pipeline combined with a sweepable estimator

  • 9.3.5 When tuning is worth the effort

  • Exercise 46

  • 9.4 Project: using AutoML for complex tasks

  • Exercise 47

  • Summary

  • Exercise 48

  • Quiz 9

    1 attempt allowed

  • 10. Moving models across ecosystems

  • 10.1 Start with the truth: ONNX is the bridge

  • 10.1.1 Importing an ONNX model into ML.NET

  • Listing 10.1 Importing ONNX model into the ML.NET pipeline

  • 10.1.2 Exporting an ML.NET model to ONNX

  • Listing 10.2 Exporting an ML.NET model as ONNX

  • Exercise 49

  • 10.2 Working with TensorFlow models in ML.NET

  • Listing 10.3 Importing a TensorFlow model into ML.NET

  • 10.2.1 Exporting an ML.NET model to TensorFlow

  • Exercise 50

  • 10.3 Working with PyTorch models

  • 10.3.1 Exporting an ML.NET model to PyTorch

  • Exercise 51

  • 10.4 How to choose the right direction

  • 10.4.1 The caveats that save you time

  • Exercise 52

  • 10.5 A short guide to diffferent model formats

  • 10.5.1 ONNX

  • 10.5.2 TensorFlow

  • PyTorch

  • Exercise 53

  • Summary

  • Exercise 54

  • Quiz 10

    1 attempt allowed

  • Closing thought

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub