This project demonstrates sentiment analysis on the IMDb dataset using a bidirectional LSTM neural network implemented with TensorFlow. The goal is to predict whether a movie review is positive or negative based on its text.
The IMDb dataset consists of 50,000 movie reviews labeled as positive or negative. The dataset is split into 25,000 reviews for training and 25,000 for testing.
- Python 3
- TensorFlow 2.x
- Matplotlib
-
Clone the repository:
git clone https://github.com/soheil-asgari/imdb.git
-
Install dependencies:
pip install -r requirements.txt
The neural network model consists of the following layers:
- Embedding layer: Maps each word to a dense vector representation.
- Bidirectional LSTM layers: Captures contextual information from both directions.
- Dense layer with sigmoid activation: Produces the final output (positive or negative sentiment).
The model is trained for 5 epochs with a batch size of 64. Adam optimizer and binary cross-entropy loss are used for training.
The above plots show the training and validation accuracy, as well as the training and validation loss, over the epochs.
This project is licensed under the MIT License. See the LICENSE file for details.