ML.NET Part 2 – Machine Learning

Last week, i did the first post on ML.NET covering the basics and its various steps required to get a model up and use it – I will cover how to go about preparing, coding and using them in the later posts.

Two of the key steps involved are
1. Loading the data
2. Transforming the data
3. Training and Generating the model
4. Using the trained model

In this tutorial, we will focus on getting the environment in your computer correct so that we can prepare and start doing ML.NET. Kindly note that this tutorial is written for Windows Environment. As of time of writing, i am on Windows 10 with Visual Studio 2017 Enterprise.

Installing MLNET

I attempted to start by calling the command (You can start by going to Command Prompt and type straight away)

mlnet

but i was thrown with the error –

'mlnet' is not recognized as an internal or external command, operable program or batch file. 
'mlnet' is not recognized as an internal or external command, operable program or batch file.
‘mlnet’ is not recognized as an internal or external command, operable program or batch file.

I recognized that i do not have mlnet installed. I then run

dotnet tool install -g mlnet

and what? –

No executable found matching command "dotnet-tool"

Based on some search, concluded it is due to the fact that dotnet tool is only available in .NET CORE 2.1.3 onwards and I am running – 2.1.2

dotnet version
dotnet version

Went on to https://dotnet.microsoft.com/download/dotnet-core/2.2 and downloaded dotnet core 2.2 (as of time of writing .net 3 is in preview and hence I did not use yet). Do note that the release was not compatible with VS 2017 and if you are using VS 17, there is another version for you to download.

After installing, restart your computer and let it install again by running the command.

dotnet tool install -g mlnet

Note that you have to wait. Nothing will happen for some time and it will just magically works after that!

mlnet installed!
mlnet installed!

Posts-
ML.NET Introduction – Introduction
ML.NET Part 2 – Machine Learning – Environment setup

ML.NET Introduction

Recently, a friend of mine, Maxx and myself decided to embark on a quest to start learning ML.NET. It came to our attention that ML.NET is released on Preview in 2 April 2019 and subsequently on 3 May 2019 on Stable Release.

Being in a language that I am comfortable with, i decided to give it a try and see what capabilities are available and how we are able to build something.

Every the course of next few weeks, we are going to try

  1. Coding it ourselves
  2. Using Model Builder Tool
  3. Using AutoML to perform model training and picking the best algorithm.

More information can be found on their site on
https://dotnet.microsoft.com/apps/machinelearning-ai/ml-dotnet

We are also going to follow the ML.NET tutorials released –
https://docs.microsoft.com/en-gb/dotnet/machine-learning/tutorials/ then attempt to run the sample –
https://github.com/dotnet/machinelearning-samples/blob/master/README.md

We have ran through the Microsoft Docs detailing ML.NET and will be extracting the important points out in the next various posts i made.

ML.NET will give developers the power to add in machine learning capabilities to .NET applications. With this ability, developers are now able to make predictions using the data presented.

The general steps required
1. Load the data
2. Prepare the data
3. Train and test the model
4. Get predictions / Using the model

ML.NET presents various functions and methods to do them and in the course of next few weeks and posts, we will present them in our blogs.

As of date of posting, ML.NET has the following Tasks.

  1. Binary Classification
  2. Multiclass Classification
  3. Regression
  4. Clustering
  5. Anomaly Detection
  6. Ranking
  7. Recommendation

Posts-
ML.NET Introduction – Introduction
ML.NET Part 2 – Machine Learning – Environment setup

Azure Site Under Construction

Despite my deployment has been a success and active, when i navigate to the online link, it presents me with a blank page with a “Site Under Construction” error in the title.

Azure - Site Under Construction

Azure – Site Under Construction

It was due to the deployment process may have some malfunctioned and app_offline.htm is still there.

app_offline.htm present

app_offline.htm present

The solution is simple, go into App Service > Console and type in the command

rm app_offline.htm

Azure App Service Deployment Center git failure

My configuration was BitBucket and linked to Azure App Service via the Deployment Center and it auto pulls from my Master branch.

One fine day, the deployment failed and threw me this error.

I am not sure what caused the locked but here’s the solution but upon inspection of the logs, i received this.

Fatal: Unable to create ‘D:/home/site/repository/.git/index.lock’: File exists.Another git process seems to be running in this repository, e.g. an editor opened by ‘git commit’. Please make sure all processes are terminated then try again. If it still fails, a git processmay have crashed in this repository earlier: remove the file manually to continue. D:\Program Files\Git\cmd\git.exe checkout master –force

Go into your App Service > Console > Navigate to the folder and use rm command to remove it.

cd D:\home\site\repository\.git
rm index.lock

Thereafter, go back to your deployment center and click on Sync and it will work magically.

Joseph Johnathan Zhao


Joseph Johnathan with Mr. Tan Chuan-Jin, 10th Speaker of the Parliament of Singapore

Halogen Foundation Singapore – National Young Leader Award 2017 Finalist

Joseph Johnathan Zhao