Re: [R] getting probabilities from SVM

From: roger bos <roger.bos_at_gmail.com>
Date: Fri 17 Feb 2006 - 08:16:46 EST

Finally figured it out. You have to extract it from the attributes. Tricky. Thanks anyway.

> attr(pred, "prob")[1:10,]

On 2/16/06, roger bos <roger.bos@gmail.com> wrote:
>
> I am using SVM to classify categorical data and I would like the
> probabilities instead of the classification. ?predict.svm says that its
> only enabled when you train the model with it enabled, so I did that, but it
> didn't work. I can't even get it to work with iris. The help file shows
> that probability = TRUE when training the model, but doesn't show an
> example. Then I try to predict with probabilities, I still only get
> classifications back. Anyone get this to work and can help me out?
>
>
> Thanks,
>
> Roger
>
> attach(iris)
>
> # alternatively the traditional interface:
> x <- subset(iris, select = -Species)
> y <- Species
> model <- svm(x, y, probability = TRUE)
> pred <- predict(model, x, probability = TRUE)
>

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Fri Feb 17 08:59:02 2006

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 14:08:37 EST