0
$\begingroup$

Is it common to have a different feature set for samples in the train set and in the test set?

My use case is text categorization: when training, I use the words as the features. But when testing, I want to add hypernyms.

For example, if the training set contained the sentence "I eat a fruit", and there is a test sentence "I eat an apple", then I want to have the word "fruit" as a feature of the test sentence, in addition to its words, so that it will be classified positive. However, I don't want to add those hypernyms in the training set - if the training set contained only "I eat an apple", I don't want the sentence "I eat a fruit" to be classified positive.

So, I thought of having a small feature set for training, and a larger feature set for testing.

Is this common? If so, I would be happy to have some references.

$\endgroup$
2
$\begingroup$

The answer to the question in the title is no. Most ML algorithms are built around the assumption that the training and test data are drawn from the same distribution. So you should do the same pre-processing and use the same features at train and test time.

That being said, the procedure you describe sounds more like using background knowledge to make the features in the test set more similar to what you saw during training. This certainly seems like a reasonable thing to do and might fall under the heading of Domain Adaptation, when the distribution of the training and test sets change. Unfortunately I'm not familiar enough with the area to say for sure or give you a reference.

$\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.