2
$\begingroup$

I am working on a regression problem that classifies vehicles based on their features. One feature is the model id. When doing actual predictions, the model might encounter ids that were not part of the training set. What are my options here?

$\endgroup$

1 Answer 1

3
$\begingroup$

This may depend on the nature of your data and the problem, but "model ID" does not sound like a good feature. First of all, it sounds like something too specific. For example, if you have 1000 models in your data of size 1000, and you'd train a machine learning algorithm using such feature, it will overfit since it will make distinct predictions per each of the models. It will be perfect for in-sample predictions but will not generalize at all. Second, such feature will be probably perfectly correlated with all other features and make them redundant (each model has it's own set of features, so if you know the model, then you also know what are the features). So even if you have in your data multiple vehicles of the same model, then still this feature may be redundant. However even if the feature is redundant, it is often the case that things like "model ID" can be used to create meaningful features (e.g. upper level feature such as series, or year of production, color etc. if they are somehow coded in the model ID).

Taking this aside, the simple and commonly used approach for dealing with categorical variables with levels that were not observed in the data, is to define the "others" category and put the not popular models into it. This will enable your algorithm to treat such models as "other, not very popular model".

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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