I'm using e1071 Package for generating VM model and predictions in R. my_data csv file sample:
Kupno,X1,X2,X3,X4
0,1,22,1,4.961566871
1,2,18,0,6.316553966
... 10000 lines
My R code:
library(e1071)
model <- svm(data = my_data, y = my_data['Kupno'], x = my_data['X1'])
plot(model,data=my_data,fill=TRUE)
index <- 1:nrow(my_data)
testindex <- sample(index, trunc(length(index)/3))
testset <- my_data[testindex,]
trainset <- my_data[-testindex,]
model <- svm(data = my_data, y = my_data['Kupno'], x = my_data['X1'])
prediction <- predict(model, testset)
And I have three problems:
- plot command not generate any errors but also plot not showing up. Plot for plot(my_data) show properly.
Last command return error:
'scale.default(newdata[, object$scaled, drop = FALSE], center = object$x.scale$"scaled:center", ': length of 'center' must equal the number of columns of 'x'
I have four columns of X and I don't know how to pass four dimention X to the SVM model.
Thanks a lot for help!