Machine Learning for .Net Developers Using Visual Studio

Machine Learning for .Net Developers Using Visual Studio

Machine Learning for .Net Developers Using Visual Studio - provides an easy to understand visual interface to build, train, and deploy custom machine learning models inside Visual Studio...

Machine Learning for .Net Developers Using Visual Studio - provides an easy to understand visual interface to build, train, and deploy custom machine learning models inside Visual Studio...

Se how to install an extension to Visual Studio and a Nuget package.

To do machine learning, I have been learning Python and R, and learning a new language sometimes takes time and effort (but of course Python is easy).

But I am very happy with the fact that I can also create machine learning applications using my .Net skills. The only extra effort I have to put forth is installing an extension to Visual Studio and a Nuget package. Let's see how to do this.

What we need:

Visual Studio 2017 15.6 or later

What we will build:

We will be creating a machine learning Hello World! app.

Installing Extension:

Download and install the Extension "ML.NET Model Builder."

Let's Start

Once we are done with the extension, let's create a Console App (.Net Core) named myMLApp.

The above is a simple console solution. Now we make use of the extension. When we right-click the project and click Add, We see an option for machine learning.

So let's add it. After adding, we get the below model builder.

Choose Sentiment Analysis (Binary classification) for Now. On the next step, we are asked to add data. The best thing is that it also has the option to add data from SQL Server.

But we would choose file and upload the file downloaded from here. The data looks like below

SentimentSentimentText

1  ==RUDE== Dude, you are rude upload that carl picture back, or else.

1  == OK! ==  IM GOING TO VANDALIZE WILD ONES WIKI THEN!!!

Select "Sentiment" under Column to Predict (Label). After uploading the file, we also see the preview of data.

Now its time to train our model. So we go to the next tab: "Train." This step is simple; you select the time duration you want to train your model for and the model builder will choose the best possible algorithm based on the accuracy. I think that's the best part of it.

We can see that the best accuracy for the data we uploaded is 82.35 percent. No, we would also like to evaluate. Below, we can see why the particular algorithm was chosen and we could also increase the time and look for more options. But we'll continue with this for now.

Now comes the best part where the model builder generates code for us. So we just move to the next tab, "Code," and click "Add Projects." This has added 2 new projects in my solution, as shown below.

For now, we can run the myMLAppML.ConsoleApp to try the model. In the above screenshot, we also have the sample code to consume the model.

Let's consume the model:

  1. From myMLApp, add reference of "myMLAppML.Model"

  2. Install nuget package Microsoft.ML to myMLApp

  3. In myMLAppML.Model for the file MLModel.zip set the property "Copy to Output" to "Always"

  4. Change the Program.cs Code for myMLApp to the below code

namespace myMLApp
{
class Program
{
static void Main(string[] args)
{
ConsumeModel();
}
public static void ConsumeModel()
{
// Load the model
MLContext mlContext = new MLContext();
ITransformer mlModel = mlContext.Model.Load("MLModel.zip", out var modelInputSchema);
var predEngine = mlContext.Model.CreatePredictionEngine<ModelInput, ModelOutput>(mlModel);
// Use the code below to add input data
var input = new ModelInput();
Console.WriteLine("Type your sentiment :");
input.SentimentText = Console.ReadLine();
// Try model on sample data
ModelOutput result = predEngine.Predict(input);
Console.WriteLine("Result=" + result.Prediction);
Console.ReadKey();
}
}
}

Now we can run our project "myMLApp."

We're done! I tried to make it simple to understand, but you can also look at the below pages to learn more about it. Enjoy machine learning in .Net.

Machine Learning Full Course - Learn Machine Learning

Machine Learning Full Course - Learn Machine Learning

This complete Machine Learning full course video covers all the topics that you need to know to become a master in the field of Machine Learning.

Machine Learning Full Course | Learn Machine Learning | Machine Learning Tutorial

It covers all the basics of Machine Learning (01:46), the different types of Machine Learning (18:32), and the various applications of Machine Learning used in different industries (04:54:48).This video will help you learn different Machine Learning algorithms in Python. Linear Regression, Logistic Regression (23:38), K Means Clustering (01:26:20), Decision Tree (02:15:15), and Support Vector Machines (03:48:31) are some of the important algorithms you will understand with a hands-on demo. Finally, you will see the essential skills required to become a Machine Learning Engineer (04:59:46) and come across a few important Machine Learning interview questions (05:09:03). Now, let's get started with Machine Learning.

