0%

Book Description

Create, train, and evaluate various machine learning models such as regression, classification, and clustering using ML.NET, Entity Framework, and ASP.NET Core

Key Features

  • Get well-versed with the ML.NET framework and its components and APIs using practical examples
  • Learn how to build, train, and evaluate popular machine learning algorithms with ML.NET offerings
  • Extend your existing machine learning models by integrating with TensorFlow and other libraries

Book Description

Machine learning (ML) is widely used in many industries such as science, healthcare, and research and its popularity is only growing. In March 2018, Microsoft introduced ML.NET to help .NET enthusiasts in working with ML. With this book, you'll explore how to build ML.NET applications with the various ML models available using C# code.

The book starts by giving you an overview of ML and the types of ML algorithms used, along with covering what ML.NET is and why you need it to build ML apps. You'll then explore the ML.NET framework, its components, and APIs. The book will serve as a practical guide to helping you build smart apps using the ML.NET library. You'll gradually become well versed in how to implement ML algorithms such as regression, classification, and clustering with real-world examples and datasets. Each chapter will cover the practical implementation, showing you how to implement ML within .NET applications. You'll also learn to integrate TensorFlow in ML.NET applications. Later you'll discover how to store the regression model housing price prediction result to the database and display the real-time predicted results from the database on your web application using ASP.NET Core Blazor and SignalR.

By the end of this book, you'll have learned how to confidently perform basic to advanced-level machine learning tasks in ML.NET.

What you will learn

  • Understand the framework, components, and APIs of ML.NET using C#
  • Develop regression models using ML.NET for employee attrition and file classification
  • Evaluate classification models for sentiment prediction of restaurant reviews
  • Work with clustering models for file type classifications
  • Use anomaly detection to find anomalies in both network traffic and login history
  • Work with ASP.NET Core Blazor to create an ML.NET enabled web application
  • Integrate pre-trained TensorFlow and ONNX models in a WPF ML.NET application for image classification and object detection

Who this book is for

