# Using unsupervised learning for classification problems

Let's say there are two types of cancer(Type 1 and Type 2). Say we want to see if one of pour friends has cancer Type 1 or 2. We can treat this as a classification problem. But what if we use unsupervised learning (clustering) to separate the data into to 2 different groups and see each whether each item in group 1 belongs to a person with cancer Type 1 or 2. We will then see whether our friend belongs to group 1 or 2. I know it is stupid to do this and we have to do extra work but can we even do this?

Let's say that the features are only the age and the height (I know it's really dumb but just bear with me). The data associated with people with cancer Type 1 is [10, 150], [12, 153], [9, 143], [13, 160] and for people with Type 2 cancer : [20, 175], [23, 180], [19, 174]. Let's say we plot the data on a graph (without labelling the data) and the unsupervised program (Clustering) just separates the two groups (Say group 1 for Type 1). We then can see that to whom each data in group 1 belongs. We see those people have cancer Type 1. So given new data, we see what group our friend belongs to. If she/he belonged to group 1, he's got cancer Type 1 and if not, she/he has cancer Type 2.

• I think you're quite confused regarding the nature of the data. Let me ask you a question. What data would you use to classify if a person has a certain cancer type? How does the data look like? What are the features, if any?
– nbro
Nov 16 '18 at 23:24
• @nbro Let's say that the features are only the age and the height(I know it's really dumb but just bear with me). The data associated with people with cancer Type 1 is [10, 150], [12, 153], [9, 143], [13, 160] and for people with Type 2 cancer : [20, 175], [23, 180], [19, 174]. Let's say we plot the data on a graph(Without labeling the data) and the unsupervised program(Clustering) just seperates the two groups(Say group 1 for Type 1).We then can see that to whom each data in group 1 belongs.We see those people have cancer Type 1.So given new data, we see what group they belong to.
– user17894
Nov 17 '18 at 1:42

You cannot use clustering as an "unsupervised classifier", with the goal of targeting specific known classes that are already defined. For that you need supervised learning and a labelled dataset.

A clustering algorithm would only separate into clusters as you hope if the feature variables you use are already:

• All strongly associated with the trait you want the clusters to find

• Carefully scaled to match the expected relationship

Now this might happen by chance with an arbitrary dataset. However in practice in a complex dataset with many features (as you might use in cancer classification) you would need to select and scale just relevant features. Thus you would need to already know the relationship between features and class from some other model.

The main task of clustering is to discover naturally occurring groups within your data, that might give you insight into the distributions within a dataset. This might let you compress or summarise information about examples. The summary feature might even be predictive, but it would very rarely overlap with pre-defined classes, even when the full feature vector could be used in an accurate supervised learning predictive model.

With your given example of [age, height] you might discover that the population splits naturally into people who are still growing, fully-grown youths and mature people. If this happens to overlap with predictions of type 1 and type 2 cancer that might be interesting - perhaps a person's cluster is even a good predictive variable for having type 1 or type 2 cancer. However, whatever the features are, it is highly unlikely that it would be so strong a predictive variable that you would use it on its own to make a classification. The only variables that would be that predictive would be the clinical measurements of the cancer growth that clinicians already use to decide the cancer type.

Potentially you could build a Bayesian model around the clusters, where you can ask questions such as:

• What is the probability that a random person is in cluster A $$p(x \in A)$$?

• What is the probability that a random person has cancer type 1 $$p(x \in C_1)$$?

• What is the conditional probability that a person with type 1 cancer is found in cluster A $$p(x \in A|x \in C_1)$$?

Bayes' Theorem would then allow you to calculate the probability of having type 1 cancer based on their clustering:

$$p(x \in C_1 | x \in A) = \frac{p(x \in A|x \in C_1)}{(x \in A)}p(x \in C_1)$$

To do this fully with Bayesian statistics would involve setting some prior beliefs about the probabilities and using the data from your analysis to adjust them, which is beyond the scope of this answer. However, you could as a crude shortcut just take the measured frequencies, and that might be fine as a guide and give you some intuitions about what your clustering is doing towards helping with predictions.

There are several ways to use clustering for classification.

1. To use features associated with classes, then do clustering and find the relationships between clusters and classes.
2. To use classes in the training set as clusters and to classify each new data vector by its closeness to each cluster.
3. To use class label as one of features for clustering. Then, find association between clusters and classes.