Found it depends on what you put in in slice, since you have to define at what 
constant the other variables should be held.

sl<-list(V3=17,V4=14,V5=4,V6=0.5,V7=26,V8=10,V9=15,V10=0,V11=0.4,V12=0.3,V13=1.2,V14=2.3,V15=4.2,V16=5.2,V17=5.1,V18=4.3,V19=3.35)
> plot(model,data,V1~V2,slice=sl)

For example will let you view a bit of that separating plane.  I'm not getting 
creative on how to find the best values there though..

On 27.07.2012, at 10:21, Jessica Streicher wrote: 

> Now i'm scratching my head as well, thought it might have to do with scaling 
> at first, so i turned it off, and also tried scaling the data for the plot 
> instead, but to no avail, it just switches the color, but doesn't show the 
> correct contours.
> 
> And it is at least predicting the stuff right, so its doesn't seem to be a 
> problem with the model.
> 
> On 26.07.2012, at 15:00, Meffy wrote:
> 
>> Ok, here a simple example. The file 
>> http://r.789695.n4.nabble.com/file/n4637924/test.csv test.csv  has 400 lines
>> containing 20 columns (1. column is class label, the other 19 are the
>> features). 
>> So what I'm doing is
>> /
>> data <- read.csv(file="test.csv", head=F, sep=",")
>> 
>> names(data) <- c("Class","V1", "V2", "V3", "V4", "V5", "V6", "V7", "V8",
>> "V9", "V10", "V11", "V12", "V13", "V14", "V15", "V16", "V17", "V18", "V19")
>> 
>> model <- svm(as.factor(Class)~., data=data, kernel="linear")
>> /
>> 
>> This gives me the result
>> 
>> /
>> Parameters:
>>  SVM-Type:  C-classification 
>> SVM-Kernel:  linear 
>>      cost:  1 
>>     gamma:  0.05263158 
>> 
>> Number of Support Vectors:  5
>> /
>> When plotting this with
>> 
>> /
>> plot(model, data, V2~V1)
>> /
>> 
>> I'm getting
>> http://r.789695.n4.nabble.com/file/n4637924/svm_result.png 
>> Where am I wrong here??
>> 
>> 
>> 
>> 
>> 
>> --
>> View this message in context: 
>> http://r.789695.n4.nabble.com/Only-one-class-shown-in-SVM-plot-tp4637782p4637924.html
>> Sent from the R help mailing list archive at Nabble.com.
>> 
>> ______________________________________________
>> R-help@r-project.org mailing list
>> 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.
> 
> ______________________________________________
> R-help@r-project.org mailing list
> 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.


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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 via email to