Below topics are explained in this Machine Learning course for beginners:

  1. Basics of Machine Learning - 01:46

  2. Why Machine Learning - 09:18

  3. What is Machine Learning - 13:25

  4. Types of Machine Learning - 18:32

  5. Supervised Learning - 18:44

  6. Reinforcement Learning - 21:06

  7. Supervised VS Unsupervised - 22:26

  8. Linear Regression - 23:38

  9. Introduction to Machine Learning - 25:08

  10. Application of Linear Regression - 26:40

  11. Understanding Linear Regression - 27:19

  12. Regression Equation - 28:00

  13. Multiple Linear Regression - 35:57

  14. Logistic Regression - 55:45

  15. What is Logistic Regression - 56:04

  16. What is Linear Regression - 59:35

  17. Comparing Linear & Logistic Regression - 01:05:28

  18. What is K-Means Clustering - 01:26:20

  19. How does K-Means Clustering work - 01:38:00

  20. What is Decision Tree - 02:15:15

  21. How does Decision Tree work - 02:25:15 

  22. Random Forest Tutorial - 02:39:56

  23. Why Random Forest - 02:41:52

  24. What is Random Forest - 02:43:21

  25. How does Decision Tree work- 02:52:02

  26. K-Nearest Neighbors Algorithm Tutorial - 03:22:02

  27. Why KNN - 03:24:11

  28. What is KNN - 03:24:24

  29. How do we choose 'K' - 03:25:38

  30. When do we use KNN - 03:27:37

  31. Applications of Support Vector Machine - 03:48:31

  32. Why Support Vector Machine - 03:48:55

  33. What Support Vector Machine - 03:50:34

  34. Advantages of Support Vector Machine - 03:54:54

  35. What is Naive Bayes - 04:13:06

  36. Where is Naive Bayes used - 04:17:45

  37. Top 10 Application of Machine Learning - 04:54:48

  38. How to become a Machine Learning Engineer - 04:59:46

  39. Machine Learning Interview Questions - 05:09:03

Machine Learning with ML.NET 1.0 from Build 2019

ML.NET is a free, cross-platform and open source machine learning framework designed to bring the power of machine learning (ML) into .NET applications. Live from Build 2019, we are joined by Cesar De La Torre Llorente who gives us a great overview of what the goals of ML.NET are, and shares with us some of the highlights of the 1.0 release.

The Complete Guide to Machine Learning with ML.NET

The Complete Guide to Machine Learning with ML.NET

Welcome to Machine Learning with ML.NET! In this introductory video series we will introduce the concept of Machine Learning, what you can do with various tooling, and how to get started with ML.NET!

The Complete Guide to Machine Learning with ML.NET

1. ML.NET - Machine Learning Introduction
Welcome to Machine Learning with ML.NET! In this introductory video series we will introduce the concept of Machine Learning, what you can do with various tooling, and how to get started with ML.NET!

2. ML.NET Introduction
Learn all about what ML.NET is and what you can do with the Framework. You will also see how customers using it, the open source momentum, and a short demo of the experience.

3.Getting started with ML.NET
Learn how you can get started with ML.NET on Windows, Mac, and Linux using tools (ML.NET Model Builder, ML.NET CLI) or code-first using ML.NET API.

4. Build a ML model for Sentiment Analysis
In this video, we will cover how to build a ML model for sentiment analysis of customer reviews using a binary classification algorithm.

5. Build a ML model for GitHub Issue classification
In the world of ML.NET there is a high-volume of interaction with GitHub. This video will teach you how to classify incoming GitHub issues into one of the many tags (labels) using a multi-class classification algorithm.

6. Build a ML model for predicting taxi fares
There are tons of different ways to use the model builder with ML.NET. In this video, we learn how to predict taxi fares based on distance traveled, trip time etc. using a regression algorithm.

7. Build a ML model for Movie Recommendation
Here are even more ways to use the model builder with ML.NET. In this video, we learn how to recommend movies for users using colloborative filtering based recommendation approach.

8. Deep learning with ML.NET: Image Classification
Deep learning enables many more scenarios using sound, images, text and other data types. Learn how to build an Image Classification model to classify flowers (daisies, roses etc.).