# Classification technique for unsupervised data?

I have unsupervised data (i.e this data doesn't have any target variable through which I can learn it's prior behaviour) it is a mix of continuous and categorical data. Now I want to classify the test data into three categories on basis of my unsupervised data.

The approach I took is to first do the clustering of unsupervised data, use this categorised data as a base data for preparing a new model that predicts on top of it.

I want know whether this approach correct or not or is there better way for classifying test set? Particular algorithm I need to follow for this?

I am doing this in R.

The approach is to modify the training set data so that this can be used to properly predict the test data. Here target variable is missing in train and test set.

• Welcome to the site. Possible to add a small chunk of your data here? (Would help in answering better) :)
– Dawny33
Jun 14 '16 at 12:05
• @Dawny33 actually this data is confidential to company and I can't copy paste here...it will be helpful if somebody can throw light on approach and algorithm for mix and unsupervised data. Jun 15 '16 at 3:14
• From what I understand, looks like you are on the right path. Since the data is unsupervised, I'd cluster it into natural groups first, and then use those cluster assignments as the target for predicting the test data. See here for something similar: datascience.stackexchange.com/questions/985/…
– Minu
Jun 15 '16 at 19:13
• You say this is an unsupervised problem, but then you say you have "categorised data". This is contradictory; what's the task here really? Jun 24 '16 at 16:26
• @Eskapp I agree data is data but I tried to explain the property that it does not have property through which I can supervise present data with historical data. I am editing to give more clarification so other don't get confuse. Dec 17 '16 at 14:02

You have many options of algorithms to use for classification of unsupervised data.

This is a very broad topic, but if you need a specific algo recommendation, try to see if self-organizing maps (SOM) may help with your specific problem. In R, try the kohonen package.

K-means is another popular clustering algorithm.

No matter which method you use, consider converting your categorical data to numerical data for clustering, as it may alleviate some of your mixed data-type woes.

• I'm not sure I'd call either of those "classification", but it does sound like a clustering problem. SOMs aren't really a clustering technique as much as a form of dimension reduction. Jun 24 '16 at 16:27
• That is a good point. One possibility is to build an SOM, and then cluster with k-means once the SOM is produced. Jun 24 '16 at 16:44
• Additionally @SeanOwen : I can't comment on his post (not enough reputation yet), however I believe by "categorised" data he did not mean the original dataset, but one produced after an initial clustering task. Jun 24 '16 at 16:48

It's really a broad topic but I think you are going on a right track.

I solved a similar problem couple of months back where I worked on classification of documents in multiple categories using Centroid based algorithm. Here, I clustered training dataset using Spherical K-Means, and the resulting centroids of the clusters represented a category. Later while predicting a category of new document, I would compare the document with all the centroids and assign a category based of SSE.

Michael is right - K-means clustering could possibly work for you, but K-means isn't designed to handle categorical variables.

If you don't have too many categories, then you could choose to represent them as dummy variables. Here's a link to a post where I explain dummy variables in Python Pandas. I also found a Stack Overflow answer that explains how to create dummy variables in R.