How to use TF-IDF vector (sparse matrix) with numerical features?

Viewed 162

I found this question that mentions using toarray() on the tf-idf sparse matrix and then making a dataframe from it and concatenating with the other dataframe.

However, using Google Colab the session crashes (I believe memory issue). Is there a workaround for this?

I want to use numerical features from LIWC (Linguistic Inquiry Word Count) categories as well as TF-IDF to build a classification model using logistic regression.

Apologies if this question was not formatted correctly, it's one of my first questions.

1 Answers

What package are you using? If you are using scikit-learn, it sounds like you are looking for FeatureUnion - there is an example on that page.

Related