Exercise Set #4
Contents
Exercise Set #4¶
FIZ228 - Numerical Analysis
Dr. Emre S. Tasci, Hacettepe University
k-means Clustering¶
Import the data given in the
Exercise_04_a.csvfilePlot them.
Looking at your data, decide the optimal number of means (\(k\in[2,6]\)) and indicate them by drawing over by hand.
Device an algorithm to automatically come up with the optimal number of k-means and implement it.
Soft k-means Clustering¶
Implement soft k-means clustering by changing the definition of the responsibility vector such that:
Each point belongs to a mean as a function of the distance between them (closer the mean, higher responsibility)
The sum of each mean’s ownership per each data point is equal to 1.
In the lecture notes, the responsibility vector for soft k-means clustering is defined as:
where \(\beta\) is the softness parameter \((\beta\rightarrow\infty\Rightarrow\text{Hard k-means algorithm.})\) and \(d\left(\vec{m}^{(k)},x^{(n)}\right)\) is the distance function between the kth mean and the nth data point.
Define your responsibility vector using a different function than the one given and use it to cluster the data given in Exercise_04_b.csv