This project builds a multi-task learning model to classify text for three tasks:
- Aspect-Based Sentiment Analysis (positive/negative/neutral) π‘
- Emotion Detection (happy/sad/angry) ππ’π‘
- Sentiment-Emotion Joint Modeling (combining sentiment & emotion)
- Python 3.6+
- TensorFlow (Keras) & PyTorch
- Libraries: pandas, numpy, nltk, spacy, scikit-learn, etc.
Install all dependencies with:
pip install -r requirements.txt- Clone the repo:
https://github.com/JeetChaurasia/Multi-Task-Learning-MTL-Model.git
- Download the spaCy model:
python -m spacy download en_core_web_sm
- Get the Semeval-2014 dataset and save as
semeval2014_train.csv&semeval2014_test.csv.
- Input: Preprocessed text (tokenized, stopword removed)
- Embedding Layer: Converts tokens to dense vectors
- LSTM Layer: Captures text sequence dependencies
- Outputs:
- Aspect Sentiment (positive/negative/neutral)
- Emotion (happy/sad/angry)
Adversarial training improves model robustness using PyTorch.
Train the model with:
python train.py- Accuracy π
- F1 Score π₯
- ROC AUC π―
- MSE π
Save the model with:
model.save('multi_task_learning_model.h5')Load the model:
loaded_model = keras.models.load_model('multi_task_learning_model.h5')MIT License - see LICENSE for details.