2
$\begingroup$

I want to use k-means clustering on my dataset to capture the similarity based on two attributes for two groups. I am looking to split my data first into training and testing, and then find clusters based on the training data and test the same on the new data.

The only concern I have right now is that during sampling, the distribution of data should not be biased. I have data for two groups 0 and 1, for which I want to split, and validate whether the two attributes for new data fall into group 0 or 1.

What are the points that I need to take care in mind while sampling the data? I assume it should not be random sampling, and needs to be done properly, to ensure that skewness is not present in the data, else the entire objective of clustering will fail.

$\endgroup$
  • $\begingroup$ Assuming that the data set is not tiny, why do you assume sampling at random is a bad idea? $\endgroup$ – deemel Jun 11 '18 at 16:36
2
$\begingroup$

Train and test splits are only commonly used in supervised learning.

There is a simple reason for this:

Most clustering algorithms cannot "predict" for new data. K-means is a rare exception, because you can do nearest-neighbor classification on the centroids to predict. But for any method that doesn't use centroids, it's not clear how you would apply this to "test" data.

Furthermore, how would you evaluate quality? The data is not labeled. So you could look at least-squares as in k-means and check which clustering (of multiple random runs) produced the smallest errors. But that won't be very different from just doing this on the entire data set at once, without splitting.

Much of supervised learning just does not transfer to unsupervised.

$\endgroup$
0
$\begingroup$

I have data for two groups 0 and 1, for which I want to split, and validate whether the two attributes for new data fall into group 0 or 1.

This isn't a clustering problem, it's a classification problem. You want to know whether or not these two attributes are correlated with your group assignments: the attributes are your features and the group assignment is the target you are trying to predict. You're more interested in performing inference on the features than on accurately predicting the target, which is perfectly fine. Classification models can sometimes be difficult to interpret: the simpler you go, the easier interpretation is. Here are a few simple models to try:

  • Naive Bayes
  • Decision Trees
  • Logistic Regression (A bit harder to interpret, but still doable)

If you're not even that interested in performing inference on the features and just want to know more generally "how well do the groups cluster in the attribute space?", you could bootstrap KNN to estimate the probability that a member from one group is in a region dominated by its own group.

$\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.