DL_ICP1 - Saiaishwaryapuppala/CSEE5590_python_Icp GitHub Wiki

Python and Deep Learning: Special Topics

Rajeshwari Sai Aishwarya Puppala

Student ID: 16298162

Class ID: 35

Deep Learning-In class programming: 1

Objectives:

1.Use the use case in the class:

a.Add more Dense layers to the existing code and check how the accuracy changes.

2.Change the data source to Breast Cancer dataset * available in the source folder and make required changes

3.Normalize the data before feeding the data to the model and check how the normalization change your accuracy (code given below).fromsklearn.preprocessing import StandardScaler sc =StandardScaler() Breast Cancerdataset is designated to predict if a patient has Malignant (M) or Benign = Bcancer

Add Dense Layer

  • Import all the packages which are needed like path, pandas, sequential, dense and activation from Keras
  • Load the diabetes dataset into a data frame
  • Divide the dataset into train and test using train_test_split with the test size of 25%
  • Initially, there was only one hidden layer and the accuracy was 61.5%
  • After adding 2 hidden layers and changing the number of units(dimensionality of the output space) to 40
  • The Accuracy got increased to 62.6%
  • Tried with different options of hidden layers but adding this 2 hidden layers has improved the accuracy.

Code

Output

Accuracy for Initial Neural network

Accuracy After adding a hidden layer

Breast Cancer Dataset

  • Import all the packages which are needed like path, pandas, sequential, dense and activation from Keras
  • Load the breast cancer dataset into a data frame
  • Before the splitting of train and test split the target feature values are in the string , a neural network takes only numerical values so the feature has to be encoded. Since the feature is binary class so I have assigned the 2 classes with 0 and 1.
  • Divide the dataset into train and test using train_test_split with the test size of 25%
  • Add 4 hidden layers and changing the number of units(dimensionality of the output space)
  • The Accuracy is 17.8%
  • Sub-plotted the values using a confusion matrix.

Code

Output