# Machine learning Algorithms

With the advancement of technology, Machine learning is gaining popularity day by day, and demand for Machine learning developers/ Engineers/ Data Scientists are also increasing day by day. So if you are a beginner and thinking of diving into the world of Machine learning and Data Science, then this post will definitely gonna help you a lot. ( Please note: This post is beginner friendly, so we will try to make it as simple as possible).

So if you are diving into Machine learning / Data Science, you must need to know, about the algorithms… So via this post, we gonna put some light on these Algorithms … but first thing first …

## What is Machine Learning Algorithm ?

If you search google, about Algorithm, the following search result will come up: In mathematics and computer science, an algorithm is an unambiguous specification of how to solve a class of problems. Algorithms can perform calculation, data processing, automated reasoning, and other tasks. (Source: Wikipedia).
Similarly, in the case of Machine learning, ML Algorithms are set of rules or procedure, by which machine learns and adapt itself to the given data and perform some specific tasks like predicting the outcomes and solving specific cases/unknowns.

## Types of Machine Learning Algorithms

There are primarily 3 different types of Machine Learning algorithms – Supervised algorithms, Unsupervised Algorithms, and Reinforcement Learning algorithms.

1) Supervised Learning: Supervised learning is the process of teaching or training Machine to do some specific tasks. In this process, the set of data (known as DATA SETS) containing all the information(Questions/Answers) are provided to the machine, Machine will now analyze these DATA SETS and based on all the analyzation and observations it will predict the outcomes of the problems ( Problems which are similar to the above DATA SETS).

It will be more clear with this evergreen Fruit basket Example… Suppose, you are given with a bowl of fruits and you have to train the machine to determine the fruit type and name.
So, How will you do …
First, you will feed all the data to machine one by one, so that it can determine which is what …
For eg :

1) If Color is RED, Shape is round and having little depth at the top, then the object is labeled as Apple
2) If Color is Yellow-green, Shape is curvy, then the object is labeled as Banana
3) If the Color is Violet/Black/ Purple, Shape is round and Small, then the object is labeled Black Grapes.

Similarly, you will provide the machine, all the data, Now after that Machine will analyze this and will remember it. The data you above provided will be called as Training Sets. And the above process is called Training.

Now, Once the training is Completed, you will provide Machine a different bowl of fruits or a single fruit, in order to test – What Machine has learned so far.

Suppose you provide a bowl full of banana to the machine. Now the machine’s task is to determine which fruit is this and how it will do? — It will just remember all the data you previously provided during Training and based on that, it will Classify this as Banana.

Thus the machine learns the things from training data(basket containing fruits) and then apply the knowledge to test data(new fruit).

Supervised learning is further classified into two categories of algorithms:
a) Classification
b) Regression

Classification: Machine is trained to classify something into some class.

For eg: classifying whether a patient has a disease or not
classifying whether an email is spam or not

Regression: Machine is trained to predict some value like price, weight or height.

For eg: predicting house/property price
predicting stock market price

The most widely used learning algorithms are:

– Support Vector Machines
– linear regression
– logistic regression
– naive Bayes
– linear discriminant analysis
– decision trees
– k-nearest neighbor algorithm
– Neural Networks (Multilayer perceptron)
– Similarity learning

2) Unsupervised learning: Unsupervised learning as the name suggests, it’s like studying without a teacher, or you can say self-study. In this process, machine is provided with SET of DATA or DATA SETS which are neither labeled nor classified. Machine is allowed to act on the information without any guidance. Here the task of machine is to group unsorted information according to similarities, patterns, and differences without any prior training of data.

Unlike supervised learning, no teacher is provided that means no training will be given to the machine. Therefore machine is restricted to find the hidden structure in unlabeled data by it-self.

For eg: Consider the Fruits basket in the Same Example as above: Here Basket is same, but this time, you haven’t provided any data to the machine, which can help the machine to determine the solution. So in this case, Machine will classify the fruits in the basket by itself. It will classify them either by color or by shape or by size…and then will try to solve the problem.

Unsupervised learning classified into two 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.
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.

Some of the most common algorithms used in unsupervised learning include:

– Clustering
— hierarchical clustering,
— k-means
— mixture models
— DBSCAN
— OPTICS algorithm
– Anomaly detection
— Local Outlier Factor
– Neural Networks
— Autoencoders
— Deep Belief Nets
— Hebbian Learning
— Self-organizing map
– Approaches for learning latent variable models such as
— Expectation–maximization algorithm (EM)
— Method of moments
— Blind signal separation techniques
—– Principal component analysis
—– Independent component analysis
—– Non-negative matrix factorization
—– Singular value decomposition

3) Reinforcement Learning: Reinforcement learning are referred to goal-oriented algorithms, in by which machine learns itself to reach a particular goal. Well, it is different from Supervised learning, in a way that, In Supervised Learning, you are provided with an answer key( with the questions similar to the problem), Machine trained itself with all the correct answers, Whereas in case of Reinforcement Learning, there is no answer key, but the reinforcement agent decides what to do to perform the given task. In the absence of training dataset, it is bound to learn from its experience.

For eg : Consider below image As shown in the image, there is a ROBOT, A Diamond and Hurdles ( Fire). Task of the ROBOT is to reach to the GOAL which is Diamond avoiding any Hurdles(Fire). So in the case of Reinforcement learning, Robot will learn by trying all the possible path and for each correct path to the goal, ROBOT will get a Reward and for each wrong Path, it will Penalty. So final Reward will be calculated, when it reaches to Diamond.

Main points in Reinforcement learning –

– Input: The input should be an initial state from which the model will start
– Output: There are many possible output as there are variety of solution to a particular problem
– Training: The training is based upon the input, The model will return a state and the user will decide to reward
or punish the model based on its output.
– The model keeps continues to learn.
– The best solution is decided based on the maximum reward.

Types of Reinforcement: There are two types of Reinforcement:
Positive –
Positive Reinforcement is defined as when an event, occurs due to a particular behavior, increases the strength and the frequency of the behavior. In other words it has a positive effect on the behavior.

Maximizes Performance
Sustain Change for a long period of time

Too much Reinforcement can lead to overload of states which can diminish the results
Negative –
Negative Reinforcement is defined as strengthening of a behavior because a negative condition is stopped or avoided.