1
$\begingroup$

I created my dummy variables, trained my model and tested it as below:

dummy <- dummyVars(formula = CLASS_INV ~ ., data = campaign_spending_final_imputed) 
campaign_spending_final_dummy <- predict(dummy, newdata = campaign_spending_final_imputed) %>% as.data.frame() %>%
  mutate(CLASS_INV = campaign_spending_final$CLASS_INV) 

I now want to test my process on an unseen real world data. How can I do it? How can I encode the category class to its respective dummy encoding?

$\endgroup$
1
$\begingroup$

The predict function will work on the new data. It has some options for how to handle entries that don't appear in the original data's labels.

https://rdrr.io/cran/caret/man/dummyVars.html

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.