I have checked the following one class SVM classification in R that was posted in this thread:
https://stackoverflow.com/questions/27375517/one-class-classification-with-svm-in-r
In this program the author performs one class svm in the iris dataset. For what I see he chooses for the test dataset approximately the 33% of all the data, which is like 50 records belonging to the setosa class. The strange thing that I could notice is that for obtaining the predictions or testing its model, the author uses all the dataset or the 150 records of the iris data. The source code is the following:
library(e1071)
data(iris)
df <- iris
df <- subset(df , Species=='setosa') #choose only one of the classes
x <- subset(df, select = -Species) #make x variables
y <- df$Species #make y variable(dependent)
model <- svm(x, y,type='one-classification') #train an one-classification model
print(model)
summary(model) #print summary
# test on the whole set
pred <- predict(model, subset(iris, select=-Species)) #create predictions
I have a couple of doubts about this model and the example made:
In this case of the one class SVM which would be a suitable train and test division. I am a little bit doubtful if I could use the "golden-rule" of 80% for training and 20% for testing or can make like in the example to train with a subset of the data and then test with all the data?
For what I know this type of SVM could be considered as unsupervised learning, so I would not really have like a y label to test if my predictions are correct, but instead this model will detect outliers or a percentage of samples that do not belong to the class that I have, is this correct?
Thanks.