09.10.2023 Views

Advanced Data Analytics Using Python_ With Machine Learning, Deep Learning and NLP Examples ( 2023)

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 4

Unsupervised Learning: Clustering

end if

end for

end for

K ← K-1;

Cnew ← Cu ∪Cv;

S ← S∪ Cnew –Cu – Cv;

O ← O∪<D, K, S>

Until K = 1;

A Python example of hierarchical clustering is given later in the chapter.

Distance Between Clusters

In hierarchical clustering, calculating the distance between two clusters is

a critical step. There are three methods to calculate this.

• Single linkage method

• Complete linkage method

• Average linkage method

Single Linkage Method

In the single linkage method, the distance between two clusters is the

minimum distance of all distances between pairs of objects in two clusters.

As the distance is the minimum, there will be a single pair of objects that

has less than equal distance between two clusters. So, the single linkage

method may be given as follows:

Dist(C i , C j ) = min dist(X , Y)

X€C i ,Y€C j

90

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!