A model trained on three delivery regions will eventually receive a fourth if the business expands. The new label may be perfectly valid business data, yet absent from the encoder’s fitted vocabulary. That mismatch needs a defined response before deployment.
The scikit-learn OneHotEncoder documentation describes configurable handling of unknown categories. With handle_unknown='ignore', an unseen category is represented by zeros in that feature’s encoded columns. This behaviour avoids one kind of error; it does not teach the model what the new category means.
Make the unknown visible in a test
Imagine training on delivery regions North and South, then receiving Island. A full two-column encoding can represent North as [1, 0], South as [0, 1], and the ignored unknown as [0, 0]. The example concerns one categorical feature, not the complete model input.
If a reference category is dropped, an all-zero representation can also correspond to that known reference. Decide whether that ambiguity is acceptable for the application rather than assuming zero always means unknown.
Separate unfamiliar from absent
A blank value, a spelling mistake and a legitimate new region are different events. Validate them before encoding where appropriate. Do not silently map all three to one convenient label unless the data policy and model design explicitly call for it.
Keep the fitted encoder with the model. Re-fitting it independently on incoming data can change the feature layout and invalidate the model’s expectations. Use the same preprocessing pipeline during evaluation and prediction.
Decide what happens operationally
Test the chosen behaviour with a known label, an unseen label and missing input. Record unknown-category rates without logging unnecessary personal data, and assign an owner to investigate changes.
The appropriate response might be a controlled fallback, a validation message or a reviewed model update. It depends on the application. A successful prediction call is only the beginning of the check: the team also needs to know whether the input was represented in the way it intended.

