1
$\begingroup$

I am approaching machine learning for the first time because of my studies. I have been given a bunch of tweets and the goal is to classify them per topic. I really have no clue on how this should be done. Is there a particular way to follow?

Until now, I have only found topics and was thinking about making a DTM-like dataframe for the training data containing not only the number of times not-sparse words occur but also the number of times particular N-grams occur and a ground truth column with the topic.

Is this totally wrong? How else could I train a classifier without having features?

$\endgroup$
3
1
$\begingroup$

Since there are no predefined topics, the task is unsupervised: the goal is to group tweets which are semantically similar together (as opposed to classification, which requires training a model to predict among specific classes).

The standard unsupervised approach is topic modelling. In the traditional LDA approach, a topic model groups the documents into clusters and also provides the probability of a word given a topic, so a list of "top words" by topic can be extracted from the model. LDA requires the number of topics as input parameter but Hierarchical Dirichlet Processes can be used to avoid this issue (it's less common however).

$\endgroup$
3
  • $\begingroup$ Thank you for your answer. So once I found the topics I choose which topic an instance appartains to based on the sum of probabilities of the words being in each topic, right? Is there any other machine learning technique besides this one I could try? $\endgroup$ – Mauretto Dec 26 '20 at 19:00
  • $\begingroup$ @Mauretto actually it's not exactly the sum of the probabilities for each word, it's a bit more complex than that but the model can do it for you: given a document (tweet in your case), it calculates the posterior probability for every topic. So what you obtain for a tweet is a dstribution over topics, e.g. A 20%, B 70%, C 10%. From there you can pick the maximum topic (B in my example), but depending on the application sometimes it's useful to consider that a document/tweet belongs to several topics to different degrees. $\endgroup$ – Erwan Dec 26 '20 at 21:20
  • $\begingroup$ @Mauretto yes, there are many other techniques: basically any clustering algorithm can be used. For this you would need a similarity measure between two tweets, and there are also many possibilites for that. For example you could define a similarity mesure based on content words and n-grams. Note that you could also customize your features in the topic modelling approach, but it's less standard. $\endgroup$ – Erwan Dec 26 '20 at 21:25

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