I wanted to get started with Machine Learning, but rather than using Tensorflow, I wanted to take a different approach and use ML.NET. Now you might ask yourself: "Why use .NET if you have something such as Tensorflow in Python?". Well, my preference goes towards languages containing brackets (C#, JS, ...) rather than having pure identations (Python), making me want to try .NET Core for this.
To summarize my setup that I am working on for this article, it looks something like this:
- Ubuntu WSL (use
wslconfig.exe /lto view your distros, use
do-dist-upgradeto upgrade your distro)
Installing .NET Core on Ubuntu WSL
Since I am a fan of the WSL, I prefer to do everything in WSL rather than in windows. Why? It's just easier to use Linux commands most of the time, and seeing that I am coming from a Node world, I am used to it.
Let's get started installing .NET Core. This is quite easy, seeing that we just have to follow the original guide written by the Microsoft team (see references).
# Register Microsoft key & Feedwget -q packages-microsoft-prod.deb https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.debsudo dpkg -i packages-microsoft-prod.deb# Genericsudo apt-get install -y apt-transport-httpssudo apt-get update# Install dotnet core Runtimesudo apt-get install -y dotnet-runtime-2.0.7# Install dotnet core SDKsudo apt-get install -y dotnet-sdk-2.1.200
Testing our installation and creating our first Hello World application
To test our installation, follow the commands below to create our first program
# Create a new console application project# This will create our project file + dependencies to build the console app# It also creates a Program.cs entry filedotnet new console# Download our NuGet packagesdotnet restore# Run the applicationdotnet run
We can also manually build and run our application, which gives us a faster execution time once it's build. To do this, utilize the following steps:
# Build the applicationdotnet build# Navigate to our Output dir defined in bin/Debug/netcoreapp2.0/HelloWorld.dll# Run the applicationdotnet HelloWorld.dll
Whereafter we can now see the following output:
If you followed everything correctly, you should have something like this in your terminal:
Q: When installing, I get an error regarding unmet dependencies.
lsb_release -a and see your ubuntu version. Then check https://docs.microsoft.com/en-us/dotnet/core/linux-prerequisites?tabs=netcore2x for the installation commands for your version.