Day 3 - Content
Day 3 - Content
Continuation
Contents
2
Unsupervised Learning
What is Unsupervised Learning?
Unsupervised learning is a machine learning technique, where we do not need to
supervise the model,Instead of that we need to encourage the model to work on
its own to discover knowledge. It mainly deals with the unlabelled data.
3
Unsupervised Learning
● Dataset contains no labels:
x1,...xn
● Goal: to find interesting structures in the data
4
Unsupervised Learning Algorithms
● Unsupervised Learning Algorithms allow users to
perform more complex processing tasks compared to
supervised learning.
● Although, unsupervised learning can be more
unpredictable compared with other natural learning
methods.
● Unsupervised learning algorithms include clustering,
anomaly detection, neural networks, etc.
5
Example of Unsupervised Learning
● Let’s, take an example of Unsupervised Learning for a baby and her family dog.
● She knows and identifies this dog. Few weeks later a family friend brings
along a dog and tries to play with the baby.
● Baby has not seen this dog earlier. But it recognizes many features (2
ears, eyes, walking on 4 legs) are like her pet dog. She identifies the new
animal as a dog. This is unsupervised learning, where you are not taught
but you learn from the data (in this case data about a dog.)
6
Why is it important?
7
Need for Unsupervised Learning
8
Types of Unsupervised Learning:
Clustering Association
9
Clustering in Machine Learning
10
Clustering in Machine Learning
11
Types of Clustering Methods
12
Types of Clustering Methods
Partitioning Clustering
13
Types of Clustering Methods
Density-Based Clustering
14
Types of Clustering Methods
15
Types of Clustering Methods
Hierarchical Clustering
16
Types of Clustering Methods
Fuzzy Clustering
Fuzzy clustering is a type of soft method in which a data object may belong to
more than one group or cluster. Each dataset has a set of membership
coefficients, which depend on the degree of membership to be in a cluster.
Fuzzy C-means algorithm is the example of this type of clustering; it is
sometimes also known as the Fuzzy k-means algorithm.
17
Clustering Algorithms
19
Clustering Algorithms
K-Means Algorithm
● It will groups the unlabeled dataset into different clusters.
● Here K defines the number of predefined clusters that need to be created in
the process, as if K=2, there will be two clusters, and for K=3, there will be
three clusters, and so on.
● It allows us to cluster the data into different groups and a convenient way
to discover the categories of groups in the unlabeled dataset on its own
without the need for any training.
● It is a centroid-based algorithm, where each cluster is associated with a
centroid. The main aim of this algorithm is to minimize the sum of distances
between the data point and their corresponding clusters.
● The algorithm takes the unlabeled dataset as input, divides the dataset into
k-number of clusters, and repeats the process until it does not find the best
clusters. The value of k should be predetermined in this algorithm.
20
Clustering Algorithms
K-Means Algorithm
21
Clustering Algorithms
The working of the K-Means algorithm is explained in the below
steps:
● Step-1: Select the number K to decide the number of clusters.
● Step-2: Select random K points or centroids. (It can be other from the input
dataset).
● Step-3: Assign each data point to their closest centroid, which will form the
predefined K clusters.
● Step-4: Calculate the variance and place a new centroid of each cluster.
● Step-5: Repeat the third steps, which means reassign each datapoint to the
new closest centroid of each cluster.
● Step-6: If any reassignment occurs, then go to step-4 else go to FINISH.
● Step-7: The model is ready.
22
Clustering Algorithms
K-Means Algorithm
23
Clustering Algorithms
24
Clustering Algorithms
25
Applications of Clustering Algorithms
● In Search Engines
● Customer Segmentation
● In Biology
● In Land Use
26
Association Rule Learning
27
Association Rule Learning Algorithms
● Apriori Algorithm
○ This algorithm uses frequent datasets to generate association rules. It is
designed to work on the databases that contain transactions. This
algorithm uses a breadth-first search and Hash Tree to calculate the
itemset efficiently.
○ It is mainly used for market basket analysis and helps to understand the
products that can be bought together. It can also be used in the
healthcare field to find drug reactions for patients.
● Eclat Algorithm
○ Eclat algorithm stands for Equivalence Class Transformation. This
algorithm uses a depth-first search technique to find frequent itemsets in
a transaction database. It performs faster execution than Apriori
Algorithm.
● F-P Growth Algorithm
○ The F-P growth algorithm stands for Frequent Pattern, and it is the
improved version of the Apriori Algorithm. It represents the database in
the form of a tree structure that is known as a frequent pattern or tree.
The purpose of this frequent tree is to extract the most frequent 28
patterns.
Association Rule Learning Algorithms
Apriori Algorithm
The Apriori algorithm uses frequent itemsets to generate association rules, and it
is designed to work on the databases that contain transactions. With the help of
these association rule, it determines how strongly or how weakly two objects are
connected. This algorithm uses a breadth-first search and Hash Tree to calculate
the itemset associations efficiently. It is the iterative process for finding the
frequent itemsets from the large dataset.
29
Association Rule Learning Algorithms
FP-Growth Algorithm
It is an alternative way to find frequent item sets without using candidate
generations, thus improving performance. For so much, it uses a divide-and-
conquer strategy. The core of this method is the usage of a special data structure
named frequent-pattern tree (FP-tree), which retains the item set association
information.
30
Applications of Association Rule Learning
● Medical Diagnosis
● Protein Sequence
● It is also used for the Catalog Design and Loss-leader Analysis and many more
other applications.
31
Disadvantages of Unsupervised Learning
32
Reinforcement Algorithms
33
Terminologies used in Reinforcement Learning
34
Terminologies used in Reinforcement Learning
● Agent — the learner and the decision maker.
● Environment — where the agent learns and decides what actions to
perform.
● Action — a set of actions which the agent can perform.
● State — the state of the agent in the environment.
● Reward — for each action selected by the agent the environment provides a
reward. Usually a scalar value.
● Policy — the decision-making function (control strategy) of the agent, which
represents a mapping from situations to actions.
● Value function — mapping from states to real numbers, where the value of
a state represents the long-term reward achieved starting from that state,
and executing a particular policy.
● Function approximator — refers to the problem of inducing a function from
training examples. Standard approximators include decision trees, neural
networks, and nearest-neighbor methods
35
Terminologies used in Reinforcement Learning
● Markov decision process (MDP) — A probabilistic model of a sequential
decision problem, where states can be perceived exactly, and the current
state and action selected determine a probability distribution on future
states. Essentially, the outcome of applying an action to a state depends only
on the current action and state (and not on preceding actions or states).
● Dynamic programming (DP) — is a class of solution methods for solving
sequential decision problems with a compositional cost structure. Richard
Bellman was one of the principal founders of this approach.
● Monte Carlo methods — A class of methods for learning of value functions,
which estimates the value of a state by running many trials starting at that
state, then averages the total rewards received on those trials.
● Temporal Difference (TD) algorithms — A class of learning methods, based
on the idea of comparing temporally successive predictions. Possibly the
single most fundamental idea in all of reinforcement learning.
● Model — The agent’s view of the environment, which maps state-action
pairs to probability distributions over states. Note that not every
reinforcement learning agent uses a model of its environment.
36
Reinforcement Learning Workflow
37
Need for Reinforcement Learning
38
Characteristics of Reinforcement Learning
● No supervision, only a real value or reward signal
● Decision making is sequential
● Time plays a major role in reinforcement problems
● Feedback isn’t prompt but delayed
● The following data it receives is determined by the agent’s actions
39
Reinforcement Learning Algorithms
40
Reinforcement Learning Algorithm
41
Types of Reinforcement Learning
42
Types of Reinforcement Learning
Positive Reinforcement Negative Reinforcement
Positive reinforcement is defined as Negative Reinforcement is
when an event, occurs due to specific represented as the strengthening of a
behavior, increases the strength and behavior. In other ways, when a
frequency of the behavior. It has a negative condition is barred or
positive impact on behavior. avoided, it tries to stop this action in
the future.
Advantages
– Maximizes the performance of an Advantages
action – Maximized behavior
– Sustain change for a longer period – Provide a decent to minimum
standard of performance
Disadvantage
– Excess reinforcement can lead to an Disadvantage
overload of states which would – It just limits itself enough to meet up
minimize the results. a minimum behavior
43
Applications of Reinforcement Learning
● Gaming
Reinforcement learning has been applied to various games,
from classic board games like chess and Go to modern video
games like Dota 2 and StarCraft II. In these games, an agent
learns to make decisions and compete against human players
or other agents.
● Robotics
Reinforcement learning has been used in robotics to enable
robots to learn to navigate environments, manipulate objects,
and perform complex tasks. In these applications, an agent
learns from feedback received through sensors and actuators.
44
Applications of Reinforcement Learning
● Finance
Reinforcement learning has found applications in finance,
including algorithmic trading, portfolio optimization, and fraud
detection. In these applications, an agent learns to make
decisions based on market data and financial indicators.
● Healthcare
Reinforcement learning has been used in healthcare to
optimize treatment plans and drug dosages. In these
applications, an agent learns from patient data and medical
records to make decisions that maximize patient outcomes.
45
Practical Applications of reinforcement learning
● Robotics for Industrial Automation
● Text summarization engines, dialogue agents (text, speech),
gameplays
● Autonomous Self Driving Cars
● Machine Learning and Data Processing
● Training system which would issue custom instructions and
materials with respect to the requirements of students
● AI Toolkits, Manufacturing, Automotive, Healthcare, and Bots
● Aircraft Control and Robot Motion Control
● Building artificial intelligence for computer games
46
QUIZ Time:
https://forms.gle/mX8DJMBzMmcB9d4L8
47
Demonstration.
https://colab.research.google.com/drive/17l6NxZN-lz-
oc2A598iqYU1mn7aUbws6?usp=sharing
48
References
I. https://www.guru99.com/unsupervised-machine-learning.html
II. https://societyofai.medium.com/unsupervised-learning-a9f7264a0f2d
III. https://www.analyticsvidhya.com/blog/2021/02/introduction-to-
reinforcement-learning-for-beginners/
IV. https://theintactone.com/2019/08/26/ob-u3-topic-7-reinforcement-theory/
V. https://www.youtube.com/watch?v=2NEu9dbM4A8&t=800s
VI. https://smartlabai.medium.com/reinforcement-learning-algorithms-an-
intuitive-overview-904e2dff5bbc
VII.https://arjun-sarkar786.medium.com/reinforcement-learning-for-beginners-
introduction-concepts-algorithms-and-applications-3f805cbd7f92
VIII.https://www.javatpoint.com/clustering-in-machine-learning
IX. https://www.geeksforgeeks.org/frequent-pattern-growth-algorithm/
49
THANKS