top of page

Sentiment Analysis with Deep Learning



Sentiment Analysis is the process of determining whether a piece of writing is positive, negative, or neutral. An example of sentiment analysis is given below:

In this assignment, you will implement a multilayer perceptron (MLP) in Tensorflow. An example structure is given in Figure 1 Multilayer perceptron:

Problem definition

In this assignment, you will do sentiment analysis on a given set of sentences. Your model will learn to classify the given sentences whether they are positive or negative. First, you will train your model on a training set that involves annotated positive and negative sentences, then you will test your model on unannotated sentences which will produce the positive or negative labels for each sentence.


You will be given three input files: positive sentences, negative sentences and pretrained word vectors file. To create input of the MLP, you will read the vectors.txt and extract word vectors. In each line a word is separated with colon (:) from vectors and each vector is separated with space. You will read positive and negative examples (you do not need to convert words to lowercase. You will remove punctuation and create your label based on two classes. After reading dataset,you will shuffle data and first % 75 examples (the percentage is taken from the command line) will be used as train data and the rest of them will be used as test set. You will print out the accuracy at the end of the code. The accuracy of the model will be calculated by the proportion of the correct labels produced by the model to the total number of reviews.


Do not miss the submission deadline.

The assignment must be original, individual work. Duplicate, very similar assignments

or code from Internet are going to be considered as cheating.

You need to implement Python (Python 3). Please submit your source codes and

README file in the following submission format.

programs will run from the command line as following.

python3 positive.txt negative.txt vectors.txt 75

If you are looking for solution to exactly this Assignment or any variant assignment of this nature you can contact us.

10 views0 comments

Recent Posts

See All
bottom of page