Hi guys, I have a set of train and test data and I have to build a regression model using them. All the predictors are binary variables. Some of the predictors are constant (have a single value) in the train dataset but not in the test dataset. How do I train a model a model in such situation without dropping any predictor ?
I don’t think so there is option other than removing the constant column in the train and the test dataset.
Would adding random noise to it help ?
Adding noise wouldn’t but if your column is not exactly a zero variance column but a near zero, then you might want to look at these two papers that describe the methods to deal with them.
Zorn, C. (2005). A solution to separation in binary response models. Political Analysis, 13(2), 157-170
Gelman, A., Jakulin, A., Pittau, M.G. and Su, Y.S. (2008). A weakly informative default prior distribution for logistic and other regression models. The Annals of Applied Statistics, 1360-1383