Merged Presentation Choladeck
Merged Presentation Choladeck
1
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
CLASSIFICATION
Classification teaches a machine to sort things
into categories. It learns by looking at examples
with labels (like emails marked “spam” or “not
spam”). After learning, it can decide which
category new items belong to, like identifying if a
new email is spam or not. For example a
classification model might be trained on dataset of
images labeled as either dogs or cats and it can be
used to predict the class of new and unseen images as
dogs or cats based on their features such as color,
texture and shape.
2
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
3
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
4
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
5
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
6
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
7
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
8
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
9
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
10
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
11
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
12
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
classes. They can capture more complex relationships between input features and target
Random Forests, AdaBoost,Bagging Classifier, Voting Classifier, Extra Trees Classifier, Multi-
13
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
A decision tree is a supervised learning algorithm used for both classification and regression tasks. It
models decisions as a tree-like structure where internal nodes represent attribute tests, branches
represent attribute values, and leaf nodes represent final decisions or predictions. Decision trees are
versatile, interpretable, and widely used in machine learning for predictive modeling.
Is it raining?
If yes, you might decide to buy an umbrella. If no, you move to the next question.
14
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
15
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
16
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
Example: Predicting Whether a Person Likes Computer Games Using Two Decision Trees
Tree 1: Age and Gender
The first tree asks two questions:
“Is the person’s age less than 15?”
If Yes, they get a score of +2.
If No, proceed to the next question.
“Is the person male?”
If Yes, they get a score of +0.1.
If No, they get a score of -1.
Tree 2: Computer Usage
The second tree focuses on daily computer usage:
“Does the person use a computer daily?”
If Yes, they get a score of +0.9.
If No, they get a score of -0.9.
Combining Trees: Final Prediction
The final prediction score is the sum of scores from both trees
17
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
18
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
19
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
20
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
21
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
22
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
23
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
24
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
25
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
26
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
27
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
28
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
29
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
• Social Media
• Healthcare
• Personal Assistants
30
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
REGRESSION
• Dependent Variable (Target): The variable we are trying to predict e.g house
price.
value such as “salary” or “weight”. Many different regression models can be used
LINEAR REGRESSION
algorithm that learns from the labelled datasets and maps the data points
with most optimized linear functions which can be used for prediction on
new datasets.
data. 32
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
• It predicts the continuous output variables based on the independent input variable.
• For example if we want to predict house price we consider various factor such as house
age, distance from the main road, location, area and number of room, linear regression
uses all these parameter to predict house price as it consider a linear relation between all
• The interpretability of linear regression is one of its greatest strengths. The model’s
equation offers clear coefficients that illustrate the influence of each independent variable
33
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
Our primary objective while using linear regression is to locate the best-fit line, which implies
that the error between the predicted and actual values should be kept to a minimum. There
The best Fit Line equation provides a straight line that represents the relationship between
the dependent and independent variables. The slope of the line indicates how much the
34
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
• There are many types of functions or modules that can be used for regression. A
linear function is the simplest type of function. Here, X may be a single feature or
• Linear regression performs the task to predict a dependent variable value (y)
• Hence, the name is Linear Regression. In the figure above, X (input) is the work
experience and Y (output) is the salary of a person. The regression line is the
• In linear regression some hypothesis are made to ensure reliability of the model’s
results. 35
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
Assumptions are:
and dependent variables. This means that changes in the independent variable
Independence: The observations should be independent from each other that is the
errors from one observation should not influence other. As we have discussed that our
independent feature is the experience i.e X and the respective salary Y is the dependent variable.
Let’s assume there is a linear relationship between X and Y then the salary can be predicted
using:
36
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
37
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
38
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
39
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
40
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
41
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
42
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
43
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
44
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
45
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
46
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
47
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
48
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
49
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
50
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
51
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
52
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
53
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
54
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
55
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
56
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
57
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
58
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
59
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
60
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
61
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
62
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
63
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
64
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning
65
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning
66
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning
67
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning
68
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning
69
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning
70
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning
71
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
• K-means clustering is a popular unsupervised machine learning algorithm used for partitioning
a dataset into a pre-defined number of clusters. The goal is to group similar data points together
• Recall the first property of clusters – it states that the points within a cluster should be similar to
each other. So, our aim here is to minimize the distance between the points within a cluster.
• There is an algorithm that tries to minimize the distance of the points in a cluster with their
72
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
distances to assign a point to a cluster. In K-Means, each cluster is associated with a centroid.
• The main objective of the K-Means algorithm is to minimize the sum of distances between
• Optimization plays a crucial role in the k-means clustering algorithm. The goal of the optimization
process is to find the best set of centroids that minimizes the sum of squared distances between
73
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
Initialization: Start by randomly selecting K points from the dataset. These points will act as the initial cluster
centroids.
Assignment: For each data point in the dataset, calculate the distance between that point and each of the K
centroids. Assign the data point to the cluster whose centroid is closest to it. This step effectively forms K
clusters.
Update centroids: Once all data points have been assigned to clusters, recalculate the centroids of the
clusters by taking the mean of all data points assigned to each cluster.
74
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
Repeat: Repeat steps 2 and 3 until convergence. Convergence occurs when the centroids no
Final Result: Once convergence is achieved, the algorithm outputs the final cluster centroids
75
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
The main objective of k-means clustering is to partition your data into a specific number (k) of groups,
where data points within each group are similar and dissimilar to points in other groups. It achieves this by
minimizing the distance between data points and their assigned cluster’s center, called the centroid.
Here’s an objective:
• Grouping similar data points: K-means aims to identify patterns in your data by grouping data
points that share similar characteristics together. This allows you to discover underlying structures within
the data.
• Minimizing within-cluster distance: The algorithm strives to make sure data points within a cluster are
• Maximizing between-cluster distance: Conversely, k-means also tries to maximize the separation
between clusters. Ideally, data points from different clusters should be far apart, making the clusters
EXAMPLE:
77
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
78
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
We are also given the information that we need to make 3 clusters. It means we are given K=3.We
will solve this numerical on k-means clustering using the approach discussed below.
First, we will randomly choose 3 centroids from the given data. Let us consider A2 (2,6), A7 (5,10),
and A15 (6,11) as the centroids of the initial clusters. Hence, we will consider that
Now we will find the euclidean distance between each point and the centroids. Based on the minimum
distance of each point from the centroids, we will assign the points to a cluster.
79
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
80
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
81
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
• At this point, we have completed the first iteration of the k-means clustering algorithm and assigned
• In the above table, you can observe that the point that is closest to the centroid of a given cluster is
• In cluster 1, we have 6 points i.e. A2 (2,6), A5 (6,4), A6 (1,2), A10 (7,5), A12 (4,6), A14 (3,8).
• To calculate the new centroid for cluster 1, we will find the mean of the x and y coordinates of each
• In cluster 2, we have 5 points i.e. A1 (2,10), A4 (6,9), A7 (5,10) , A8 (4,9), and A13 (3,10). Hence, the
• In cluster 3, we have 4 points i.e. A3 (11,11), A9 (10,12), A11 (9,11), and A15 (6,11). Hence, the new
82
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
83
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
84
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
85
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
86
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
87
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
• Now, we have completed the third iteration of the k-means clustering algorithm and
assigned each point into an updated cluster. In the above table, you can observe that the
point that is closest to the new centroid of a given cluster is assigned to the cluster.
• Now, we will calculate the new centroid for each cluster for the third iteration.
• In cluster 1, we have 5 points i.e. A2 (2,6), A5 (6,4), A6 (1,2), A10 (7,5), and A12 (4,6). To
calculate the new centroid for cluster 1, we will find the mean of the x and y coordinates of
each point in the cluster. Hence, the new centroid for cluster 1 is (4, 4.6).
• In cluster 2, we have 7 points i.e. A1 (2,10), A4 (6,9), A7 (5,10) , A8 (4,9), A13 (3,10), A14
(3,8), and A15 (6,11). Hence, the new centroid for cluster 2 is (4.143, 9.571)
• In cluster 3, we have 3 points i.e. A3 (11,11), A9 (10,12), and A11 (9,11). Hence, the new
88
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
89
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
K-means clustering algorithm finds its applications in various domains. Following are some of
customers into various clusters based on their transaction data and demography. This
helps the business to target appropriate customers with relevant products to increase
sales.
• Cyber profiling: In cyber profiling, we collect data from individuals as well as groups to
identify their relationships. With k-means clustering, we can easily make clusters of people
• Fraud detection in banking and insurance: By using historical data on frauds, banks90
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
From numerical data to text documents, you can use the k-means clustering
With all the advantages, the k-means algorithm has certain disadvantages too which are discussed
below.
• Deciding the number of clusters: In k-means clustering, you need to decide the number of
• Choice of initial centroids: The number of iterations in the clustering process completely
depends on the choice of centroids. Hence, you need to properly choose the centroids in the initial
• Effect of outliers: In the execution of the k-means clustering algorithm, we use all the points in a
cluster to determine the centroids for the next iteration. If there are outliers in the dataset, they
highly affect the position of the centroids. Due to this, the clustering becomes inaccurate. To avoid
this, you can try to identify outliers and remove them in the data cleaning process.
92
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
distance of the data points from a given point starts converging to a specific value. Due to
this, k-means clustering that calculates the clusters based on the distance between the
points becomes inefficient. To overcome this problem, you can use advanced clustering
algorithms like spectral clustering. Alternatively, you can also try to reduce the dimensionality
93
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
with each other. In it, frequent Mining shows which items appear together in a transaction or relation. It’s
majorly used by retailers, grocery stores, an online marketplace that has a large transactional database.
The same way when any online social media, marketplace, and e-commerce websites know what you buy
next using recommendations engines. The recommendations you get on item or variable, while you check
out the order is because of Association rule mining boarded on past customer data. There are three
Support
Confidence
Lift
Theory
94
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
95
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
Example:
A customer does 4 transactions with you. In the first transaction, she buys 1 apple, 1 beer,
1 rice, and 1 chicken. In the second transaction, she buys 1 apple, 1 beer, 1 rice. In the
third transaction, she buys 1 apple, 1 beer only. In fourth transactions, she buys 1 apple
and 1 orange.
Support(Rice)) = (2/4)/(3/4) * (2/4) = 1.33 So, Lift value is greater than 1 implies Rice is
96
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
Apriori Algorithm is a foundational method in data mining used for discovering frequent
itemsets and generating association rules. Its significance lies in its ability to identify
basket analysis.
For example, if a grocery store finds that customers who buy bread often also buy butter,
The Apriori Algorithm operates through a systematic process that involves several key
steps:
identify individual items (1-item) and their frequencies. It then establishes a minimum 97
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
2. Creating Possible item group: Once frequent 1-itemgroup(single items) are identified,
the algorithm generates candidate 2-itemgroup by combining frequent items. This process
continues iteratively, forming larger itemsets (k-itemgroup) until no more frequent itemgroup
can be found.
3. Removing Infrequent Item groups: The algorithm employs a pruning technique based on the Apriori
Property, which states that if an itemset is infrequent, all its supersets must also be infrequent. This
4. Generating Association Rules: After identifying frequent itemsets, the algorithm generates association
rules that illustrate how items relate to one another, using metrics like support, confidence, and lift to
98
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
99
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
100
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
101
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
102
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
103
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
104
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
105
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
Below are some applications of Apriori algorithm used in today’s companies and startups
5. Travel & Hospitality: Creates travel packages (e.g., flight + hotel) by finding
Dimensionality Reduction is a statistical/ML-based technique wherein we try to reduce the number of features
in our dataset and obtain a dataset with an optimal number of dimensions.
One of the most common ways to accomplish Dimensionality Reduction is Feature Extraction, wherein we
reduce the number of dimensions by mapping a higher dimensional feature space to a lower-dimensional
feature space.
The most popular technique of Feature Extraction is Principal Component Analysis (PCA)
The following graph represents the change in model performance with the increase in the number of dimensions
of the dataset. It can be observed that the model performance is best only at an option dimension, beyond
which it starts decreasing.
• Having too many features in data can cause problems like overfitting (good on training data but
poor on new data), slower computation, and lower accuracy. This is called the curse of
dimensionality, where more features exponentially increase the data needed for reliable
results.
• The explosion of feature combinations makes sampling harder In high-dimensional data and
selection (choosing the most important features) and feature extraction (creating new features
• One popular feature extraction method is dimensionality reduction, which reduces the number
• One of the most widely used dimensionality reduction techniques is Principal Component
Analysis (PCA).
108
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
variance (or spread) of the data in the new space. This helps preserve the most important
Note: It prioritizes the directions where the data varies the most (because more variation = more useful
information.
Imagine you’re looking at a messy cloud of data points (like stars in the sky) and want to simplify it.
PCA helps you find the “most important angles” to view this cloud so you don’t miss the big patterns.
109
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
110
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
111
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
112
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
113
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
114
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
115
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
116
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
117
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
GENERATIVE AI
• Generative artificial intelligence, often called generative AI or gen AI, is a type of AI that
can create new content like conversations, stories, images, videos, and music.
• It can learn about different topics such as languages, programming, art, science, and
• For example: It can learn about popular design styles and create a unique logo for a
brand or an organisation.
• Businesses can use generative AI in many ways, like building chatbots, creating media,
118
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
Evolution of Generative AI
Generative AI has come a long way from its early beginnings. Here’s how it has evolved over
time, step by step:
• AI systems followed strict rules written by humans to produce results. These systems could
only do what they were programmed for and couldn’t learn or adapt.
• For example, a program could create simple shapes but couldn’t draw something creative like
a landscape.
• AI started using machine learning, which allowed it to learn from data instead of just
following rules. The AI was fed large datasets (e.g., pictures of animals), and it learned to
identify patterns and make predictions.
• Example: AI could now recognize a dog in a picture, but it still couldn’t create a picture of a
119
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
3. The Rise of Deep Learning (2010s)
• Deep learning improved AI significantly by using neural networks, which mimic how the
human brain works. AI could now process much more complex data, like thousands of
photos, and start generating new content.
• Example: AI could now create a realistic drawing of a dog by learning from millions of dog
photos.
• GANs, introduced in 2014, use two AI systems that work together: one generates new
content, and the other checks if it looks real. This made generative AI much better at
creating realistic images, videos, and sounds.
• Example: GANs can create life like images of people who don’t exist or filters (used in apps
like FaceApp or Snapchat ).
• Models like GPT-3 and GPT-4 can understand and generate human-like text. They are
trained on massive amounts of data from books, websites, and other sources. AI can now
hold conversations, write essays, generate code, and much more.
• Example: ChatGPT can help you draft an email, write a poem, or even solve problems.
120
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
• New AI models can handle multiple types of data at once—text, images, audio, and
• Example: AI can take a written description and turn it into an animated video or a
121
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
122
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
123
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
124
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
125
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
126
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
127
MODULE 3 23AD201 - Artificial Intelligence and Machine Learning)
128