svm --- type~.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

svm --- type~.

AbouEl-Makarim Aboueissa-3
Dear All: Just fixed where is the problem


I am trying to use the R function "svm" with  "type~." , 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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: svm --- type~.

AbouEl-Makarim Aboueissa-3
got it

thank you
abou

______________________


*AbouEl-Makarim Aboueissa, PhD*

*Professor of Statistics*

*Department of Mathematics and Statistics*
*University of Southern Maine*


On Wed, Jan 10, 2018 at 2:41 PM, AbouEl-Makarim Aboueissa <
[hidden email]> wrote:

> Dear All: Just fixed where is the problem
>
>
> I am trying to use the R function "svm" with  "type~." , 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]]

______________________________________________
[hidden email] 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.