views:

274

answers:

5

How should I approach a situtation when I try to apply some ML algorithm (classification, to be more specific, SVM in particular) over some high dimensional input, and the results I get are not quite satisfactory?

1, 2 or 3 dimensional data can be visualized, along with the algorithm's results, so you can get the hang of what's going on, and have some idea how to aproach the problem. Once the data is over 3 dimensions, other than intuitively playing around with the parameters I am not really sure how to attack it?

+2  A: 

What do you do to the data? My answer: nothing. SVMs are designed to handle high-dimensional data. I'm working on a research problem right now that involves supervised classification using SVMs. Along with finding sources on the Internet, I did my own experiments on the impact of dimensionality reduction prior to classification. Preprocessing the features using PCA/LDA did not significantly increase classification accuracy of the SVM.

To me, this totally makes sense from the way SVMs work. Let x be an m-dimensional feature vector. Let y = Ax where y is in R^n and x is in R^m for n < m, i.e., y is x projected onto a space of lower dimension. If the classes Y1 and Y2 are linearly separable in R^n, then the corresponding classes X1 and X2 are linearly separable in R^m. Therefore, the original subspaces should be "at least" as separable as their projections onto lower dimensions, i.e., PCA should not help, in theory.

Here is one discussion that debates the use of PCA before SVM: link

What you can do is change your SVM parameters. For example, with libsvm link, the parameters C and gamma are crucially important to classification success. The libsvm faq, particularly this entry link, contains more helpful tips. Among them:

  1. Scale your features before classification.
  2. Try to obtain balanced classes. If impossible, then penalize one class more than the other. See more references on SVM imbalance.
  3. Check the SVM parameters. Try many combinations to arrive at the best one.
  4. Use the RBF kernel first. It almost always works best (computationally speaking).
  5. Almost forgot... before testing, cross validate!
Steve
The question was not about dimensionality reduction, the author just complained he could not get grips with the multi-dimensional data. But whatever. The fact PCA did not help in your case does not mean it is useless. Try to make up the artificial data: the points separable in one dimension. Add some noise to obtain 50-dimensional data. The max-margin hyperplane is likely to drift away.
overrider
I think that my answer, in its entirety, does address the question. But about the statement, "add some noise to obtain 50-dimensional data", adding *noise* is not the same as adding *features*. If you concatenate 49 features containing uncorrelated noise to the one meaningful feature from which two classes are separable, the SVM will still separate the classes in the 50-dimensional space as successfully as in the one-dimensional space. There is no doubt about it.
Steve
Steve, I asked a professor about this problem. You are certainly right that dimensionality reduction does not help to separate classes, but it still can help to improve the discriminative power of a classifier. Also, PCA is not the best method here since it does not take into account the structure of classes. Relevance Vector Machine could be more suitable: http://en.wikipedia.org/wiki/Relevance_Vector_Machine
overrider
Thank you for the follow-up comment. Yes, I agree -- while "from not separable, make separable" is not possible through dimensionality reduction (at least via linear transformations like PCA), "improve discriminative power" *is* possible. The RVM is a nice suggestion.
Steve
+1  A: 

Some suggestions:

  • Project data (just for visualization) to a lower-dimensional space (using PCA or MDS or whatever makes sense for your data)

  • Try to understand why learning fails. Do you think it overfits? Do you think you have enough data? Is it possible there isn't enough information in your features to solve the task you are trying to solve? There are ways to answer each of these questions without visualizing the data.

Also, if you tell us what the task is and what your SVM output is, there may be more specific suggestions people could make.

A: 

If I'm not wrong, you are trying to see which parameters to the SVM gives you the best result. Your problem is model/curve fitting. I worked on a similar problem couple of years ago. There are tons of libraries and algos to do the same. I used Newton-Raphson's algorithm and a variation of genetic algorithm to fit the curve.

Generate/guess/get the result you are hoping for, through real world experiment (or if you are doing simple classification, just do it yourself). Compare this with the output of your SVM. The algos I mentioned earlier reiterates this process till the result of your model(SVM in this case) somewhat matches the expected values (note that this process would take some time based your problem/data size.. it took about 2 months for me on a 140 node beowulf cluster).

If you choose to go with Newton-Raphson's, this might be a good place to start.

Sridhar Iyer
A: 

I would approach the problem as follows:

What do you mean by "the results I get are not quite satisfactory"?

If the classification rate on the training data is unsatisfactory, it implies that either

  • You have outliers in your training data (data that is misclassified). In this case you can try algorithms such as RANSAC to deal with it.
  • Your model(SVM in this case) is not well suited for this problem. This can be diagnozed by trying other models (adaboost etc.) or adding more parameters to your current model.
  • The representation of the data is not well suited for your classification task. In this case preprocessing the data with feature selection or dimensionality reduction techniques would help

If the classification rate on the test data is unsatisfactory, it implies that your model overfits the data:

  • Either your model is too complex(too many parameters) and it needs to be constrained further,
  • Or you trained it on a training set which is too small and you need more data

Of course it may be a mixture of the above elements. These are all "blind" methods to attack the problem. In order to gain more insight into the problem you may use visualization methods by projecting the data into lower dimensions or look for models which are suited better to the problem domain as you understand it (for example if you know the data is normally distributed you can use GMMs to model the data ...)

liza
A: 

You can try reducing the dimensionality of the problem by PCA or the similar technique. Beware that PCA has two important points. (1) It assumes that the data it is applied to is normally distributed and (2) the resulting data looses its natural meaning (resulting in a blackbox). If you can live with that, try it.

Another option is to try several parameter selection algorithms. Since SVM's were already mentioned here, you might try the approach of Chang and Li (Feature Ranking Using Linear SVM) in which they used linear SVM to pre-select "interesting features" and then used RBF - based SVM on the selected features. If you are familiar with Orange, a python data mining library, you will be able to code this method in less than an hour. Note that this is a greedy approach which, due to its "greediness" might fail in cases where the input variables are highly correlated. In that case, and if you cannot solve this problem with PCA (see above), you might want to go to heuristic methods, which try to select best possible combinations of predictors. The main pitfall of this kind of approaches is the high potential of overfitting. Make sure you have a bunch "virgin" data that was not seen during the entire process of model building. Test your model on that data only once, after you are sure that the model is ready. If you fail, don't use this data once more to validate another model, you will have to find a new data set. Otherwise you won't be sure that you didn't overfit once more.

List of selected papers on parameter selection: Feature selection for high-dimensional genomic microarray data

Oh, and one more thing about SVM. SVM is a black box. You better figure out what is the mechanism that generate the data and model the mechanism and not the data. On the other hand, if this would be possible, most probably you wouldn't be here asking this question (and I wouldn't be so bitter about overfitting).

List of selected papers on parameter selection

  1. Feature selection for high-dimensional genomic microarray data
  2. Wrappers for feature subset selection
  3. Parameter selection in particle swarm optimization
  4. I worked in the laboratory that developed this Stochastic method to determine, in silico, the drug like character of molecules
bgbg