ICP_Deep Learning 3 - PallaviArikatla/Python GitHub Wiki
INTRODUCTION: To work on Embedding layer in keras and to Perform sentimental analysis on the datasets given.
IMPLEMENTATION:
Question 1: In the code provided,there are three mistake which stop the code to get run successfully; find those mistakes and explain why they need to be corrected to be able to get the code run.
- The three identified mistakes and changes to be done are
- The input dimension must be equal to the number of columns in the dataset given, hence we have to give value for the input_dim variable.
- Change the neurons in the output layer as 3 as we have three values in the label i.e., neg, pos and unsup.
- Make softmax activation, as it suits best for multi class classification as there are multiple divisions in the target column.
- Calculate Loss and Accuracy.
- Plot Loss and Accuracy.
Question 2: Add embedding layer to the model and check whether there is any improvement.
- Prepare the data for embedding.
- Encode the data followed by splitting the data to train and test.
- Check for the imports and import necessary embedding layers from keras layers.
- Add the embedding layer.
- And plot the accuracy.
Question 3: Apply the code on 20_newsgroup data set we worked in the previous classes.
- Follow the same procedure as above and change the data to 20newsgroup data and then change the output neurons to 20.
- Execute the program 20newsgroup on and plot the accuracy.
Adding embedding layers accuracy got decreased.
Bonus questions:
Question 1: Plot the loss and accuracy using history object.
- Consider loss and accuracy values from the the data given and history object and plot graph loss against accuracy.
Question 2: Predicting the fourth sample.
- Consider fourth value in the data and draw its predicted value.