MODULE 1: DATA MINING, DATA SCIENCE &
MACHINE LEARNING
WHAT IS DATA MINING?
Data Mining is the process of identifying hidden patterns that exists within data. With an
already discovered pattern, the data analyst can apply them to other data sets. Data mining
can involve statistics, database queries, visualization tools, traditional programming, and
machine learning. It is important to remember that data mining is only applicable to
structured data (database). Data Mining is used for many reasons, like database marketing,
credit risk management, fraud detection, spam filtering, and business intelligence.
WHAT IS DATA SCIENCE?
Data Science combines domain expertise, computational algorithm, statistics, and machine
learning to extract knowledge and actionable insights on data that can be structured or
unstructured. Often the terms Data Science and Data Mining are used interchangeably, but
they are different.
WHAT IS MACHINE LEARNING?
Machine Learning can be defined as the process through which computer algorithms
improve in recognizing a problem and finding a solution without any direct interference
but through experience. Machine learning algorithms train themselves to do a particular
task through experiential learning, much like humans.
CONNECTING DATA MINING, DATA SCIENCE, AND MACHINE
LEARNING
Data Science is the study of the science of data. It involves not only the process of
information extraction but also assessing the impact of data. Data Science involves
collecting, cleaning, maintaining, and using data to derive insights and can be considered
the broader field.
Data Mining only involves finding an underlying pattern that can help us get some useful
information that cannot be discovered otherwise from a dataset. Generally, Data Mining
refers to a process only for structured data, i.e., data stored in a database. Data Science is
not limited to finding patterns or analyzing structured data and sometimes uses present
and historical data to predict future events.
Machine learning is a computational technique that is employed in both Data Mining and
Data Science. It is a subset of Artificial Intelligence and is used for classification, clustering,
prediction, and decision-making without explicit instruction but using the Machine's
Ability to Learn.
Figure 1: Relationship diagram for Data Science, Data Mining and Machine Learning 1
1 [Link]
MACHINE LEARNING
"Machine Learning is a part of AI studying how computer can improve their perception,
knowledge, decision, or action based on experience or data. For this, ML draws from computer
science, statistics, psychology, neuroscience, economics, and control theory". – Christopher D.
Manning
Please watch this short video to get a better understanding of how Machine Learning
works:
Video 1: Understanding how Machine Learning works
Types of Machine Learning
There are mainly three main categories of Machine Learning: Supervised, Unsupervised,
and Reinforcement Learning.
Figure 2: Classes of Machine Learning
Before explaining the different types of machine learning paradigms, it is essential to know
the different types of data and how they are related to the kind of machine learning
algorithm used.
Figure 3: Example image
From the above image, any human can easily understand which one is a dog and which one
is a cat, but it is difficult for computers. A machine learning algorithm often needs a few
more details like height, weight, size, breed, etc., to distinguish between a cat and a dog.
The additional information which is provided is called features.
When the output class is mentioned in the dataset, we call it a labeled dataset. For example,
from the above image, we want to know which one is a dog and which one is a cat, then the
image of the dog will be labeled as a dog, and the cat's image will be labeled as a cat. Any
feature we want to predict using machine learning is called outcome (or the label), and the
data that contains such labels is called labeled data. Labels are often human-annotated to
maintain accuracy. It is often impossible to annotate a huge dataset, and we end up with an
unlabelled dataset or a dataset where the output label is missing.
Supervised Learning
Supervised Learning is the type of machine learning algorithm that is used on labeled data.
It is called supervised because it requires human supervision to some extent. A single
instance of a dog image or cat image with features is nothing but data points to the machine
learning algorithm. They take the data points and perform mathematical functions to
determine how humans distinguish between these two animals. This phase is called
Training, and the result of Training is a model that now knows which one is a dog and
which one is a cat and how they are different from each other.
The next phase is known as Testing, and in this phase, we provide a new instance of data or
a new set of data points to our Model. The new data points are unknown to our model, but
it tries to predict whether the new instance is a dog or cat from the prior learning
experience.
In practice, we generally split a labeled dataset into two portions for Training and Test
purposes. For Training, we use 65%-80% of the dataset, while for Test, we use 20%-35% of
the dataset; this is a general convention used to get the best results for supervised learning,
but you can try and explore any ratio you want.
There are two types of supervised learning used for two different kinds of tasks, and they
are discussed below:
Classification: When the machine learning model must predict an instance to one
class between two or more classes, then the process is called Classification. It is like
the example given above about the image of dogs and cats. Another example of
Classification that you can see in your everyday life is your email spam filtering
mechanism. When a new email comes in, your email service provider classifies it as
Spam or non-Spam (ham). The emails which are classified as Spam are sent to the
Spam box in your email while the non-Spam is sent to your Inbox.
Regression: Regression models are used to predict numerical values based on data
points. Sales prediction, stock market prediction, house value prediction, etc., are
done using regression models of supervised learning. Using statistical data from the
data points, a line is created. New data points are plotted on the line to get a
numerical value for prediction purposes.
Unsupervised Learning
Unsupervised machine learning is used for unlabelled data. Suppose you have a dataset of dogs and
cats' images with all the features but without the label of dog and cat, but your objective is to
differentiate between dog images and cat images. You have to use an unsupervised machine
learning algorithm to achieve your goal.
With no labels in the dataset, the machine would not learn how to differentiate between the classes
and their distinct features. So, what would unsupervised learning do? It will try to group similar
data points (instances with common features). For example, suppose we train an unsupervised
machine learning model with unlabelled images of dogs and cats, then the model would not know
which image is of a dog and which image is of a cat. The model will try to distinguish the images
based on their features like size, weight, color, location of origin, etc., without knowing which group
they represent.
There are mainly two types of Unsupervised Machine Learning, and they are:
Clustering: Clustering is the task of dividing the data points into a number of groups such
that the instances in the same group are more similar to each other and dissimilar to the
instances in different groups. In short, Clustering is basically a grouping of data points based
on their feature-based similarity.
Dimensionality Reduction: Using this method, we can reduce the number of features of a
dataset. Hence, it is a very effective pre-processing method that can vastly simplify our
dataset. Let us explore this using the example of the cat and dog images dataset. Suppose
there be five features in the dataset: size, weight, height, personality, and friendliness. Now,
the first three are physical characteristics, while the next two are mental characteristics.
Using Dimensionality Reduction, we can merge similar features in the dataset with little or
no information loss. Therefore, the above example dataset will have two features physical
characteristics and mental characteristics after dimensional reduction.
Reinforcement Learning
Reinforcement Learning is a category of Machine Learning which do not require any
dataset. There are three different elements in reinforcement learning: the agent, the
environment, and action. The agent has some end goals or set of goals which the agent
would try to accomplish. The environment or the physical world in which the agent
operates provides obstacles to the agent when it tries to achieve its goals. The agent takes
actions to avoid the obstacles and achieve its targets. For every action the agent takes, there
is a reward or punishment; in other words, positive reinforcement or negative
reinforcement. Now all this sounds a bit abstract so let us discuss with an example. Most of
you are familiar with the game called PacMan. The objective of the agent (PacMan) is to eat
all the food in the grid while avoiding the ghosts. The agent is rewarded if it eats the food in
the form of points. When the agent takes a wrong pathway, it is punished by getting killed
by the ghosts (losses the game). You will only win the game if the accumulative reward is
more than the punishment. Through reinforcement learning, the agent is trained to explore
new coordinates in the grid world for maximizing the reward while avoiding punishment.
Check out the video below to see how reinforcement learning can optimize PacMan.
Video 2: PacMan with Reinforcement Learning
Machine Learning Algorithms
For each type of Machine Learning we discussed above, there are specific algorithms. The
picture given below will give you a concise understanding of the different algorithms and
their hierarchical order. An in-depth discussion of these algorithms will be discussed in
future lessons.
Figure 4: Machine Learning Algorithms 2
2 [Link]
GETTING STARTED WITH PYTHON
All the coding in this course will be done in Jupyter Notebook. Download Anaconda from
this link: [Link]
Install Anaconda in your computer and open the conda terminal. In the terminal write the
following:
pip install notebook
After the installation is done, type in the following in the terminal:
jupyter notebook
Now you are ready to code!