Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

In text classification and clustering, the number of features are normally big, e.g. I currently get are around 5,000 features which is already really small compared to many other text mining tasks. Given I am totally new to visualization, I have no clue about how should I plot the results from text classification and clustering.

For example, in one clustering task, I have three categories, hundreds of documents, and some thousands of features in these texts. After I apply a cluster, e.g. the KMeans cluster from scikit-learn, I have no idea about how to plot these results onto a 2D figure. It is the same for classification, say, I get texts sorted into three categories, but I get no idea how to plot them.

I've tried to learn from some examples, but most ones I found are based on pure data with very few features rather than text.

Question: Could you refer me to any tutorial or paper on either drawing text clustering/classification results or explaining the math part of such visualization. Or any help would be appreciated.

share|improve this question
    
What are you trying to convey with the visualization? The answers the community submits to you will be greatly informed by this clarification. For example, do you simply want to visualize how the hundreds of documents get categorized? Or, are you interested in, say, understanding which features are most important in distinguishing the texts in different categories? –  Josh Hemann Oct 26 '11 at 3:15
    
@JoshHemann Hi Josh, thanks for your help. My final goal is primarily on visualize results from classification and clustering, though I realize to do so, a major method is to use feature compression methods, e.g. PCA or LSI to find the most important features and reduce the dimension to 2D in order to plot. But I do want to know if there is any other way to visualize classificaiton/clustering rather than feature compression. Cheers. –  Flake Oct 26 '11 at 6:31
add comment

2 Answers

up vote 4 down vote accepted

If you're doing classification, this should be fairly straight forward. Just select some aggregate measure of performance (e.g. accuracy), and plot a distribution of that measure for different random initializations of k-means. This gives you some information about how well the algorithm would perform on average.

If you're doing clustering (i.e. unsupervised clustering), then you can make a pretty picture of the clusters using a vector compression technique. A simple technique might be to pick a point in space, and plot each point in your dataset with its euclidean distance from that point and its category. You could also use more advanced techniques like PCA.

If you're interested in finding out which features are good predictors, I suggest running something like a maximum entropy classifier on it, or one of many feature selection algorithms. These techniques will provide you with a weight for each feature indicating its importance in predicting the groupings.

share|improve this answer
    
Thanks John, with your information, I found the key is finding a 'method' to compression/reduce dimensions, for which there are so many different methods. I've already figured out how to plot instances with labels using Principal component analysis for now. :) –  Flake Oct 24 '11 at 19:11
    
Good to hear. I was going to suggest PCA, but thought a less technical approach might help with getting started. –  John Doucette Oct 24 '11 at 20:16
add comment

I use two different techniques for projecting all the data points in an n-dimensional space down onto two dimensions: PCA or MDS (multidimensional scaling). I use PCA if I have an n-dimensional vector that corresponds to each data point. I use MDS if it's more convenient to generate a distance matrix than exact n-dimensional locations of individual items. Once the points are projected into 2-space use color and/or shape to illustrate the clusters. If you have a sparsely-connected distance matrix (i.e., most of the entries have no distance and are unconnected), then you could present the data as a sparsely-connected undirected graph. There are hundreds of appropriate graph-layout algorithms you could use.

This method isn't terribly useful for identifying the structure of the clusters, but it does at least give you a pretty picture of all your points.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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