Train Your Data without Python

Sannidhi Siva
5 min readOct 15, 2020

In this Article we will discuss about creating Data Model/Predict without Python

Photo by Hitesh Choudhary on Unsplash

If you are C# developer there is no need to learn new languages like Python or R for Data Science.

Photo by Kevin Ku on Unsplash

Tools

Jupyter notebook widely used in data science community and it has good support for Python language

If you are new to Jupyter Notebook Please read brief introduction here.

Jupyter Notebook

The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.

In-browser editing for code, with automatic syntax highlighting, indentation, and tab completion/introspection.

The ability to execute code from the browser, with the results of computations attached to the code which generated them.

Good news for C# developers 😊😊-Jupyter Notebook supports C# language

https://devblogs.microsoft.com/dotnet/net-interactive-is-here-net-notebooks-preview-2/

“.NET interactive is a group of CLI tools and APIs that enable users to create interactive experiences across the web, markdown, and notebooks.”

How to Enable C# in Jupyter Notebook

Open the Anaconda Prompt (Windows) or Terminal (macOS) and verify that Jupyter is installed and present on the path:

dotnet tool install -g dotnet-try

Install the .NET kernel by running the following within Anaconda Prompt:

dotnet try jupyter install
[InstallKernelSpec] Installed kernelspec .net-csharp in ~\jupyter\kernels\.net-csharp
.NET kernel installation succeeded

[InstallKernelSpec] Installed kernelspec .net-fsharp in ~\jupyter\kernels\.net-fsharp
.NET kernel installation succeeded

  • You can verify the installation by running the following again in the Anaconda Prompt:

> jupyter kernelspec list
.net-csharp ~\jupyter\kernels\.net-csharp
.net-fsharp ~\jupyter\kernels\.net-fsharp
python3 ~\jupyter\kernels\python3

You can verify installation in Jupyter Lab or Jupyter Notebook

Jupyter Lab
Jupyter Notebook

https://devblogs.microsoft.com/dotnet/net-core-with-juypter-notebooks-is-here-preview-1/

For below steps it is not compulsory to have Jupyter Note Book, you can start creating Data Model in Visual Studio.

I am showing all the steps in Jupyter notebook just give you feel like a real Data Scientist 😊

Photo by Campaign Creators on Unsplash

Create a Jupyter Notebook by Selected Kernel Type as C#/. Net

Step-1

Install Required Packages

Using statements

Let’s Create Data Model With Power of C# / ML. Net

Data Schema
Load Data
Use Matrix Factorization for Creating Recommendation Model
Train Model
Deploy and Use Model

ML. Net has good support for algorithms and can be selected based on use case

In Data Science world Data Visualization place major role. If you have any experience Python Plotly major used library to draw plots and view relationships between column data.

Using Data Frame/Plotly Graphs

PrimitiveDataFrameColumn<DateTime> dateTimes = new PrimitiveDataFrameColumn<DateTime>("DateTimes"); // Default length is 0.
PrimitiveDataFrameColumn<int> ints = new PrimitiveDataFrameColumn<int>("Ints", 3); // Makes a column of length 3. Filled with nulls initially
StringDataFrameColumn strings = new StringDataFrameColumn("Strings", 3); // Makes a column of length 3. Filled with nulls initial

Data Frame
Plot Visual Diagrams

C# has also support like Numpy ,tensor flow

Install-Package NumSharp
Install-Package Tensorflow
using System;
using NumSharp;
using Tensorflow;
Create Model with Model Builder

Visual Studio provides Extension to create Data Model Code from provided Data

We can use this tool to generate code and use for further analysis & training

https://dotnet.microsoft.com/static/images/ml-dotnet-model-builder.gif?v=CnFZt3lEkh14XZcgnztGfz6K1easGEfx7l8HE8H7x_Y

Build ML models in the Azure ML studio

If you don’t know how to create a model and just want to consume a Model by creating from your Data Set, Azure has Azure ML Services for you.

https://docs.microsoft.com/en-us/azure/machine-learning/media/concept-designer/designer-drag-and-drop.gif

Above diagram in simple words can be described as below

Azure ML Editor will provide us flexibility of selecting well used algorithms for training and can be used Model as Web Service for Predicting

Data Model as Web Service

And After all this reading still If I did not convince you to create a model that is fine. I can provide you more options to enable prediction power to your applications

Please refer this article to know more.

https://medium.com/@sannidhisiva/azure-engineer-to-azure-ai-engineer-7d6a1c673b04

Help links

https://jupyter.org/index.html

https://dotnet.microsoft.com/learn/ml-dotnet

https://medium.com/@sannidhisiva/azure-engineer-to-azure-ai-engineer-7d6a1c673b04

https://www.kaggle.com/

https://machinelearningforkids.co.uk/

https://docs.microsoft.com/en-us/azure/machine-learning/tutorial-designer-automobile-price-deploy

--

--