# Train NN or SVM to classify stock signals

I am applying Neural network and SVM to predict buy-hold - sell signals. I have trained nn and SVM in R. I used nnet function to train NN and svm to train SVM. I provided 20,000 data points to train and 2000 data points to test. training data set contain list of 10-15 technical indciators and buy-sell-hold signals. The problem I am having is it is not predicting the buy -sell - hold signals with good accuracy on the testing data. I have used sigmoid function in nnet and radial function in SVM. Any suggestion, how to improve the accuracy of the prediction?

• Use cross-validation or basically u need to find the best value of C and gamma to improve the accuracy of prediction. hope this helps... – lakesh Feb 21 '12 at 14:39
• I tried various values of C and gamma varying between (1-100) for C and (0.001 - 1) for gamma. Still no sucess. – user395882 Feb 22 '12 at 5:05
• sometimes the gamma values can go higher as well.. like 8... – lakesh Feb 22 '12 at 9:05
• look at this qn..stackoverflow.com/questions/9047459/… it was posted by me... look at amro's ans... – lakesh Feb 22 '12 at 9:06
• or you could use the grid.py for grid search.. – lakesh Feb 22 '12 at 9:29

In the work I've done much lower values of C work better - in the range of $10^{-4}$ to $10^{-2}$. 1-100 is a pretty high value of C, at least for the data I've worked with, which means you are not allowing much 'slack' and so its not surprising that you are finding your model over-fits the data. I would recommend trying with much smaller values of C and in orders of magnitude increments. Another alternative is to try nu-SVM rather than C-SVM. The parameter nu ranges from 0 to 1 (.1 to .8 in practice) and is much more intuitive: .1 means a small proportion of your data points are support vectors (and therefore you have a narrow margin and little slack), .8 means a very large percent are support vectors (and therefore a wide margin and a good deal of slack).