[R] svm
David Winsemius
dwinsemius at comcast.net
Wed Jan 10 19:54:30 CET 2018
> On Jan 10, 2018, at 10:50 AM, AbouEl-Makarim Aboueissa <abouelmakarim1962 at gmail.com> wrote:
>
> 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*
Yopu misspelled the name of your "typey" variable.
>
>
> 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]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
David Winsemius
Alameda, CA, USA
'Any technology distinguishable from magic is insufficiently advanced.' -Gehm's Corollary to Clarke's Third Law
More information about the R-help
mailing list