Diseases Identification (Cancer) using Deep Learning (Keras library)

Hi, As I mention in the previous Article Understand about Keras,
 now in this Article we will understand about the Keras library
 work how does it work and how does is it install on your
machine, in a Project name by
Cancer Classification using Deep learning (Keras).

Classification Concept:

         Classification work on identification by using deep learning concept. For example by picture we can identify the gender similarly by picture we can identify the person is happy, normal or sad!!! The concept of classification we want to use on cancer disease using DNA dataset. In this Article, I predict by using deep learning (Keras library) the patient has cancer or not through it DNA dataset or gene. For this DNA data set download form www.Kaggle.com, in the data set the feature expectation through the gene (gene_1 to gene_49) including the five classes namely (BRCA, KIRC, COAD, LUAD, PRAD). By using these gene order and classes this project’s Article predict about the cancer is active or not.

       For implementation Python is the better choice, either R can be an alternative choice. I used also jupyter notebook for coding as well. But first we need to install KERAS for data handling which is deep learning library which I separately publish my Article on it, if you did not read you need to read it first Understandingabout Keras. Now the installation process should be like

$ pip install keras
Similarity for jupyter notebook installation,
$ jupyter notebook

       Now, move towards the working on Project using Keras, the coding of project as like this:

from keras.models import Sequential
from keras.layers import Dense
import numpy

        We will use numpy (library) to load data - there are septrients from data columns
To load the data we need to use NUMPY library, for separation we use delimiter, code will be like;

dataset = numpy.loadtxt("DNA_Dataset.csv", delimiter=’,’)

       As we know about the deep learning Data training, divide the existing data into two part TRAINING DATA AND TESTING DATA, the exist record consist on 391Rows * 44Columns. Separate 70% date for Training and 30% for Testing.

X = dataset[:274,0:8]
Y = dataset[:274,8]
X_test = dataset[274:,0:8]
Y_test = dataset[274:,8]

       Now, we will move towards Keras model for this we will use Dense and in this Dense the quantity of INPUT and HIDDEN nodes can be inserted.

model = Sequential()
model.add(Dense(12, input_dim=8, init='uniform', activation='relu'))
model.add(Dense(8, init='uniform', activation='relu'))
model.add(Dense(1, init='uniform', activation='sigmoid'))

       At that point we need to create different layer there are 4 Layers but it is depend on your problem for identification. In the first line it is an input layer which is consist on x nodes (depend on features which is define before gene 1 to 49 also classes of identification namely (BRCA, KIRC, COAD, LUAD, PRAD)), then Hidden layer consist on 12 nodes (may be vary). Then we will create another Hidden layer on which 8 nodes exist. At last there is an output layer on which 1 node exit signed Sigmoid of its Activation Function because the problem is BINARY CLASSIFICATION.
Now, it time to compile the model.

model.compile(loss='binary_crossentropy',optimizer='adam',metrics=['accuracy'])

   We chose binary cross entropy for the loss function as it is based on the Binary classification - we will call fit to start training.

model.fit(X, Y, nb_epoch=150, batch_size=10,  verbose=2)

      We got fit data and labels - with this number of epoch or iteration kept 150 - via batch size we told that gradient descent will update weights after ten inputs - in the next step we examined the test data on next level.

scores = model.evaluate(X_test, Y_test)
print("\n%s:%.2f%%"% (model.metrics_names[1], scores[1]*100))

Result:

      We got between (70% to 75%) result accuracy, here in this project 74.35% got to predict the Cancer disease is active or not in the patient using DNA data set (gene) using 5 classes.

I am hopeful it will be very helpful for you understand the working of 
Keras in Project base work To download the exist data set which is
used in this project ClickToDownlaod. 

No comments:

Post a Comment

Fell free to write your query in comment. Your Comments will be fully encouraged.