What are the essential steps to build a Machine Learning model to predict the following 4 classes: whether the user was a male, a female, a brand (non-individual) or unknown. The dataset contains 20,000 rows, each with a user name, a random tweet, account profile and image, location, link, sidebar color and other information.

How can I implement this in python?


1 Answer 1


Based on the information provided, your best bet is a classification algorithm. However, which algorithm to use? You'll have to perform a trial and error based model building to arrive at one which suits your business problem best.

I'd suggest you start off with a Logistic Regression algorithm or Naive Bayes with a single classifier per class. You can later try a Convolutional Neural Network (CNN) with a 1D convolution. It usually performs well. Most algorithms are implemented in the sklearn package in Python.

The most important prerequisite would be to "clean" the data especially the "random tweet" attribute. You can use Regular Expressions to extract a keyword or two regarding important class information. You might want to look at the user name separately to determine the class value.

Image recognition can be useful in determining gender or brand logo. However it has huge memory requirements. You'll need to consider the trade-off between computation time and memory requirements. Again, if you opt for this you can use a CNN with OpenCV.

The question asked is too broad. I'm just highlighting a rough outline you can follow to build a (single or ensemble) model in Python.

Hope this helps!


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