I'm trying to implement a one class SVM using the e1071 package in R. Can somebody give me pointers on how to optimize the F-score using a grid search ?
I have tried the tune.svm functions but it has only resulted in high sensitivity or high Specificity.
The percentage of positive class which I'm trying to predict is about 1-2% in the general population.
The results i get have high accuracy but with a very low F-score:
Reference
Prediction members Not members
members 1 4
Not members 12 983
Accuracy : 0.984
95% CI : (0.9741, 0.9908)
No Information Rate : 0.987
P-Value [Acc > NIR] : 0.83691
Kappa : 0.1046
Mcnemar's Test P-Value : 0.08012
Sensitivity : 0.07692
Specificity : 0.99595
Here are snippets of my code:
tuned <- tune.svm(fo, data = df,
nu = 0.001:0.5,
gamma = 10^(-2:0),
type='one-classification'
);
model <- svm(fo, data = df ,
nu = tuned$best.parameters$nu,
gamma = tuned$best.parameters$gamma,
type='one-classification'
);