Skip to content
awais546 edited this page Oct 17, 2020 · 1 revision

Introduction to Python and Deep Learning

Introduction

In this lab we learned the basics of deep learning and its basic modules. In order to perform deep learning we are using the library Keras and Tensorflow.

Tasks

The tasks to perform in this lab are as follows.

  • Add a dense layer to already made model
  • Change the dataset to breast cancer dataset
  • Transform the data using the StandarScaler library

Dense Layer

Currently the model was working on only two layers. First was the input layer having 8 inputs features and 20 neurons. The loss and accuracy without adding a new layer is shown below.

A new layer is added in between the input layer and the output layer having 8 neurons. To add the dense layer the following code is used.

After adding the screenshot the loss has been decreased and the accuracy has been increased as shown in the following screenshot.

Breast Cancer Dataset

Now a new dataset is introduced to the model. The dataset has different features. First the target column of Malignant and Benign is changed to 1 and 0 respectively. After running the model on this dataset the loss and accuracy is shown below.

We can increase the accuracy and decrease the loss of the model by normalizing the dataset using StandardScaler library. Use the following code on the input features to transform it.

After normalizing the result the loss has been decreased and accuracy has been increased.

Clone this wiki locally