Thanks Steve! I will try and let you know how it comes.
On Wed, May 5, 2010 at 6:07 PM, Steve Lianoglou < mailinglist.honey...@gmail.com> wrote: > Hi Changbin, > > On Wed, May 5, 2010 at 6:46 PM, Changbin Du <changb...@gmail.com> wrote: > > svm.fit<-svm(as.factor(out) ~ ., data=all_h, method="C-classification", > > kernel="radial", cost=bestc, gamma=bestg, cross=10) # model fitting > > > > svm.pred<-predict(svm.fit, hh, decision.values = TRUE, probability = > TRUE) # > > find the probability, but can not find. > > > > attr(svm.pred, "probabilities") > > > >> attr(svm.pred, "probabilities") > > 1 0 > > 1 0 0 > > 2 0 0 > > 3 0 0 > > 5 0 0 > > 6 0 0 > > 7 0 0 > > 8 0 0 > > 9 0 0 > > > > Hi, Dear R community, > > > > IN my data, the out variable is the target variable (0, and 1), hh is > the > > new data set does not contain the out variable. I trained the model > svm.fit > > in training data. And want to predict the out in the new data set hh. > > > > WHy the probabilities are both 0 in 1 and 0 class? > > Look at the help for the svm function: > > ?svm > > Notice that there is a parameter in the svm function call named > `probability` with a default value of FALSE. Try: > > svm.fit<-svm(as.factor(out) ~ ., data=all_h, method="C-classification", > kernel="radial", cost=bestc, gamma=bestg, cross=10, probability=TRUE) > > -- > 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<http://cbio.mskcc.org/%7Elianos/contact> > -- Sincerely, Changbin -- [[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.