Showing posts with label Keras. Show all posts
Showing posts with label Keras. Show all posts

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 49also 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. 

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. 

Understanding about KERAS


Hi, everyone! I really believe to express my knowledge in pure and simple words!Today we are going to understand about one of the leading DEEP LEARNING library KERAS. We have already learnt about the deep learning concept, machine learning as well, if you did not read, read it first!


Introduction:
In our daily life, library is greatest way to express knowledge as a silence place, when we see it, we observe that it is source of information, collection of book and in a book a lot of information bound. But do you know what is library in computer programming language domain? It is the collection of classes every class has unique features and according to the need we use it. For example Math class library in C# give us a lot of math function without any code.
In python there are many useful library in deep learning concept but Keras in one of them which is one of the most popular library. So, in this Article we will discuss about KERAS!
What is Keras?

Keras is a Python library for deep learning that can run on top of Theanoor TensorFlow. Another simple definition, Keras is an open source neural network library which is written in Python.
For Deep learning concept we use Keras (Python Library) which run on Theano or TensorFlow. We read and understand the concept of deep learning in DEEP LEARNING post, in term of work this library play a vital role. This was made for fast and easy research and development in deep learning concept. It plays on PYTHON 2 or 3, can seamlessly execute on GPUS and CPUs.
Keras contains numerous implementations of commonly used neural network building blocks such as layers, objectives, activation functions, optimizers, and a host of tools to make working with image and text data easier. The code is hosted on GitHub, and community support forums include the GitHub issues page, and a Slack channel.
Several people thing about the concept of Keras is reserved for PYTHON only, but it’s allow user to productive deep models on smartphones (iOS and Android) also, and on we also on Java Virtual Machine.

François Chollet developed Keras, now let's understand the four principles of guiding of Keras.

Principles



Modularity: A model can be understood as a sequence or a graph alone. 
All the concerns of a deep learning model are discrete components that can 
be combined in arbitrary ways.
Minimalism: The library provides just enough to achieve an outcome, no frills 
and maximizing readability.
Extensibility: New components are intentionally easy to add and use within
 the framework, intended for researchers to trial and explore new ideas.
Python: No separate model files with custom file formats. Everything is 
native Python.


Resistance:
According to the latest report 200,000 user on November 2017 move towards Keras, and it was the 10th most citied tool in the KD Nuggets in 2018 software poll and registered a 22% usage.
It also allows use of distributed training of deep learning models on clusters of Graphics Processing Units (GPU).

User Experience.
Large adoption in the industry and research community.
Multi-backend, multi-platform.
Easy productization of models.



How to Install Keras

It is simple and straightforward to install, it is good if you did any work on PYTHON and SciPy before. In your machine setup the THEANO or TENSORFLOW  should be already installed. 

In this installation step we cover both platforms THEANO and TENSORFLOW.
By using PyPi th installation process are very easy;

sudo pip install keras
Recent Version of keras 1.0.0 at the time of writing you wil get, on command line you can also check the version of keras by using command. 
python -c "import keras; print keras -- version --"

the result of above command will be
1.0.0

So, can we upgrade the installation of keras, YES you can by using command 
sudo pip install -upgrade keras



In the upcoming Article we will learn KERAS by using in practical
 project using DISEASE IDENTIFICATION.
 For more update keep in touch!!!

Understanding about KERAS


Hi, everyone! I really believe to express my knowledge in pure and simple words!Today we are going to understand about one of the leading DEEP LEARNING library KERAS. We have already learnt about the deep learning concept, machine learning as well, if you did not read, read it first!


Introduction:
In our daily life, library is greatest way to express knowledge as a silence place, when we see it, we observe that it is source of information, collection of book and in a book a lot of information bound. But do you know what is library in computer programming language domain? It is the collection of classes every class has unique features and according to the need we use it. For example Math class library in C# give us a lot of math function without any code.
In python there are many useful library in deep learning concept but Keras in one of them which is one of the most popular library. So, in this Article we will discuss about KERAS!
What is Keras?

Keras is a Python library for deep learning that can run on top of Theano or TensorFlow. Another simple definition, Keras is an open source neural network library which is written in Python.
For Deep learning concept we use Keras (Python Library) which run on Theano or TensorFlow. We read and understand the concept of deep learning in DEEP LEARNING post, in term of work this library play a vital role. This was made for fast and easy research and development in deep learning concept. It plays on PYTHON 2 or 3, can seamlessly execute on GPUS and CPUs.
Keras contains numerous implementations of commonly used neural network building blocks such as layers, objectives, activation functions, optimizers, and a host of tools to make working with image and text data easier. The code is hosted on GitHub, and community support forums include the GitHub issues page, and a Slack channel.
Several people thing about the concept of Keras is reserved for PYTHON only, but it’s allow user to productive deep models on smartphones (iOS and Android) also, and on we also on Java Virtual Machine.

François Chollet developed Keras, now let's understand the four principles of guiding of Keras.

Principles



Modularity: A model can be understood as a sequence or a graph alone. 
All the concerns of a deep learning model are discrete components that can 
be combined in arbitrary ways.
Minimalism: The library provides just enough to achieve an outcome, no frills 
and maximizing readability.
Extensibility: New components are intentionally easy to add and use within
 the framework, intended for researchers to trial and explore new ideas.
Python: No separate model files with custom file formats. Everything is 
native Python.


Resistance:
According to the latest report 200,000 user on November 2017 move towards Keras, and it was the 10th most citied tool in the KD Nuggets in 2018 software poll and registered a 22% usage.
It also allows use of distributed training of deep learning models on clusters of Graphics Processing Units (GPU).

User Experience.
Large adoption in the industry and research community.
Multi-backend, multi-platform.
Easy productization of models.



How to Install Keras

It is simple and straightforward to install, it is good if you did any work on PYTHON and SciPy before. In your machine setup the THEANO or TENSORFLOW  should be already installed. 

In this installation step we cover both platforms THEANO and TENSORFLOW.
By using PyPi th installation process are very easy;

sudo pip install keras
Recent Version of keras 1.0.0 at the time of writing you wil get, on command line you can also check the version of keras by using command. 
python -c "import keras; print keras -- version --"

the result of above command will be
1.0.0

So, can we upgrade the installation of keras, YES you can by using command 
sudo pip install -upgrade keras



In the upcoming Article we will learn KERAS by using in practical
 project using DISEASE IDENTIFICATION.
 For more update keep in touch!!!