💡 Inspiration I wanted to create an AI that could understand human emotions through text. My goal was to build something that could respond based on how a person felt — like a smart assistant that actually gets your mood.
🧠 What It Does The model takes a sentence or short piece of text and predicts the emotion behind it. If the prediction is incorrect, the user can correct the emotion — and the model will learn from this and improve its future predictions. It's like having a teachable AI that learns on the go!
🛠️ How We Built It First, we loaded a dataset using pandas. We removed duplicate and null rows to ensure the data was clean.
Then, we balanced the dataset so that each emotion had an equal number of sentences.
We used CountVectorizer to turn the text into numbers based on word frequency.
Next, we split the data into training and testing sets (80% for training, 20% for testing).
We trained a Stochastic Gradient Descent (SGD) classifier. SGD works by using mini-batches of the data, updating the model slightly with each small batch to gradually improve its predictions.
Once trained, we saved the model using pickle so it could be reused without retraining every time.
Finally, we built an interactive Streamlit app where users can type in a sentence, get a predicted emotion, and correct it if necessary. The model then uses this correction to update itself — that's online learning in action!
🧗 Challenges We Ran Into Getting good predictions from user-input sentences was tough at first. That’s why we added the online training loop, where the user can teach the model when it’s wrong.
Finding a good dataset was another challenge. In machine learning, clean and balanced data is critical — and it took time to find a high-quality emotion dataset.
🏆 Accomplishments We’re Proud Of We successfully built an emotion classifier that can recognize emotions from text most of the time.
If the model makes a mistake, it can learn from the user’s correction and get better — that’s a big step toward making an adaptive AI.
📚 What We Learned Even though there were lots of challenges, I kept going and didn’t give up.
I learned that models rarely work perfectly the first time. Iteration and patience are key.
Clean data is just as important as good code in machine learning.
🚀 What’s Next for ML Emotion Analyzer and Classifier I want to expand beyond just text. I plan to detect emotions from audio, images, and videos, so users can interact with the AI using more natural input.
I also want to improve the model’s accuracy and allow for deeper customization in the UI.
Built With
- google-colab
- numpy
- pandas
- pickle
- python
- scikit-learn
- scipy
- streamlit
- streamlit-cloud
Log in or sign up for Devpost to join the conversation.