On 04.10.2011 08:53, Divyam wrote:
Hi users!

I am fitting a model with several factor variables as independents using
svm. since there are lots of categorical variables,the training and test
data sets have been created using dummy.data.frame option from dummies
package. I have a factor A in the training data set with 2 levels (0,1).In
the test set, this factor A has only 1 level (1) and hence when applying
dummy.data.frame, the variable gets dropped(and that's how i want it too).
The problem comes when I am trying to predict the test data as an error is
thrown saying A0 object is not found. Is there anyway  to solve this
problem?

Errr, if you learned a model that predicts based on several variables, including A0, what do you expect what happens if A0 is not given? Well, you cannot predict. So if A0 is constant in your test cases, just supply it!

To simplify, consider a linear model y=bX+e. Now one column of X is missing for prediction. y will be undefined, obviously.

Uwe Ligges





Thanks
Divya

--
View this message in context: 
http://r.789695.n4.nabble.com/handling-constant-factors-in-prediction-using-svm-tp3870093p3870093.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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.

______________________________________________
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.

Reply via email to