I'm working on a prediction problem and am using R to design a decision tree. I have multiple categorical variables that I'd like to one-hot encode consistently in both my training and testing sets. I was able to achieve that with my training data by:
X train - temperatures
tt - subset(temps, select = -output) tt - subset(temps, select = -output) tt - subset(temp
data.frame(model.matrix(. -1, tt), CLASS = temps$output) oh -
But I can't seem to figure out how to apply the same encoding to my testing set; what can I do?