[R] svm
AbouEl-Makarim Aboueissa
abouelmakarim1962 at gmail.com
Wed Jan 10 19:50:50 CET 2018
Dear All:
I am trying to use the R function "svm" with "type =C-classification" ,
but I got the following error message
SVM.Model1 <- svm(type ~ ., data=my.data.x1x2y, *type='C-classification'*,
kernel='linear',scale=FALSE)
*Error in eval(predvars, data, env) : object 'type' not found*
I am wondering if I should install a specific R package(s).
*Here is my codes:*
feature.x1 <- c(0.25,0.5,1,1,1.5,2,2.25,2.5,2,1,3, 5,3.75,
1,3.5,4,4,5,5.5,6,6,6.5)
length(feature.x1)
feature.x2 <- c(2,3.5,1,2.5,1.75,2,1.75,1.5,2.5,1,1,
3.5,3.5,5.8,3,4,4.5,5,4,1,4,3)
length(feature.x2)
y <- c(rep(-1,11), rep(1,11))
typey<-as.factor(y)
my.data.x1x2y <- data.frame(feature.x1, feature.x2, typey)
my.data.x1x2y
install.packages("e1071")
library(e1071)
SVM.Model1 <- svm(type ~ ., data=my.data.x1x2y, type='C-classification',
kernel='linear',scale=FALSE)
plot(my.data.x1x2y[,-3],col=(typey+3)/2, pch=18, xlim=c(-1,6), ylim=c(-1,6))
box(lwd = 2, col="darkgreen")
with many thanks
abou
______________________
*AbouEl-Makarim Aboueissa, PhD*
*Professor of Statistics*
*Department of Mathematics and Statistics*
*University of Southern Maine*
[[alternative HTML version deleted]]
More information about the R-help
mailing list