Text Classification of Twitter microblog data
To develop a classifier to classify the incoming microblog streams into 10 pre-defined classes (“Health”, “Business”, “Arts”, “Sports”, “Shopping”, “Politics”, “Education”, “Technology”, “Entertainment”, “Travel”). The classification needs to examine the content of microblogs, as well as other information such as hashtags and user info.
Data set is not uploaded due to privacy issues, to contact me if interested.
The programme consists of the following:
- Pre-processing of text data
- Feature selection based on Document frequency
- Classification using machine learning techniques
- Testing and optimisation based on 10-fold cross validation and precision, recall, and f1 scores
Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)]
- nltk
- simplejson
- numpy
- scipy
- scikit-learn
-
Run 'Latefusion_preprocess.py' to prepocess tweet content, including data cleaning (e.g., remove url, punctuations, time), word tokenize, stemming, remove low-frequency words and stopping words.
-
Run 'Latefusion_classifier.py' which performs the following:
- load preprocessed data
- extract features
- optimise different ML techniques for each features (commented)
- train final model
- outputs optimal precision, recall and f1 score of the best model
-
Run 'Earlyfusion_preprocess.py' to prepocess tweet content, including data cleaning (e.g., remove url, punctuations, time), word tokenize, stemming, remove low-frequency words and stopping words.
-
Run 'Earlyfusion_classifier.py' which performs the following:
- load preprocessed data
- extract features
- optimise different ML techniques for each features (commented)
- train final model
- outputs precision, recall and f1 score of the NB, KNN and RF model in order