Let's say I have a dataset where one feature is 'Car type' : say 'A', 'B' and 'C'.
The test set consists of samples where 'Car type' is always equal to 'A'.
Therefore, should I train my model only on the subset where 'Car type' is 'A' or on the whole training set?
What are the pros and cons of both approaches?


I think it depends on your understanding of the data set.

How similar are car $A$ with car $B$ and car $C$?

Is car $A$ an electric car and car $B$ and car $C$ running on gas? Is one of them a self driving car and the others are not?

If you are training them together, I think there is an implicit assumption that their behavior is similar and you want to take advantage of that, in particular, perhaps you do not have sufficient data from car $A$ and you are hoping that you can use data from car $B$ and car $C$ to help you.

However, if car $B$ and car $C$ are very distinct and you are trying to predict accident or car failure, adding it to them might not help that much. If the design of cars are very distinct, they might not cause accident or car failure due to the same features.

| improve this answer | |

If you're meaning to only use the test dataset on that model, doing only the training on the subset of type car 'A' is fine but the column 'car type' would be obsolete since the values are all the same in that column.

Note : If you put up a Correlation Matrix to see how your feature is affecting your output, it would be zero since column type is not changing which would make it ,as i said, obselete

But, think of your model being put in production, what if it receives a car-type equal to 'C', it will be a new value that it hasn't been trained on, and it would cause a problem to your predictions.

So, better train your model on the whole training dataset rather than peeking at the test dataset to adjust your training ( what you're doing is similar to what is called Data Leakage since you're getting information from the test dataset and altering your training according to what's in your test dataset). Hope this helps! Cheers.

| improve this answer | |

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.