machine learning - how to plot one-class SVM in R? -


i'm using package e1071 in r in order build one-class svm model. able model , print model, having difficulties plotting it.

i have followed link, , this, using iris dataset, 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 example, was: c(1,0,0,0,0,0,0) happy = factor(c(t,t,t,t,t,t,t)) #on example 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 example was: model = svm(happy ~ day + weather, data = d)  plot(model, d) 

since one-class modified factors same label. gives following error:

error in rect(0, levels[-length(levels)], 1, levels[-1l], col = col)   cannot mix zero-length , non-zero-length coordinates in addition: warning messages: 1: package 'e1071' built under r version 3.2.3 2: in ops.factor(yorig, ret$fitted) : '-' not meaningful factors 

i using r version 3.2.2 (2015-08-14) (windows).

how can plot model?

thank you

thanks. guess this answer works. if able find how plot 2d in quicker way, please share. otherwise, great.

it presents 3d plot 3 feature values. draws hyperplane , can play around nu value , see increase or decrease of margin. cool..


Comments