
Application of NAMIC SVM to example data
========================================

#conversion
foreach i ( ../SPHARM/group*_procalign.meta )
  MeshConvert $i $i:t:r.mva
end

#training
svmTrain -k linear -1 groupA* -2 groupB* -o SVM_allAvsB_lin.svm

#test on training data
svmClassify -s SVM_allAvsB_lin.svm -i *mva -o SVM_labels_lin.txt

This of course results in a perfect classification

more SVM_labels.txt
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

#lets check out the direction
svmDDCalculator -s SVM_allAvsB_lin.svm -n oneNorm -o SVM_DD_lin_allAvsB_ -f ascii
The DD is all 0 ?? => Error

# what happens if I leave away the normalization
svmDDCalculator -s SVM_allAvsB_lin.svm -o SVM_DD_lin_allAvsB_ -f ascii
The DD is something that makes sense

 MeshMath SVM_DD_lin_allAvsB_0.mvh Lin_DDmagnitude.txt -magnitude -scale 20 -v
 MeshMath SVM_DD_lin_allAvsB_0.mvh Lin_DDscaled.txt -scale 20


#polynomial, has to have 3 parameters gamma r power
svmTrain -k polynomial --kernelParameters 1 0 2 -1 groupA* -2 groupB* -o SVM_allAvsB_poly.svm >! poly_report.txt
svmClassify -s SVM_allAvsB_poly.svm -i *mva -o SVM_labels_poly.txt >> poly_report.txt
svmDDCalculator -s SVM_allAvsB_poly.svm -o SVM_DD_poly_allAvsB_ -f ascii >> poly_report.txt
 MeshMath SVM_DD_poly_allAvsB_0.mvh Poly_DDmagnitude.txt -magnitude -scale 20 -v >> poly_report.txt
 MeshMath SVM_DD_poly_allAvsB_0.mvh Poly_DDscaled.txt -scale 20 >> poly_report.txt
# error in DD calculator?

#radial basis functions
svmTrain -k rbf  --kernelParameters 0.01 -1 groupA* -2 groupB* -o SVM_allAvsB_rbf.svm >! rbf_report.txt
svmClassify -s SVM_allAvsB_rbf.svm -i *mva -o SVM_labels_rbf.txt >> rbf_report.txt
svmDDCalculator -s SVM_allAvsB_rbf.svm -o SVM_DD_rbf_allAvsB_ -f ascii >> rbf_report.txt
 MeshMath SVM_DD_rbf_allAvsB_0.mvh Rbf_DDmagnitude.txt -magnitude -scale 20 -v >> rbf_report.txt
 MeshMath SVM_DD_rbf_allAvsB_0.mvh Rbf_DDscaled.txt -scale 20 >> rbf_report.txt

