*In the first part of the article we will talk about Machine Learning tasks (Supervised, Unsupervised and Reinforcement Learning) and such algorithms as Linear Regression, K-Nearest Neighbors (kNN), Convolutional Neural Network (CNN). All algorithms have an example of code which you can try in Jupyter Notebook using a ready environment of FlyElephant Data Science platform.*

Before starting our review of top algorithms, let’s first describe and define supervised, unsupervised and reinforced learning tasks and the difference between them.

## Machine Learning tasks

Today we can distinguish 3 main types of Machine Learning algorithms. Each of them shows the methods through which we can improve computer systems at solving certain problems or tasks that also vary in terms of complexity.

It’s quite important to understand that usually, machine learning is not capable to deal with intelligent tasks.

### Supervised Learning

This type of learning algorithms is the most effective in cases when the relationship and correlation in the data are clear. In other words, supervised learning requires a set of training data that has been already organized and labeled in the correct way. In order to apply supervised learning, you will use input variables (X) and an output variable (Y). Afterward, the algorithm will learn the mapping function from the input to the output.

Supervised learning classified into the following categories of algorithms:

**Classification:**To predict the outcome of a given sample where the output variable is in the form of categories. Examples: credit scoring (according to the borrower's questionnaire, a decision is made on issuing/refusing a loan); medical diagnostics (the diagnosis is determined by a set of medical characteristics).**Regression:**To predict the outcome of a given sample where the output variable is in the form of real values. Examples: real estate (based on characteristics of the area, ecological situation, transport connectivity, estimate the cost of housing), healthcare (according to postoperative indicators, estimate organ healing time), credit scoring (according to borrower's questionnaire, estimate credit limit).**Forecasting:**This is the process of making predictions about the future based on the past and present data. It is most commonly used to analyze trends. A common example might be the estimation of next year sales based on the sales of the current year and previous years.

**The most common examples of supervised learning are** Linear Regression, Logistic Regression, k-NN, SVM, Random forests, and Naive Bayes.

### Unsupervised Learning

This type of learning algorithm is an opposite of the supervised learning because it uses unlabeled training data in order to model the underlying structure of it. Furthermore, unsupervised learning problems have the input variables (X) without other corresponding output variables.

The key advantage of using unsupervised algorithms relate to working with complex data, where relationships are too complex or correlation is unidentified. In such cases, grouping and clustering information methods are applied.

Unsupervised learning classified into the following categories of algorithms:

**Clustering:**A clustering problem is where you want to discover the inherent groupings in the data, such as grouping customers by purchasing behavior. Examples: marketing (based on the results of marketing research, among a multitude of consumers, select characteristic groups according to the degree of interest in the product being promoted).**Association:**An association rule learning problem is where you want to discover rules that describe large portions of your data, such as people that buy X also tend to buy Y.**Dimension reduction:**Reducing the number of variables under consideration. In many applications, the raw data have very high dimensional features and some features are redundant or irrelevant to the task. Reducing the dimensionality helps to find the true, latent relationship.

**The most common examples of unsupervised learning are** k-means clustering, DBSCAN, PCA, LDA, Apriori, and some types of neural networks like Kohonen’s Self-Organizing Maps or Neural Associative memory including Hopfield and other attractor networks.

### Reinforcement Learning

This type of learning is quite similar to the supervised learning algorithms with the difference that it is equipped with self-improvement mechanisms. Reinforcement learning is developed in such a way that its next action is based on its current state. The learning behaviors are pretty much close to the trial and error actions, which eventually can maximize the results. Reinforcement algorithms update training data with new information. This data is chosen on the base of a score or predetermined value that assesses how well the data set is categorized. Afterward, it will be either added to the data set or discarded.

Since Reinforcement Learning requires a lot of data, therefore it is most applicable in domains where simulated data is readily available like gameplay, robotics.

- Reinforcement Learning is quite widely used in building AI for playing computer games. AlphaGo Zero is the first computer program to defeat a world champion in the ancient game of Go.
- In robotics and industrial automation, Reinforcement Learning is used to enable the robot to create an efficient adaptive control system for itself which learns from its own experience and behavior.
- Other applications of Reinforcement Learning include text summarization engines, dialog agents (text, speech) which can learn from user interactions and improve with time, learning optimal treatment policies in healthcare and Reinforcement Learning based agents for online stock trading.

**The most common examples of Reinforcement Learning are** Monte Carlo, Q-Learning, SARSA, DQN, DDPG, TRPO, and PPO.

## Machine Learning Algorithms

Generally speaking, Machine Learning is a much more advanced system which involves several algorithms working together, which generate a theoretical improved result.

We tried to indicate the cons and pros of some popular Machine Learning algorithms along with their specifics in terms of usage and compatibility in different areas.

### Linear Regression

Being one of the most popular algorithms, linear regression is also widely understood in statistics and machine learning. Predictive modeling is related to minimizing the error and making the most accurate predictions possible.

In simple words, linear regression is an equation that describes a line that best fits the relationship between the input variables (x) and the output variables (y), by getting specific weightings for the input variables (B).

**Example**

### Convolutional Neural Network (CNN)

The CNN is made up of multiple convolutional layers which are entirely or partially connected, and this network applies a type of the multilayer perceptrons previously discussed. To transfer results to the next layer, a convolution is used by the convolutional layers. This method of data transfer makes the network more integrated with a minimal parameter.

In the Convolutional Neural Networks for Sentence Classification, Yoon Kim properly defined the procedures and outcomes of the classification of text tasks using CNNs. He put forth a model built based on word2vec, experiments, and runs it against numerous benchmarks, proving that the functioning of the model brilliant.

**Example**

### K-Nearest Neighbors (kNN)

This learning algorithm is frequently called ‘lazy’, as the training data does not require any processing beyond being assigned to a specific class.

kNN is a predictive algorithm, which is based on feature similarity. In other words, it compares al attributes of a dataset to the attributes of a class with an objective to find the likelihood and similarity a new piece of data to that class.

The beauty of this concept is a fine combination of being simple and powerful when it comes to classifying uncorrelated and messy data. Another advantage of kNN is that it does not make any predetermined assumptions. It can be very well a versatile solution for not only classification but also for predictive problems.

Yet, just like any other algorithm, kNN has its cons too. Try to avoid using it when computational requirements are a concern due to high CPU and memory usage.

Also, this algorithm is not the best choice for working with clean linear data with small number of outliers.

**Example**

[TO BE CONTINUED]

### References

[1] Classic Machine learning course by Andrew NG:

https://www.coursera.org/learn/machine-learning/home/welcome

[2] Alpha zero (for reference on git repo please see inside):

https://medium.com/applied-data-science/how-to-build-your-own-alphazero-ai-using-python-and-keras-7f664945c188