-
Notifications
You must be signed in to change notification settings - Fork 2
SVM
public class train {
public static void main(String[] args) throws IOException {
`System.out.println(System.getProperty("user.dir"));`
`String filapath = System.getProperty("user.dir")+"/app/src/main/java/com/example/autocoach/SVM/";`
`String[] arg = {"-s", "0", "-c", "2", "-g", "1","-b","1", filapath+ "trainData4j.txt", "svm_model.txt"};`
`String[] parg = {"-b","1", filapath+"trainData4j.txt","svm_model.txt","out.txt"};`
`svm_train.main(arg);`
`svm_predict.main(parg);`
`}`
}
String[] arg = {"-s", "0", "-c", "2", "-g", "1","-b","1", filapath+ "trainData4j.txt", "svm_model.txt"};
-g Gamma and -c Cost == might need to be changed if the cost is bigger punish more Gamma can be positive --> 0.0 to 5.0 , most of the time needs to be set to small numbers.
-c can be between 1 to 5. Choose small like 1. Bigger number will be so related to training data. and will punish more for the wrong case. We don't want the model to be close to training data. We don't want it to overfit.
svm_predict.main(parg);
This is to predict the accuracy of the model.
We can run train.java on the android studio
The SVM package (libSVM) is used for the traing -- we don't need to change anything in this folder.