This article outlines the basics of machine learning and the mathematical model, a learning analogy that could help those interested in defining new machine learning algorithms. You’ll also learn a few points on using ML.Net open source package for .Net developers.

**Machine learning for beginners **

For the purpose of Artificial Intelligence, the “Intelligence” is defined as the ability to take right decisions according to some criterion. This ability comes from the knowledge in a form that is operational, that can be used to interpret sensory data and use that information to make decisions.

AI is focused on discovery of decision algorithms yet is still evolving through the study of how the human brain possesses such capability. The challenge is how to make machines acquire such intelligence. Using data and examples to build operational knowledge is what machine learning is about.

**Mathematical Model Example****
**The first step of the challenge to make machines learn is to define the mathematical framework for learning.

Decision learning D can be formulated as a series of learnings { z1, z2, z3…..zn }, each sampled from an unknown process P(Z). The criteria is to minimize the expected value of Loss function L (f, Z) where argument f is a decision function and Z is a sample from an unknown process P(Z).

D = {z1, z2, z3……zn }

Loss function – L(f, Z)

Unknown process P(Z)

In supervised learning each sample is an (input, target) pair: Z = (X, Y) and decision function f (X) takes X input as argument to give decisive output towards reaching Y target.

The most common supervised learning examples are 1. Regression and 2. Classification.

Regression: Y is a real valued scalar or vector, the output of f is the same set of values as Y, and we often take as loss functional the squared error.

L(f, (X,Y)) = [f(X) – Y)] * [f(X) – Y)]

For example, for a sample (X=2, Y=6.3) say f(X=2) gives 6.2 then 6.3 – 6.2 = 0.1 is error value. Less the error value more likely that assumed f is correct decision function.

Classification : Y is a finite integer corresponding to a class index, and we often take as loss function the negative conditional log-likelihood, with the interpretation that decision function f(X) at i estimates process P(Y = X) at i – iteration.

L(f, (X,Y)) = -log f(X) ; where f(X) > 0 and SUM of f(X) at i= 0…n is 1.

So in machine learning we are trying to formulate decision function f, which helps to characterize the unknown process P(Z) . Once this unknown process P(Z) is established it can be followed by machine to make intelligent decisions on any given input Z.

Sometimes f is directly an estimator of P(Z) itself when it is called density estimation. In many other cases f is an attempt to characterize where the density concentrates.

Clustering algorithms divide up the input space in regions. Some clustering algorithms create hard partition (e.g.: the k-means algorithm) while others construct a soft partition (e.g.:. Gaussian mixture model) which assign to each Z a probability of belonging to each cluster.

Principal Component Analysis fall into the category of deep learning algorithms that construct a new representation for Z.

**Learning Analogy**

Note that in the above defined mathematical model it is simplified to understand the initial steps towards learning. Practical algorithms are based on much more complex formulas.

Enough about machine learning mathematical model and let us look back again at human learning. Who doesn’t want to be more intelligent and successful? But some are successful and some are not. Does this mean all are not equally intelligent or not equally having learning capability? Yet these are individual’s perception. I will give some thoughts below.

As I already mentioned, machine learning is evolving through discovery and analysis of human brain capability. Everyone is in on the process of continuous learning whether or not one is willingly or consciously doing so. But this learning can lead to wrong process P(Z) due to wrong samplings. Every day is an experience and an input sample to the human brain to learn something. But sometimes target is not defined properly, which is misinterpreted or arrive at the decision function f(x) with some wrong analysis and interpretation.

Some inner engineering, yoga, meditation, and other psychological techniques are used to manage the experience sampling and understand the target as per one’s inner feelings and desires. Experience sampling route again to habit and practice that I usually stress upon as one of the main ingredients for continuous improvement.

Almost all have equally capable human brains, but the culture, habit and practice is different so that makes individuals land on different learning outputs and decision making capabilities. Some of the factors that give more energy to the human mind are neglected, including relationships, feelings, behavior, inner desires, living at present, etc. Living at present with positive attitude is more essential so that all human senses get the maximum positive samplings out of current experience.

So some key scientists who are interested in the evolution of machine learning, deep learning concepts, are keenly focusing on Yoga, meditation, and some other psychological techniques which are giving some insights into bringing cognitive and intuitive abilities to machine level.

**Machine learning for .Net developers**

ML.NET is a machine learning framework built for .NET developers. It is open source and backed by the .NET Foundation. ML.NET is currently in preview. It is used to develop and integrate custom machine learning models into .NET apps of any type – web, mobile, desktop, gaming, and IOT.

It contains machine learning libraries created by Microsoft Research and used by Microsoft products. Over time, you will also be able to leverage other popular libraries like Accord.NET, CNTK and Tensor Flow through the extensible platform.

ML.NET combines data loading, transformations, and model training into a single pipeline. The transformations defined in your pipeline are applied to both your training data and your input data for making predictions with your trained model.

**1. Load data**

ML.NET can load the following types of data into your pipeline:

- Text (CSV/TSV)
- Parquet
- Binary
- IEnumerable<Τ>
- File sets

**2. Transform Data**

Use the built-in set of transforms to get your data into the format and types that you need for processing. ML.NET offers support for:

- Text transforms
- Changing data schema
- Handling missing data values
- Categorical variable encoding
- Normalization
- Selecting relevant training features
- NGram featurization

**3. Choose Algorithm**

- Choose the learning algorithm that will provide the highest accuracy for your scenario. ML.NET offers the following types of learners:
- Linear (e.g. SymSGD, SDCA)
- Boosted Trees (e.g. FastTree, LightGBM)
- K-Means
- SVM
- Averaged Perceptron

**4. Train Model**

Train your model by calling the Train method. The method will then return a Prediction Model object that uses your input and output types to make predictions.

** 5. Evaluate Model**

ML.NET offers evaluators that will assess the performance of your model on a variety of metrics. You can choose the appropriate evaluator depending on your machine learning task

**6. Deploy Model**

ML.NET allows you to save your trained model as a binary file that you can integrate into any .NET application**Application of ML.Net**

ML.Net provides various AI algorithms implemented that can be applied to solve many business problems. below I’ve listed a few.

- Analyze the sentiment of customer reviews using a binary classification algorithm
- Recommend products based on purchase history using a matrix factorization algorithm
- Predict taxi fares based on distance traveled, etc. using a regression algorithm
- Identify groups of customers with similar profiles using a clustering algorithm
- Detect fraudulent credit card transactions using a binary classification algorithm
- Flag text messages as spam using a binary classification algorithm
- Classify images using a Tensor Flow deep learning algorithm
- Forecast future sales for products using a regression algorithm

**Conclusion**

Understanding basic mathematical model and types of algorithms can help understand the practical scenarios of applying the algorithms. Learning analogy in depth can help in getting direction to those who are deeply innovative and want to define new algorithms or discover new ways of building intelligent machines.

ML.Net introduction will be useful for .Net developers to explore how machine learning algorithms can be used in .Net.

**Reference
**https://dotnet.microsoft.com/learn