ICP10 - smqhw/kdm1 GitHub Wiki

A. Description About the ICP: This ICP is about analyzing and building a deep learning model using different hyperparameters and to build a deep learning model.

B. Objective: The main objective of this ICP is to work on deep learning model by changing the hyperparameter values and compare the results with the original model.

C. Design Implementation: First, before we make the to work well without any delay we have to change the runtime type into GPU. And then I have imported all the libraries to build this model.

Next I have downloaded the Review data and read using the read_csv file.

Next, I had dropped the unnecessary columns in the dataset and then calculated the polarity and performed the visualization graphs using matplot library.

Next step, in the data preprocessing stage, I have assigned the positive to the df_Positive, Negative to df_Negative, Neutral to df_Neutral, and then equally sampling the dataset to build the model.

Later, I have performed the text processing. In this stage, I had removed the stop words, punctuations and then converted the data to lower case and finally applied the method to column review text.

Visualizing the Text Review with Polarity Rating and applied the one-hot encoding on negative, neutral, and positive.

Applied Train Test Split and vectorization.

Applied the frequency and inverse document frequency on the X_test and X_train

Now, Building a deep learning model. I have selected the model as "sequential" and added 3 layers to the model with dropout values is 0.6 which means 60% of the information is getting dropped. And used the "Adam optimizer algorithm" with learning_rate=0.001. Added the early stopping with min mode and patience=2 means so that it will stop if the two consecutive 'val_loss' are increasing in order. Once done with the model building, Fitting the model.

Finally, calculated the Test accuracy and prediction of the model.

A) Change the train/test ratio I have changed the train/test ratios to 0.2/0.8 & 0.4/0.6 and observed the below changes in the test accuracy.

                  Train     Test	Test Accuracy

Original 70 30 0.927361 Changed values 80 20 0.89416 Changed values 2 60 40 0.8694

From the above table, we can say that the Test accuracy is more with the fewer Test data. If Test data is more, test accuracy is less.

B) Change the number of layers I have added one more layer to the model and removed one to find the comparison with original values and found the below changes.

                Layers    	Test Accuracy

Original 3 0.927 Changed values 1 4 0.866 Changed values 2 2 0.870

C) Change the Dropout ratio I have changed the dropout ratio to 0.4 & 0.6 and observed the below changes in the test accuracy.

                Drop out    Test Accuracy

Original 0.5 0.927 Changed values 1 0.4 0.810 Changed values 2 0.6 0.863

D) Reduce the sampling of negative and neutral tweets I have modified the negative and neutral ratios to 6000 & 6500 and observed the below changes in the test accuracy.

                Negative  Neutral	Test Accuracy

Original 8000 8000 0.927 Changed values 1 6000 6000 0.826 Changed values 2 6500 6500 0.863

E) Change the batch size I have changed the batch size values to 250 & 300 and observed the below changes in the test accuracy.

                Batch size    	Test Accuracy

Original 256 0.927 Changed values 1 250 0.866 Changed values 2 300 0.870

D. Video Link: Submitted in the code File

E. Conclusion:

  1. What you have learned from the ICP - In this ICP, I have learned how to develop a deep learning model, finding the Accuracy, and build the model.

  2. What the challenge you have faced - I didn't face any major challenges while doing the ICP.