This repository contains code and analysis for text emotion classification using Machine Learning and Keras. The project includes data preprocessing, tokenization, one-hot encoding, model architecture definition, training, and emotion prediction.
- Introduction
- Prerequisites
- Data Preprocessing
- Model Architecture
- Model Training
- Emotion Prediction
- Contributing
- License
The goal of this project is to classify the emotions in text using a Machine Learning model built with the Keras framework. The project showcases the steps involved in tokenizing text, one-hot encoding labels, defining a neural network architecture, training the model, and predicting emotions in input text.
git clone https://github.com/Mohshaikh23/Text-Emotions-Classification.git
Before running the code, ensure you have the required libraries installed:
- pandas
- numpy
- keras
- tensorflow
- scikit-learn
You can install them using the following command:
pip install pandas numpy keras tensorflow scikit-learn
The code starts with loading and preprocessing text data. It tokenizes the text, pads sequences, encodes labels, and prepares the data for model training.
The neural network model architecture is defined using the Keras Sequential
API. It consists of an embedding layer, a flatten layer, and two dense layers with specified activation functions.
The model is compiled with an optimizer and loss function, then trained using the prepared training data. Validation data is used to monitor the model's performance during training.
The trained model is used to predict emotions in input text. An example input text is preprocessed, and the model predicts the corresponding emotion label.
Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or create a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.