Final Year Project II (FYP-II) — All material related to this project is uploaded here.
This project leverages Twitter data and machine learning to predict whether a user has purchase intention (PI) towards a product. By analysing tweet content, we classify users as either showing purchase intention or not, and surface actionable insights through an interactive web application.
- 🐦 Data Collection — Scrape Twitter tweets using the Twitter Search API to build a labelled dataset.
- 🏷️ Annotation — Label each tweet as PI (Purchase Intention) or No PI.
- 📊 Exploratory Data Analysis — Inspect tweet types, check for class imbalance, generate word clouds and visualisations.
- 🔧 Pre-processing — Apply text cleaning and feature-extraction techniques to build a corpus.
- 🤖 Machine Learning Models — Train and evaluate multiple classifiers:
- Support Vector Machine (SVM)
- Naive Bayes
- Logistic Regression
- Decision Tree
- Neural Network
- 📋 Output — Produce a ranked list of customers who have shown purchase intention.
- 🌐 Web Application — A Django-powered website that summarises results and lets users upload their own dataset to train/test the pre-built models.
| Folder / File | Description |
|---|---|
data/ |
Annotated CSV datasets used for training and testing |
models/ |
Python scripts for each ML model and pre-processing pipeline |
posters/ |
Project poster and standee artwork |
SYMPOSIUM/ |
Presentation slides, final report, and project completion certificate |
PurchaseIntention2.zip |
Complete Django website source code |
Model Evaluation - Sheet1.pdf |
Comparative model evaluation results |
Make sure you have Python (latest version) installed, then install the required packages.
pip3 install django numpy pandas nltk textblob scikit-learnpython -m textblob.download_corporaOpen a Python terminal and run:
import nltk
nltk.download('stopwords')
exit()✅ All required dependencies are now installed.
- Clone the repository and unzip
PurchaseIntention2.zip. - Open Windows Command Prompt (cmd) and navigate to the
PurchaseIntention2folder. - Activate the virtual environment:
Scripts\activate - Navigate to the Django project:
cd djangoPIWebsite - Start the development server:
python manage.py runserver
- Open your browser and go to localhost:8000 🎉
- To stop the server press Ctrl + C. To restart, re-run
python manage.py runserver.
- Navigate to
CIP\PurchaseIntention2and activate the virtual environment:Scripts\activate - Navigate to the pages directory:
cd CIP\PurchaseIntention2\djangoWebsite\pages
- Open a Python terminal:
python
- Import and run the model test module:
import ModelTest as mt mt.output_to_results("Annotated4.csv", "AnnotatedData2.csv", "TF-IDF", "Naive Bayes", "90", "80", "70")
- 📈 The output will display prediction results and the accuracy score for the tested model.
Contributions are welcomed and encouraged! Whether it's fixing a bug, improving the documentation, adding a new feature, or suggesting enhancements — all input is appreciated.
To contribute:
- Fork this repository.
- Create a new branch for your feature or fix:
git checkout -b feature/your-feature-name
- Make your changes and commit them with a clear message:
git commit -m "Add: description of your change" - Push your branch to your fork:
git push origin feature/your-feature-name
- Open a Pull Request against the
mainbranch of this repository and describe what you've changed.
Please make sure your contributions align with the project goals and maintain code quality. For major changes, consider opening an issue first to discuss your proposal.
This project is licensed under the terms of the LICENSE file included in this repository.