Introduction to Machine Learning and It’s Types for Beginners

Nimish Khurana
7 min readAug 5, 2018

--

Image source: bigdata.black

What actually is Machine Learning?

This question arises in every mind who has just heard that a thing like this exists.It may sound to you like making the machine learn…Yes you got it right!! 🙌

But How this awesomeness occurs ?

So this is the next question which pops up in your mind ..Right ?

So think of how you learn anything .Human learns anything by either by watching others doing the same thing and then trying it out ,by experimenting himself on the available facts trying to innovate new ideas and by past experiences…Very similar is the case with machines.

Machine learning is the process of recognizing patterns from the past experienced training(supervised) or by itself finding out the possible relationship and trends(unsupervised) in order to make predictions in the future.

Image Source: Python Tips

1. Getting the Relevant Data

Now let’s get a little technical.Past experiences in the case of means only and only data.Yes you heard it correct.Machines learn from the vast available data which can be in any form …text,numbers,images,audios,videos,etc.So the primary need for training machine is getting the appropriate data from various sources.

2. Cleaning the extracted data

Data we get from different sources need to be necessarily in the manner in which we want for training our ML model.Also the whole data is not usually useful for us.So what we need to do is first convert the data into proper format,then decide which features will be useful and extract those features.This is the most crucial step in Data Science and most of the time is spent on cleaning the data (even more than actually training the model).

3. Choosing the right ML Model

There are many established ML models like KNN, Linear Regression,SVM,Decision Trees,Naive Bayes and Neural Networks(Deep Learning).Don’t worry if these terms sounds strange to you.These all are algorithms which learn from data.We will be introducing these in future articles.You can just google out some for now to get an idea.So the main task is finding out which model suits your problem and dataset.Experiment with different models and wisely choose one.What’s more fun..you can even invent your own algorithm.

4. Gaining insights from Predictions

After the Model has given the results i.e. prediction on the new unseen data (test dataset),now it’s the time to figure out what your algorithm predicted i.e. relationships b/w features(predictors) and target variable.

5. Data Visualisation

The last but not the least is visualizing the data and output of our model.Human more easily understands data in graphical form ,it’s a natural tendency.So if you are a data scientist and you predicted some useful result (like relationship of output with any feature),you need to show it in a beautiful and clean manner.For python ,there are libraries like Matplotlib,Seaborn,Bokeh,Dash with the help of which you can visualize any data efficiently.

The three different TYPES of Machine Learning

Let’s take a look at the three types of machine learning: supervised learning, unsupervised learning, and reinforcement learning. We will learn about the fundamental differences between the three different learning types and, using conceptual examples, we will develop an intuition for the practical problem domains where these can be applied:

1. Supervised Learning

In supervised learning, the model learns from the labelled data i.e. the output of training data is also given to the model and model learns from the supervised input(“supervised” means the correct output signals are already known) and give predictions on unseen data.

The process is visualized here :-

Supervised Learning

It is further of two types Classification and Regression:-

Classification

Dotted line categorize the emails into two classes

Classification is a subcategory of supervised learning where the goal is to predict the categorical class labels of new instances based on past observations.The classification can be Binary (having two output classes) or multi-class classification(having more than two classes).

Considering the binary classification example of e-mail spam filtering, we can train a model using a supervised machine learning algorithm on a corpus of labeled e-mail, e-mail that are correctly marked as spam or not-spam, to predict whether a new e-mail belongs to either of the two classes.

Regression

A second type of supervised learning is the prediction of continuous outcomes, which is also called regression analysis. In regression analysis, we are given a number of predictor variables and a continuous response variable (outcome), and we try to find a relationship between those variables that allows us to predict an outcome.

For example, let’s assume that we are interested in predicting the Math scores of our students. If there is a relationship between the time spent studying for the test and the final scores, we could use it as training data to learn a model that uses the study time to predict the test scores of future students who are planning to take this test.

The figure above illustrates the concept of linear regression. Given a predictor variable x and a response variable y, we fit a straight line to this data that minimizes the distance — most commonly the average squared distance — between the sample points and the fitted line. We can now use the intercept and slope learned from this data to predict the outcome variable of new data:

2. Unsupervised Learning

In supervised learning, we know the right answer beforehand when we train our model.However in unsupervised learning,we are dealing with unlabeled data or data of unknown structure. Using unsupervised learning techniques, we are able to explore the structure of our data to extract meaningful information without the guidance of a known outcome variable .In other words, unsupervised learning is discovering hidden structures in the data.

Unsupervised learning can be further categorized into clustering and association problems.

Clustering

Clustering is an data analysis technique that allows us to organize a pile of information into meaningful subgroups (clusters) without having any prior knowledge of their group memberships. Each cluster that may arise during the analysis defines a group of objects that share a certain degree of similarity but are more dissimilar to objects in other clusters, which is why clustering is also sometimes called “unsupervised classification.”

Making subgroups based on similarity in features

Marketers use clustering to discover customer groups based on their interests in order to develop distinct marketing programs.

3. Reinforcement Learning

In reinforcement learning,an agent is there which performs actions and improve its performance based on the present state of environment.Improving performance here means maximizing the total cumulative reward which is a measure of how well the action was taken.So the agent interacts with environment ,takes an action based on current state,calculates the reward to see how well the action taken was and will again take next action based on the present state of environment as well as new knowledge gained from previous action.

The cumulative reward at each step is given by:

A popular example of reinforcement learning is a chess engine. Here, the agent decides upon a series of moves depending on the state of the board (the environment), and the reward can be defined as win or lose at the end of the game:

Mechanism of Reinforcement Learning

But this whole procedure is not as simple as it seems,calculating cumulative reward at each state and learning from it is done commonly by deep neural networks.

Reinforcement learning is also used heavily in AI playing games .It is deep and interesting field of study and is correctly assumed as real AI as it has huge potential .

Its all for this article.In following article (next weekend),we will implement ML models like KNN, Linear Regression from scratch in Python.So don’t miss those .

Please follow and 👏 if you liked to support my initiative as it’s my first blog ever .

LinkedIn: https://www.linkedin.com/in/nimish-khurana-306255148

Github: https://github.com/Nimishkhurana/

--

--

Nimish Khurana
Nimish Khurana

Written by Nimish Khurana

Pursuing CSE @UIET, Panjab University. Competitive Programmer and Developer.

Responses (1)