# Types of machine learning algorithms

There are many Types of machine learning algorithms but commonly they can be divided into certain categories according to their roles. The categories are as follows:

- Supervised learning
- Unsupervised learning
- Semi-supervised learning
- Reinforcement learning

**Supervised Learning**

Supervised learning are those algorithms which require a direct supervision from the developer of the algorithm. In other words, the developer control what the algorithm does. The input data is first labeled and then some boundaries are set in which the algorithm has to operate.

**The primary function of this algorithm is to operate on the labeled input data and give prediction of the unavailable data.**

Supervised learning is of two types:

**Classification:**It predicts the category the data belongs to.

Example:-Sentiment Analysis

**Regression:**It predicts the numerical value based on previously observed data.

Example:-Stock Prediction.

There are various algorithms that falls under supervised learning. The algorithms are:

- Logistic Regression
- Decision Trees
- Support Vector Machine(SVM)
- K-Nearest Neighbors
- Naïve Bayes
- Random Forest
- Linear Regression
- Polynomial Regression

**Unsupervised
Learning**

Unsupervised learning are those algorithms which do not require a direct supervision from the developer of the algorithm. In other words, the input data is not labeled in this algorithm. Hence, the algorithm alone discover the labels in the data on it’s own.

Unsupervised learning is of two types:

**Clustering:**

This is an algorithm by which you can identify the groups in the data based on the common factor. For example the size of the product, type of the product.

**Association:**

This is an algorithm by which you can identify the behavioral pattern of the data. For example Customer that buys product X also tends to buy product Y.

The algorithms that falls under this category are:

- K-means
- Apriori Algorithm

Now that we have the basic idea about supervised and unsupervised algorithm let us observe the difference between them with an example to grasp it better.

Let’s start with supervised learning:

- We have an input data and labeled it as apples and cupcakes.
- After labeling the data we will set some identifiers which will act as boundaries upon which our algorithm will function.
- Then we labeling the data set we will create an algorithm which will identify whether the unseen data will be apples or cupcakes.
- When we completing the algorithm we will input the raw and unidentified data into the algorithm.
- If the data matches the information recognized by the algorithm it will give the output as apples or cupcakes.

Now let us see how **unsupervised **algorithm will handle the problem without any labels

- Now suppose you have basket full of fruits and your task is to group them.
- In unsupervised learning you don’t have any prior labels of the data in fact this is the first time you have seen it.
- How are you going to handle the situation?
- You will take out fruits and arrange them according to their physical characteristic. Let’s pick
**shape**as a characteristic. - Then according to the shapes:

**Round
Shape**: Apple, Orange, Guava

**Curved
Shape**: Banana

- Now we have to take another physical characteristic as groups are not as clear as we want them to be.
- We pick color as a characteristic. So according to the color the groups will be:

**Round
shape and Red**: Apple

**Round
shape and Orange: **Orange

**Round
shape and Green**: Guava

**Round
shape and Yellow**: Banana

- You have successfully created similar groups of fruits.

This is how unsupervised learning works without any prior learning about the data.

**Reinforcement Learning**

Reinforcement learning is slightly similar to supervised learning.

In supervised learning the input and output of the algorithm is already decided whereas in reinforcement learning there is no output decided but the reinforcement algorithm itself what to do to perform the given task. It learns from experience.

Reinforcement learning makes decision sequentially. In other words, we can say that the output depends on the state of the current input and the next input depends on the state output of the previous input.

The best example of this type of algorithm is **chess game **where the output is never decided but the input is always the starting phase of the game. In this game the next move is always dependent on the previous move and so on until the output or the goal has been reached.

The above image is of game where a mouse has to choose a best possible way to reach the reward which is cheese. The mouse will learn the best way to do it by trying every possible path by avoiding hurdles.

This is one best examples of reinforcement learning.

In the next blog I’ll further explain all the machine learning algorithm with proper examples.