How to handle unknown categorical value in test? #846
-
I know that one way is to rely on OrdinalEncoder's handle_unknown. However I'd much prefer not introducing one-hot encoding into the model. Is there a better/native way to handle this in Bambi? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @peeeffchang this example may be helpful https://bambinos.github.io/bambi/notebooks/predict_new_groups.html In other words, if you have a factor for which you'll have new levels, you should use a hierarchical model. If you don't, you're assuming all the levels observed in the "train" stage are all the levels that exist and then you can't predict on a new group. |
Beta Was this translation helpful? Give feedback.
Hi @peeeffchang this example may be helpful https://bambinos.github.io/bambi/notebooks/predict_new_groups.html
In other words, if you have a factor for which you'll have new levels, you should use a hierarchical model. If you don't, you're assuming all the levels observed in the "train" stage are all the levels that exist and then you can't predict on a new group.