1 of 125

CS307

Machine Learning

Lecture 21

Clustering

Krishnendu Ghosh

Department of Computer Science & Engineering

Indian Institute of Information Technology Dharwad

2 of 125

Clustering

What is Clustering?

The task of grouping data points based on their similarity with each other is called Clustering or Cluster Analysis. This method is defined under the branch of unsupervised learning, which aims at gaining insights from unlabelled data points.

​

2

3 of 125

Clustering

Types of Clustering

  • Hard Clustering
  • Soft Clustering

3

4 of 125

Clustering

Uses of Clustering

  • Market Segmentation
  • Market Basket Analysis
  • Social Network Analysis
  • Medical Imaging
  • Anomaly Detection
  • Simplify working with large datasets

4

5 of 125

Clustering

Types of Clustering Methods

  • Centroid-based Clustering (Partitioning methods)
  • Density-based Clustering (Model-based methods)
  • Connectivity-based Clustering (Hierarchical clustering)

5

6 of 125

Centroid-based (Partitioning) Clustering

It organizes data points around central vectors (centroids) that represent clusters. Each data point belongs to the cluster with the nearest centroid. Generally, the similarity measure chosen for these algorithms are Euclidian distance, Manhattan Distance or Minkowski Distance.

The datasets are separated into a predetermined number of clusters, and each cluster is referenced by a vector of values. When compared to the vector value, the input data variable shows no difference and joins the cluster.

The major drawback for centroid-based algorithms is the requirement that we establish the number of clusters, “k,” either intuitively or scientifically (using the Elbow Method) before any clustering machine learning system starts allocating the data points. Despite this limitation, it remains the most popular type of clustering due to its simplicity and efficiency. Popular algorithms of Centroid-based clustering are: K-means and K-medoids clustering.

6

7 of 125

Density-based (Model-based) Clustering

Density-based clustering identifies clusters as areas of high density separated by regions of low density in the data space. Unlike centroid-based methods, density-based clustering automatically determines the number of clusters and is less susceptible to initialization positions. Key Characteristics:

  • Can find arbitrarily shaped clusters
  • Handles noise and outliers well
  • Excels with clusters of different sizes and shapes
  • Ideal for datasets with irregularly shaped or overlapping clusters
  • Effectively manages both dense and sparse data regions
  • Focus on local density allows detection of various cluster morphologies

The most popular density-based clustering algorithm is DBSCAN and OPTICS (Ordering Points To Identify Clustering Structure).

7

8 of 125

Connectivity-based (Hierarchical) Clustering

Connectivity-based clustering builds a hierarchy of clusters using a measure of connectivity based on distance when organizing a collection of items based on their similarities. This method builds a dendrogram, a tree-like structure that visually represents the relationships between objects.

There are 2 approaches for Hierarchical clustering:

  • Divisive Clustering: It follows a top-down approach, here we consider all data points to be part one big cluster and then this cluster is divide into smaller groups.
  • Agglomerative Clustering: It follows a bottom-up approach, here we consider all data points to be part of individual clusters and then these clusters are clubbed together to make one big cluster with all data points.

8

9 of 125

Distribution-based Clustering

Distribution-based clustering is a technique that assumes data points are generated from a mixture of probability distributions (e.g., Gaussian, Poisson, etc.). The goal is to identify clusters by estimating the parameters of these distributions. In distribution-based clustering:

​

Each cluster is represented by a probability distribution.

Data points are assigned to clusters based on how likely they are to belong to each distribution.

Unlike distance-based methods (e.g., K-Means), this approach can capture clusters of varying shapes, sizes, and densities.

9

10 of 125

Fuzzy Clustering

Fuzzy clustering allows data points to belong to multiple clusters with varying degrees of membership.

​

Each data point is assigned a membership value between 0 and 1 for every cluster.

These membership values indicate the degree to which a data point belongs to a particular cluster.

​

10

11 of 125

K Means Clustering

​

​

11

12 of 125

Clustering

12

13 of 125

Clustering

13

14 of 125

Clustering

14

15 of 125

Clustering

15

16 of 125

Clustering

16

17 of 125

17

18 of 125

Clustering

18

19 of 125

Clustering

19

20 of 125

Clustering

20

21 of 125

Clustering

21

22 of 125

Clustering

22

23 of 125

Clustering

23

24 of 125

Clustering

24

25 of 125

Clustering

25

26 of 125

Clustering

26

27 of 125

