Skip to content
Permalink
9f0dbe12a6
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

Sentiment Analysis using Artificial Neural Networks

This is the code for my Artificial Neural Networks module in Coventry University.It was build using Keras and TensorFlow to perform Sentiment Analysis, and it was trained on the IMDb dataset.

Dataset

The IMDb dataset consists of 50,000 movie reviews from the Internet Movie Database. The dataset is split into 25,000 reviews for training and 25,000 reviews for testing. Each review is labeled as either positive or negative based on its overall sentiment.

Neural Network Architecture

The neural network model is built with Keras, a high-level deep learning library. The architecture of the model consists of an onput layer, followed by 2 hidden layers, both of which contain a dropout layer and finally the model has an output layer. The final output layer uses a sigmoid activation function to produce a probability value between 0 and 1, representing the sentiment of the input review.

Training and Evaluation

The model is trained on the training set using the Adam optimizer and binary cross-entropy loss function. The performance of the model is evaluated on the testing set, using accuracy and loss as evaluation metrics.

Requirements

Python 3.6 or later

TensorFlow 2.0 or later

Keras 2.0 or later

Usage

To train the model, run the the following Jupyter notbook:

imdb.ipynb

Results

The trained model achieved an accuracy of 89.3% on the testing set, demonstrating the effectiveness of the neural network for sentiment analysis on the IMDb dataset.

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE - see the LICENSE.md file for details.