Re: [R] In svm(), how to connect quantitative prediction result to categorical result?

From: Saeed Abu Nimeh <sabunime_at_gmail.com>
Date: Tue, 12 Apr 2011 10:54:52 -0400

I trained a linear svm and did classification. looking at the model I have, with a binary response 0/1, the decision values look like this: head(svm.model$decision.values)
2.5
3.1
-1.0

looking at the fitted values
head(svm.model$fitted)
1
1
0
So it looks like anything less than or equal 0 is mapped to the negative class, i.e. 0), otherwise it is mapped to the positive class, i.e. 1.

On Fri, Apr 8, 2011 at 8:35 PM, Li, Yunfei <yunfei_li_at_wsu.edu> wrote:
> Hi,
>
> I am studying using SVM functions of e1071 package to do prediction, and I found during the training data are "factor" type, then svm.predict() can predict data directly by categories; but if response variables are "numerical", the predicted value from svm will be continuous quantitative numbers, then how can I connect these quantitative numbers to categories? (for example:in an example data set, the response variables are numerical and have two categories: 0 and 1, and the predicted value are continuous quantitative numbers from 0 to 1.3, how can I know which of them represent category 0 and which represent 1?)
>
> Best,
>
> Yunfei Li
> --------------------------------------------------------------------------------------
> Research Assistant
> Department of Statistics &
> School of Molecular Biosciences
> Biotechnology Life Sciences Building 427
> Washington State University
> Pullman, WA 99164-7520
> Phone: 509-339-5096
> http://www.wsu.edu/~ye_lab/people.html
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help_at_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_at_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. Received on Tue 12 Apr 2011 - 14:57:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 12 Apr 2011 - 16:10:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive