DL Icp3 - PardhaSaradhi74/Python GitHub Wiki

NAME

RAMINENI,PARDHA SARADHI

CLASS ID

32

SOURCE CODE

https://umkc.box.com/s/3so2s3dx7cjp4hwnurjx6t3it161ptey

In class programming:

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

2.Add embedding layer to the model, did you experience any improvement?

3.Apply the codeon 20_newsgroup data set we worked in the previous classesfromsklearn.datasets importfetch_20newsgroupsnewsgroups_train =fetch_20newsgroups(subset='train', shuffle=True, categories=categories,)

Bonus question

1.Plot the loss and accuracy using history object

2.Predict over one sample of data and check what will be the prediction for that

ANSWER))

There are three mistakes in the given source code.

The input dimension value is missing and since we have 2000 number words, the input_dim is given as 2000.

The output neurons should be 3 as there are three values in the target column of dataset.

The activation function should be Softmax as it works better for the Multi class classification compared to Sigmoid.

For task2 We applied the one embedding layer and observed the Loss and Accuracy values. The Loss value decreased from 0.5 to 0.4 and Accuracy value dropped from 0.50 to 0.49.

For Task3 We applied the same process for the News group dataset and calculated the Accuracy and Loss values.