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? -- Sincerely, Changbin -- Changbin Du DOE Joint Genome Institute Bldg 400 Rm 457 2800 Mitchell Dr Walnut Creet, CA 94598 Phone: 925-927-2856 [[alternative HTML version deleted]]
Dear Changbin, that looks odd indeed - can you cast your example in a reproducible one so I can track this down (or at least send me the data offline?) Thanks David Changbin Du 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? > > > > > > > -- > Sincerely, > Changbin > -- > > Changbin Du > DOE Joint Genome Institute > Bldg 400 Rm 457 > 2800 Mitchell Dr > Walnut Creet, CA 94598 > Phone: 925-927-2856 > >-- Priv.-Doz. Dr. David Meyer Department of Information Systems and Operations WU Wirtschaftsuniversit?t Wien Vienna University of Economics and Business Augasse 2-6, 1090 Vienna, Austria Tel: +43-1-313-36-4393 Fax: +43-1-313-36-90-4393 HP: http://ec.wu.ac.at/~meyer
Hi Changbin, On Wed, May 5, 2010 at 6:46 PM, Changbin Du <changbind at 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