Clustering

27

28 of 125

Clustering

28

29 of 125

Clustering

29

30 of 125

Clustering

30

31 of 125

Clustering

31

32 of 125

Clustering

32

33 of 125

Clustering

33

34 of 125

Clustering

34

35 of 125

Clustering

35

36 of 125

Clustering

36

37 of 125

Clustering

37

38 of 125

Clustering

38

39 of 125

Clustering

39

40 of 125

Clustering

40

41 of 125

Clustering

41

42 of 125

Clustering

42

43 of 125

Clustering

43

44 of 125

Clustering

44

45 of 125

DBSCAN

​

​

45

46 of 125

​

​

46

47 of 125

DBSCAN

​

​

47

48 of 125

DBSCAN

​

​

48

49 of 125

DBSCAN

​

​

49

50 of 125

DBSCAN

​

​

50

51 of 125

DBSCAN

​

​

51

52 of 125

DBSCAN

​

​

52

53 of 125

DBSCAN

​

​

53

54 of 125

DBSCAN

​

​

54

55 of 125

DBSCAN

​

​

55

56 of 125

DBSCAN

​

​

56

57 of 125

DBSCAN

​

​

57

58 of 125

DBSCAN

​

​

58

59 of 125

DBSCAN

​

​

59

60 of 125

DBSCAN

​

​

60

61 of 125

DBSCAN

​

​

61

62 of 125

DBSCAN

​

​

62

63 of 125

DBSCAN

​

​

63

64 of 125

DBSCAN

​

​

64

65 of 125

DBSCAN

​

​

65

66 of 125

DBSCAN

​

​

66

67 of 125

DBSCAN

​

​

67

68 of 125

DBSCAN

​

​

68

69 of 125

DBSCAN

​

​

69

70 of 125

DBSCAN

​

​

70

71 of 125

DBSCAN

​

​

71

72 of 125

DBSCAN

​

​

72

73 of 125

DBSCAN

​

​

73

74 of 125

DBSCAN

​

​

74

75 of 125

DBSCAN

​

​

75

76 of 125

DBSCAN

​

​

76

77 of 125

DBSCAN

​

​

77

78 of 125

DBSCAN

​

​

78

79 of 125

DBSCAN

​

​

79

80 of 125

DBSCAN

​

​

80

81 of 125

DBSCAN

​

​

81

82 of 125

DBSCAN

​

​

82

83 of 125

DBSCAN

​

​

83

84 of 125

DBSCAN

​

​

84

85 of 125

DBSCAN

​

​

85

86 of 125

DBSCAN

​

​

86

87 of 125

DBSCAN

​

​

87

88 of 125

DBSCAN

​

​

88

89 of 125

DBSCAN

​

​

89

90 of 125

DBSCAN

​

​

90

91 of 125

DBSCAN

​

​

91

92 of 125

Hierarchical Clustering

92

93 of 125

Hierarchical Clustering

93

94 of 125

Hierarchical Clustering

94

95 of 125

Hierarchical Clustering

95

96 of 125

Hierarchical Clustering

96

97 of 125

Hierarchical Clustering

97

98 of 125

Hierarchical Clustering

98

99 of 125

Hierarchical Clustering

99

100 of 125

Hierarchical Clustering

100

101 of 125

Hierarchical Clustering

101

102 of 125

Hierarchical Clustering

102

103 of 125

Hierarchical Clustering

103

104 of 125

Hierarchical Clustering

104

105 of 125

Hierarchical Clustering

105

106 of 125

Hierarchical Clustering

106

107 of 125

Hierarchical Clustering

107

108 of 125

Hierarchical Clustering

108

109 of 125

Hierarchical Clustering

109

110 of 125

Hierarchical Clustering

110

111 of 125

Hierarchical Clustering

111

112 of 125

Hierarchical Clustering

112

113 of 125

Hierarchical Clustering

113

114 of 125

Hierarchical Clustering

114

115 of 125

Hierarchical Clustering

115

116 of 125

Hierarchical Clustering

116

117 of 125

Hierarchical Clustering

117

118 of 125

Hierarchical Clustering

118

119 of 125

Hierarchical Clustering

119

120 of 125

Hierarchical Clustering

120

121 of 125

Hierarchical Clustering

121

122 of 125

Hierarchical Clustering

122

123 of 125

Hierarchical Clustering

123

124 of 125

Hierarchical Clustering

124

125 of 125

Thank You

125