Classification
Classification
06/16/2023 2
Classification Task
Machine Learning 3
Flavors of Classification
Flavors of Classification
• Single Label
– For a given di at most one (di, ci) is true
– Train a system which takes a di and C as input and outputs a c i
• Multi-label
– For a given di zero, one or more (di, ci) can be true
– Train a system which takes a di and C as input and outputs C’, a subset
of C
• Binary
– Build a separate system for each c i, such that it takes in as input a d i
and outputs a boolean value for (di, ci)
– The most general approach
– Based on assumption that decision on (d i, ci) is independent of (di, cj)
Bayesian Based Classifiers
06/16/2023 6
The naive Bayes probabilistic model
7
Example Naïve Bayes Classifier
Given:
=> Play(Yes)
Classification Task: Decision Tree
Classification Task: Decision Tree
15
Information Gain
16
Information Gain
17
Information Gain
18
Information Gain
19
Information Gain
20
Example
21
Tree Induction Example
Step 1: Calculate entropy of the target.
22
Tree Induction Example
23
Tree Induction Example
24
Tree Induction Example
25
Tree Induction Example
Step 3: Choose attribute with the largest information gain
as the decision node
26
Tree Induction Example
Step 3: Choose attribute with the largest information gain
as the decision node
27
Tree Induction Example
Step 4a: A branch with entropy of 0 is a leaf node.
28
Tree Induction Example
Step 4b: A branch with entropy more than 0 needs further
splitting.
29
Tree Induction Example
Step 5: The ID3 algorithm is run recursively on the non-leaf
branches, until all data is classified.
30
Tree Induction Example
Decision Tree to Decision Rules.
A decision tree can easily be transformed to a set of rules by
mapping from the root node to the leaf nodes one by one.
31
Other Decision Tree Algorithms
• Some of the algorithms are as follows:
– Random forest
– Classification and Regression Tree (CART)
– C4.5 and C5.0
– Chi-square
– Gradient boosting machines (GBM)
– Chi-Squared Automatic Interaction Detection (CHAID)
– Decision stump
– Multi-adaptive regression splines (MARS)
06/16/2023 32
Kernel Method Based Classifiers
06/16/2023 34
Artificial Neural Networks (ANN)
• Similar to kernel methods, artificial neural networks are again a
class of pattern matching techniques, but these models are
inspired by the structure of biological neural networks.
• These methods are again used to solve classifications and
regression problems.
• They relate to Deep learning modeling and have many subfields
of algorithms that help solve specific problems in context.
06/16/2023 35
Unsupervised Learning: Clustering
06/16/2023 36
Unsupervised Learning: Clustering types
06/16/2023 37
Unsupervised Learning: Clustering Algorithms…
• K-Means clustering
– Choses centroids that minimize within-cluster sum of squared distance
– Assume flat convex surfaces, not able to tackle manifolds
• Agglomerative (a hierarchical) clustering
– A bottom apporach to generate clusters (tree-like outcome)
– Mminimizes average of the distances between all observations of pairs
of clusters
• DBSCAN
– Density based clustering of samples in area of high density
– Number of clusters not required a priori
06/16/2023 38
Clustering : K-Means clustering Algorithm
06/16/2023 39
Clustering : K-Means clustering Algorithm
Details of K-means
06/16/2023 40