ICP_8 DeepLearning - acvc279/Python_Deeplearning GitHub Wiki

VIDEO LINK: https://drive.google.com/file/d/1n5QSIbQS90GQSFTA4rYoKjNxryG881Ff/view?usp=drivesdk

###Q1: Use the use case in the class Add more Dense layers to the existing code and check how the accuracy changes. Imported all the required libraries and then load data. perform Train test split on the data and also perform Sequential Model:

my_first_nn = Sequential() # create model
my_first_nn.add(Dense(20, input_dim=8, activation='relu')) # hidden layer
my_first_nn.add(Dense(1, activation='sigmoid')) # output layer

Perform complition:

my_first_nn_fitted = my_first_nn.fit(X_train, Y_train, epochs=100, initial_epoch=0)

Then print the accuracy with summary:

print(my_first_nn.evaluate(X_test, Y_test))

Then perform the dense layer for three times. From the output, we observed that Accuracy is increasing after performing dense layer From first to Fourth Layer is 66%,69%,71%,73%

Q2 Change the data source to Breast Cancer dataset available in the source code folder and make required changes. Report accuracy of the model.

Imported all the required libraries and load the data. Convert the strings to 0 and 1. Implement train test split on the data. Implement sequentional model:

my_first_nn = Sequential() # create model
my_first_nn.add(Dense(20, input_dim=29, activation='relu')) # hidden layer
my_first_nn.add(Dense(1, activation='sigmoid')) # output layer

Implement complilation;

my_first_nn_fitted = my_first_nn.fit(X_train, Y_train, epochs=100,initial_epoch=0)

then print the accuracy with summary and we got 90% accurcy with 47% data loss. Again perform Sequentional model to find accuraccy and we got the improved acuuraccy of 93% with 26% loss.

Q3: Normalize the data before feeding the data to the model and check how the normalization change your accuracy.

Repeact all the process of Q2 up to sequential model and then perform normalization using standard scaler:

S = StandardScaler()
#Fitting the data
S.fit(x)
x_normalization = S.transform(x)
y = cancer_data['diagnosis']
X_train, X_test, Y_train, Y_test = train_test_split(x_normalization, y,test_size=0.25, random_state=87)

Then perform sequentional model and we got hte accuraccy of 95% with only 14% of loss. In these we observed, After normalization the accuraccy will increase with decrease loss. Learned from the ICp: Keras