[R] e1071: Cannot predict probabilities

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue Feb 23 21:10:20 CET 2010


Hi,

On Tue, Feb 23, 2010 at 2:43 PM, Mikkel Meyer Andersen <r at mikl.dk> wrote:
> Dear list.
>
> I using the SVM-methods from the e1071, but I can't get the
> probabilities when predicting.
>
> Code:
> x <- matrix(rbinom(100, 10, 0.3), ncol=2)
> y <- apply(x, 1, sum)
> fit <- svm(y ~ x, method = "C-classification", kernel = "radial",
> probability = TRUE)
> predict(fit, x, probability=TRUE)
>
> Here predict doesn't containing any probabilities (not as attributes
> either). Does anybody know what I'm doing wrong or if the package
> contains any bugs?

Look at your "fit" object, specifically the SVM-Type and notice that
you are actually running eps-regression, even though you try to
specify classification. So  the type of "probabilities" you're after
don't really make sense in regression context.

A "better" posed problem definition will give you what you're after. I
mean, by just running your  example code, my y vector has 10 different
(unique) labels (yours maybe different do to your random seed, I
guess) -- but are you really trying to do 10-way classification?

-steve

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the R-help mailing list