I'd like to classify short texts of chats to sentence types (i.e. an informational question, a request, a statement etc). In some of the texts there is extra information, like mentioning of another person. In case the mentioned person is known, we have extra metadata about him/her. For example, in the context of medical chats, a mentioned patient could have additional features of (sex, age). Assuming sex is a categorical feature (which I one-hot encode) and is age numerical, how should I treat instances where no one is mentioned? Simply padding with zeros seems wrong.


It's not clear how you classify texts to sentence types, but assuming you vectorize text in some of the standard ways (e.g. bag of words), you receive a number of features 'connected with words appearing in the text'. AFAI understand, after you discover a mention, you can extract extra features.

It's not clear for me to too what do you want to do with these extract features. If they are extra features for text classification than you have a classical case with missing values in categorial / numeric features. Look for 'imputation of missing features' - there is a lot about it. Out of standard ways to deal with it, I would recommend adding yet another feature indicating whether the information is missing or not, so e.g. when you don't have age, you put 1 to that column - apart from putting 0 to age or any value you impute (e.g. mean).

BTW these extra features needs to be properly included into classification algorithm, as they have different nature (e.g. range) than typical bag of words features. You may need to normalize them for example.

  • $\begingroup$ Thank you, one of the issues is that I don't know in advance how many people might be mentioned, and taking some max value seems an overkill. I'll read about feature imputation. $\endgroup$ – dimid Aug 11 '18 at 19:00

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.