09.10.2023 Views

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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 4

Unsupervised Learning: Clustering

Bottom-Up Approach

The bottom-up clustering method is called agglomerative hierarchical

clustering. In this approach, each input object is considered as a separate

cluster. In each iteration, an algorithm merges the two most similar clusters

into only a single cluster. The operation is continued until all the clusters

merge into a single cluster. The complexity of the algorithm is O(n^3).

In the algorithm, a set of input objects, I = {I 1 ,I 2 ,….,I n }, is given. A set

of ordered triples is <D,K,S>, where D is the threshold distance, K is the

number of clusters, and S is the set of clusters.

Some variations of the algorithm might allow multiple clusters with

identical distances to be merged into a single iteration.

Algorithm

Input: I={I 1 ,I 2 ,…., I n }

Output: O

fori = 1 to n do

Ci ← {Ii};

end for

D ← 0;

K ← n;

S ← {C1,....., Cn};

O ← <d, k, S>;

repeat

Dist ← CalcultedMinimumDistance(S);

D ← ∞;

Fori = 1 to K–1 do

Forj = i+1 to Kdo

ifDist(i, j)< Dthen

D← Dist(i, j);

u ← i;

v ← j;

89

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

Saved successfully!

Ooh no, something went wrong!