i'm using the package e1071 in R in order to build a one-class SVM model. I was able to model it and print the model, but i am having difficulties plotting it.
I have followed this link, and also this, which is using the iris dataset, but all SVM examples use C-classification.
library(e1071)
day = c(0,1,2,3,4,5,6)
weather = c(6,5,4,3,2,1,0) #on the example, it was: c(1,0,0,0,0,0,0)
happy = factor(c(T,T,T,T,T,T,T)) #on the example it was: happy = factor(c(T,F,F,F,F,F,F))
d = data.frame(day=day, weather=weather, happy=happy)
model = svm(happy ~ day + weather, data = d, type='one-classification') #on the example it was: model = svm(happy ~ day + weather, data = d)
plot(model, d)
Since it is one-class i modified the factors to the same label. It gives the following error:
Error in rect(0, levels[-length(levels)], 1, levels[-1L], col = col)
cannot mix zero-length and non-zero-length coordinates
In addition: Warning messages:
1: package 'e1071' was built under R version 3.2.3
2: In Ops.factor(yorig, ret$fitted) : '-' not meaningful for factors
I am using R version 3.2.2 (2015-08-14) (windows).
How can i plot this model?
Thank you