3
$\begingroup$

Why is choosing the k in the k-means clustering method based on a feature (take a dead or alive patients scenario as an example, k will be 2) considered clustering rather than classification?

$\endgroup$
2
$\begingroup$

Choosing k=2 because you want to find classes "dead" and "alive" does usually not work. That is a common toy approach that barely works on exercise data such as the Iris data set.

Because k-means is unsupervised, there is no guarantee that for k=2 it will find dead/alive. It may as well find male/female (k=2) or Chuck Norris/everybody else (k=2).

$\endgroup$
  • $\begingroup$ Suppose a set of data that studies bacteria and its features, with a slight prior knowledge about the data set (that it is on bacteria) I can suppose that k=5, since there are only 5 types of bacteria in the world, what do you think about such scenario? $\endgroup$ – Ahmad Ashraf Aug 29 '18 at 9:19
  • $\begingroup$ The clustering will likely not match your classification. Because it may cluster on, say, the size of the bacteria, not the type. There are multiple ways on how to classify (or cluster) things. $\endgroup$ – Has QUIT--Anony-Mousse Aug 29 '18 at 17:49
0
$\begingroup$

The k mean clustering is a non surpervised algorithm and classification is a type of supervised Machine learning.

The major difference is that in the k-mean clustering you don't know what characterizes your different class in term of inputs, you just specify a number of class for the algorithm to find out (by itself at some point), whereas in classification, you train a ML to recognize a class according to examples where inputs are associated with class.

So to answer your question, choosing the k depends of how many things you want to know from your data without knowing how it will be done. In classification you have to have a prior knowledge on your data.

Take an exemple : iris dataset with the two situations : consider you don't have the class label but just raw data. You can use k-mean ask it a number of clusters. You will find that you can regroup them into 3 distinct classes (its an ideal case). But if you have access to the label then you will see that you have only three classes because it's how th data is done.

One supplementary thing is to use first k-mean clustering to find the optimal number of classes and after that label them to switch from unsupervised to supervised problem.

Hope it helps !

$\endgroup$
0
$\begingroup$

As has been mentioned, the number of clusters (k) that you choose to invoke is not necessarily the same thing as the number of categories in your dataset. Therefore, the premise of your question is somewhat flawed, since k-means is an unsupervised learning algorithm, meaning that we are seeking to classify data into clusters, for which we do not know how they are classified when we start the analysis.

Indeed, k-means is only appropriate for use with continuous as opposed to categorical variables. One cannot obtain a difference between 1 and 0 in the same way as we can if the dependent variable is in interval format.

The whole point of clustering is to minimize the within-groups sum of squares between observations. The greater the within-groups sum of squares, the higher the likelihood that another cluster needs to be formed to account for the variability.

One way of detecting the ideal number of clusters is by using what is known as a scree plot.

In the following example, we can observe that when plotting number of clusters on the x-axis and within groups sum of squares on the y-axis, the WSS is minimized at roughly 3 clusters:

scree plot

Based on this, one would conclude that the data can be partitioned into three separate clusters (k=3), and the analysis can then be taken further.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.