Inspiration
I wanted to build a simple AI/ML project that works on real-world text data. Emotion classification felt interesting because it combines NLP with machine learning in a very practical way.
How I Built It
- Used a labelled text dataset containing different emotions.
- Cleaned and prepared the data.
- Converted text into numerical features using TF-IDF (Term Frequency-Inverse Document Frequency).
- Trained a Naive Bayes classifier to predict the correct emotion.
- Evaluated the model using accuracy and classification report.
- Added a function to test the model with custom sentences.
What I Learned
- Basics of NLP and text preprocessing.
- How TF-IDF works for feature extraction.
- Building and training a machine learning model in Python.
- How to evaluate ML models.
- Handling dataset issues, debugging, and running code in VS Code.
Challenges
- Incorrect column names in the dataset caused errors.
- Handling file paths and local CSV loading.
- Improving model accuracy with limited preprocessing.
- Understanding how train/test split impacts results.
Math Behind It (Optional LaTeX)
This is the basic formula used by the Naive Bayes classifier: $$P(\text{label} \mid \text{text}) = \frac{P(\text{text} \mid \text{label}) \cdot P(\text{label})}{P(\text{text})}$$
Built With
- ai
- data
- dataset
- machine-learning
- ml
- sklearn
Log in or sign up for Devpost to join the conversation.