If you are a .NET developer who wants to implement machine learning models using ML.NET, then this book is for you. This book will also be beneficial for data scientists and machine learning developers who are looking for effective tools to implement various machine learning algorithms. A basic understanding of C# or .NET is mandatory to grasp the concepts covered in this book effectively.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Hands-On Machine Learning with ML.NET
  3. Dedication
  4. About Packt
    1. Why subscribe?
  5. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Download the color images
    6. Conventions used
    7. Get in touch
    8. Reviews
  7. Section 1: Fundamentals of Machine Learning and ML.NET
  8. Getting Started with Machine Learning and ML.NET
    1. The importance of learning about machine learning today
    2. The model building process
    3. Defining your problem statement
    4. Defining your features
    5. Obtaining a dataset
    6. Feature extraction and pipeline
    7. Model training
    8. Model evaluation
    9. Exploring types of learning
    10. Supervised learning
    11. Unsupervised learning
    12. Exploring various machine learning algorithms
    13. Binary classification
    14. Regression
    15. Anomaly detection
    16. Clustering
    17. Matrix factorization
    18. What is ML.NET?
    19. Technical details of ML.NET
    20. Components of ML.NET
    21. Extensibility of ML.NET
    22. Summary
  9. Setting Up the ML.NET Environment
    1. Setting up your development environment
    2. Installing Visual Studio
    3. Installing .NET Core 3
    4. Creating a process
    5. Creating your first ML.NET application
    6. Creating the project in Visual Studio
    7. Project architecture
    8. Running the code
    9. The RestaurantFeedback class
    10. The RestaurantPrediction class
    11. The Trainer class
    12. The Predictor class
    13. The BaseML class
    14. The Program class
    15. Running the example
    16. Evaluating the model
    17. Summary
  10. Section 2: ML.NET Models
  11. Regression Model
    1. Breaking down regression models
    2. Choosing the type of regression model
    3. Choosing a linear regression trainer
    4. Choosing a logistic regression trainer
    5. Creating the linear regression application
    6. Diving into the trainer
    7. Exploring the project architecture
    8. Diving into the code
    9. The ExtensionMethods class
    10. The EmploymentHistory class
    11. The EmploymentHistoryPrediction class
    12. The Predictor class
    13. The Trainer class
    14. The Program class
    15. Running the application
    16. Creating the logistic regression application
    17. Exploring the project architecture
    18. Diving into the code
    19. The FeatureExtractor class
    20. The FileInput class
    21. The FilePrediction class
    22. The BaseML class
    23. The Predictor class
    24. The Trainer class
    25. The Program class
    26. Running the application
    27. Evaluating a regression model
    28. Loss function
    29. Mean squared error
    30. Mean absolute error
    31. R-squared
    32. Root mean squared error
    33. Summary
  12. Classification Model
    1. Breaking down classification models
    2. Choosing a classification trainer
    3. Creating a binary classification application
    4. Diving into the trainer
    5. Exploring the project architecture
    6. Diving into the code
    7. The CarInventory class
    8. The CarInventoryPrediction class
    9. The Predictor class
    10. The Trainer class
    11. The Program class
    12. Running the application
    13. Creating a multi-class classification application
    14. Diving into the trainer
    15. Exploring the project architecture
    16. Diving into the code
    17. The Email class
    18. The EmailPrediction class
    19. The Predictor class
    20. The Trainer class
    21. Running the application
    22. Evaluating a classification model
    23. Accuracy
    24. Area Under ROC Curve
    25. F1 Score
    26. Area Under Precision-Recall Curve
    27. Micro Accuracy
    28. Macro Accuracy
    29. Log Loss
    30. Log-Loss Reduction
    31. Summary
  13. Clustering Model
    1. Breaking down the k-means algorithm
    2. Use cases for clustering
    3. Diving into the k-means trainer
    4. Creating the clustering application
    5. Exploring the project architecture
    6. Diving into the code
    7. The Constants class
    8. The BaseML class
    9. The FileTypes enumeration
    10. The FileData class
    11. The FileTypePrediction class
    12. The FeatureExtractor class
    13. The Predictor class
    14. The Trainer class
    15. The Program class
    16. Running the application
    17. Evaluating a k-means model
    18. Average distance
    19. The Davies-Bouldin Index
    20. Normalized mutual information
    21. Summary
  14. Anomaly Detection Model
    1. Breaking down anomaly detection
    2. Use cases for anomaly detection
    3. Diving into the randomized PCA trainer
    4. Diving into time series transforms
    5. Creating a time series application
    6. Exploring the project architecture
    7. Diving into the code
    8. The NetworkTrafficHistory class
    9. The NetworkTrafficPrediction class
    10. The Predictor class
    11. The Trainer class
    12. The Program class
    13. Running the application
    14. Creating an anomaly detection application
    15. Exploring the project architecture
    16. Diving into the code
    17. The Constants class
    18. The LoginHistory class
    19. The LoginPrediction class
    20. The Predictor class
    21. The Trainer class
    22. Running the application
    23. Evaluating a randomized PCA model
    24. Area under the ROC curve
    25. Detection rate at false positive count
    26. Summary
  15. Matrix Factorization Model
    1. Breaking down matrix factorizations
    2. Use cases for matrix factorizations
    3. Diving into the matrix factorization trainer
    4. Creating a matrix factorization application
    5. Exploring the project architecture
    6. Diving into the code
    7. The MusicRating class
    8. The MusicPrediction class
    9. The Predictor class
    10. The Trainer class
    11. The Constants class
    12. Running the application
    13. Evaluating a matrix factorization model
    14. Loss function
    15. MSE
    16. MAE
    17. R-squared 
    18. RMSE
    19. Summary
  16. Section 3: Real-World Integrations with ML.NET
  17. Using ML.NET with .NET Core and Forecasting
    1. Breaking down the .NET Core application architecture
    2. .NET Core architecture
    3. .NET Core targets
    4. .NET Core future
    5. Creating the stock price estimator application
    6. Exploring the project architecture
    7. Diving into the code
    8. The ProgramActions enumeration
    9. The CommandLineParser class
    10. The BaseML class
    11. The StockPrediction class
    12. The StockPrices class
    13. The Predictor class
    14. The Trainer class
    15. The ProgramArguments class
    16. The Program class
    17. Running the application
    18. Exploring additional production application enhancements
    19. Logging
    20. Utilizing Reflection further
    21. Utilizing a database
    22. Summary
  18. Using ML.NET with ASP.NET Core
    1. Breaking down ASP.NET Core
    2. Understanding the ASP.NET Core architecture
    3. Controllers
    4. Models
    5. Views
    6. Blazor
    7. Creating the file classification web application
    8. Exploring the project architecture
    9. Diving into the library
    10. The FileClassificationResponseItem class
    11. The FileData class
    12. The FileDataPrediction class
    13. The Converters class
    14. The ExtensionMethods class
    15. The HashingExtensions class
    16. The FileClassificationFeatureExtractor class
    17. The FileClassificationPredictor class
    18. The FileClassificationTrainer class
    19. Diving into the web application
    20. The UploadController class
    21. The Startup class
    22. The Index.razor file
    23. Diving into the trainer application
    24. The ProgramArguments class
    25. The ProgramActions enumeration
    26. The Program class
    27. Running the trainer application
    28. Running the web application
    29. Exploring additional ideas for improvements
    30. Logging
    31. Utilizing a caching layer
    32. Utilizing a database
    33. Summary
  19. Using ML.NET with UWP
    1. Breaking down the UWP architecture
    2. Views
    3. Models
    4. View Models
    5. Creating the web browser classification application
    6. Exploring the project architecture
    7. Diving into the library
    8. The Constants class
    9. The WebPageResponseItem class
    10. The Converters class
    11. The ExtensionMethods class
    12. The WebPageInputItem class
    13. The WebPagePredictionItem class
    14. The WebContentFeatureExtractor class
    15. The WebContentPredictor class
    16. The WebContentTrainer class
    17. Diving into the UWP browser application
    18. The MainPageViewModel class
    19. MainPage.xaml
    20. MainPage.xaml.cs
    21. Diving into the trainer application
    22. The ProgramArguments class
    23. The Program class
    24. Running the trainer application
    25. Running the browser application
    26. Additional ideas for improvements
    27. Single-download optimization
    28. Logging
    29. Utilizing a database
    30. Summary
  20. Section 4: Extending ML.NET
  21. Training and Building Production Models
    1. Investigating feature engineering
    2. PNG image files with embedded executables
    3. Creating a PNG parser
    4. Obtaining training and testing datasets
    5. Creating your model-building pipeline
    6. Discussing attributes to consider in a pipeline platform
    7. Exploring machine learning platforms
    8. Azure Machine Learning
    9. Apache Airflow
    10. Apache Spark
    11. Summary
  22. Using TensorFlow with ML.NET
    1. Breaking down Google's Inception model
    2. Creating the WPF image classification application
    3. Exploring the project architecture
    4. Diving into the WPF image classification application
    5. The MainWindowViewModel class
    6. The MainWindow.xaml class
    7. The MainWindow.xaml.cs file
    8. The BaseML class
    9. The ImageDataInputItem class
    10. The ImageDataPredictionItem class
    11. The ImageClassificationPredictor class
    12. Running the image classification application
    13. Additional ideas for improvements
    14. Self-training based on the end user's input
    15. Logging
    16. Utilizing a database
    17. Summary
  23. Using ONNX with ML.NET
    1. Breaking down ONNX and YOLO
    2. Introducing ONNX
    3. The YOLO ONNX model
    4. Creating the ONNX object detection application
    5. Exploring the project architecture
    6. Diving into the code
    7. The DimensionsBase class
    8. The YoloBoundingBox class
    9. The MainWindow.xaml file
    10. The ImageClassificationPredictor class
    11. The MainWindowViewModel class
    12. Running the application
    13. Exploring additional production application enhancements
    14. Logging
    15. Image scaling
    16. Utilizing the full YOLO model
    17. Summary
  24. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think
3.149.26.176