You are on page 1of 74

MEDDOC – A DISEASE ANALYZING SOFTWARE

A Project Report Submitted

in Partial Fulfillment of the Requirements

for the Degree of

BACHELOR OF TECHNOLOGY
in

Computer Science and Engineering

by
ADITI SHUKLA (1834810006)

ALSHIFA SABIR (1834810011)

ANYA SHUKLA (1834810018)

DEEKSHA KATIYAR (1834810031)

KAUSHIKI KATIYAR (1834810042)

Under the Supervision of

Mr. Abhay Kumar Tripathi

(Assistant Professor)

PSIT COLLEGE OF ENGINEERING, KANPUR


To the

Department of Computer Science and


Engineering
Dr. A.P.J. Abdul Kalam Technical University, Lucknow
May 2022
MEDDOC – A DISEASE ANALYZING SOFTWARE
A Project Report Submitted

in Partial Fulfillment of the Requirements

for the Degree of

BACHELOR OF TECHNOLOGY
in

Computer Science and Engineering

by
ADITI SHUKLA (1834810006)

ALSHIFA SABIR (1834810011)

ANYA SHUKLA (1834810018)

DEEKSHA KATIYAR (1834810031)

KAUSHIKI KATIYAR (1834810042)

Under the Supervision of

Mr. Abhay Kumar Tripathi

(Assistant Professor)

PSIT COLLEGE OF ENGINEERING, KANPUR


To the

Department of Computer Science and


Engineering
Dr. A.P.J. Abdul Kalam Technical University, Lucknow
May 2022
DECLARATION

We hereby declare that this submission is our own work and that, to the best of our
knowledge and belief, it contains no material previously published or written by another
person nor material which to a substantial extent has been accepted for the award of any
other degree or diploma of the university or other institute of higher learning, except where
due acknowledgment has been made in the text.

Signature:
Name : ADITI SHUKLA
Roll No : 1834810006
Date :

Signature:
Name : ALSHIFA SABIR
Roll No : 1834810011
Date :

Signature:
Name : ANYA SHUKLA
Roll No : 1834810018
Date :

Signature:
Name : DEEKSHA KATIYAR
Roll No : 1834810031
Date :

i
Signature:
Name : KAUSHIKI KATIYAR
Roll No 1834810042
Date :

i
CERTIFICATE

This is to certify that Project Report entitled “MEDDOC – A Disease Analyzing


Software” which is submitted by
ADITI SHUKLA (1834810006)
ALSHIFA SABIR (1834810011)
ANYA SHUKLA (1834810018)
DEEKSHA KATIYAR (1834810031)
KAUSHIKI KATIYAR (1834810042)

in partial fulfillment of the requirement for the award of degree B. Tech. in the
Department of Computer Science and Engineering of PSIT College of Engineering
affiliated to Dr. A.P.J. Abdul Kalam Technical University, is a record of the candidate's
own work carried out by him under my/our supervision. The matter embodied in this thesis
is original and has not been submitted for the award of any other degree.

Head of Department Signature Guide signature

Name: Mr. Pradeep Rai Name: Mr. Abhay Kumar Tripathi

i
ACKNOWLEDGEMENT

It gives us a great sense of pleasure to present the report of the B. Tech Project undertaken
during B. Tech. Final Year. We owe special debt of gratitude to Mr. Abhay Kumar
Tripathi (Assistant Professor, CSE), Department of Computer Science & Engineering,
PSIT College of Engineering, affiliated to AKTU, Lucknow for his constant support and
guidance throughout the course of our work. His sincerity, thoroughness and perseverance
have been a constant source of inspiration for us. It is only his cognizant efforts that our
endeavors have seen light of the day.

We also take the opportunity to acknowledge the contribution of Mr. Pradeep Rai
(Assistant Professor), Head, Department of Computer Science & Engineering, PSIT
College of Engineering, affiliated to AKTU, Lucknow for his full support and assistance
during the development of the project.

We also do not like to miss the opportunity to acknowledge the contribution of all faculty
members of the department for their kind assistance and cooperation during the
development of our project. Last but not the least, I acknowledge our friends & family for
their contribution in the completion of the project.

Signature:
Name : ADITI SHUKLA
Roll No 1834810006
Date :

Signature:
Name : ALSHIFA SABIR
Roll No 1834810011
Date :

Signature:
Name : ANYA SHUKLA
Roll No 1834810018

i
Date :

Signature:
Name : DEEKSHA KATIYAR
Roll No 1834810031
Date :

Signature:

Name : KAUSHIKI KATIYAR

Roll No. : 1834810042

Date :

v
ABSTRACT

Adaptation of information technology has led to the creation of several applications in the
field of health informatics. Health informatics generates large amounts of data. This data
can be processed using data mining techniques to predict disease. Some data mining
techniques include clustering, association, prediction, classification. Compare different
data mining tools to validate medical data and predict disease. One of the most important
topics in society is health. They are looking for the most reliable disease diagnosis to get
the help they need as soon as possible. Other fields, such as statistics and computer
science, are important for the medical aspect of search. This is because often these
perceptions are difficult. Following a new approach is a challenge that goes beyond the
established realms of these realms. The actual number of new methods allows for a broad
overview while avoiding certain aspects. As a result, we suggest a systematic analysis of
human diseases related to machine learning. This research focuses on existing methods
related to the rise of machine learning to be applied in diagnosing human diseases in the
medical field to detect interesting trends, make unimportant predictions and aid decision-
making. This report analyses unique machine learning algorithms used for healthcare
applications to create adequate decision support. This report intends to reduce the research
gap in creating a realistic decision support system for medical applications.

v
TABLE OF CONTENT
Page
DECLARATION..............................................................................................................ii

CERTIFICATE.................................................................................................................iii

ACKNOWLEDGEMENTS..............................................................................................iv

ABSTRACT......................................................................................................................v

TABLE OF CONTENT....................................................................................................vi

CHAPTER 1: INTRODUCTION......................................................................................1

1.1 OBJECTIVE …………………………………………………………… 5

1.2 PREVIOUS ATTEMPT ………………………………………………… 6

1.3 RELATED WORK ……………………………………………………… 7

1.4 LITERATURE FINDING..................................................................................8

1.5 SCOPE AND IMPORTANCE OF THE PROJECT.........................................10

CHAPTER 2: PYTHON (LANGUAGE USED).................................................................12

2.1 PYTHON INTRODUCTION...........................................................................12

2.2 WHY DO PEOPLE USE PYTHON?...............................................................13

2.3 FEATURES.......................................................................................................14

2.4 PYTHON CODE EXECUTION......................................................................15

2.5 WHAT CAN WE DO WITH PYTHON..........................................................16

2.6 CODE SAMPLE..............................................................................................17

CHAPTER 3: TECHNOLOGY USED AND BASIC WORKING.....................................18


v
3.1 INTRODUCTION TO DEEP LEARNING......................................................18

3.2 HISTORY OF DEEP LEARNING...................................................................19

3.3 TYPES OF DEEP LEARNING........................................................................22

3.4 WHY DEEP LEARNING.................................................................................26

3.5 HOW DEEP LEARNING WORKS..................................................................29

CHAPTER 4: NEURAL NETWORK................................................................................30

4.1 DEFINITION.....................................................................................................30

4.2 A FEW CONCRETE EXAMPLES...................................................................31

4.3 CLASSIFICATION...........................................................................................31

4.4 PREDICTIVE ANALYSIS................................................................................39

CHAPTER 5: CODING.......................................................................................................42

5.1 PREPROCESSING DATA................................................................................42

5.2 PYTHON LIBRARIES USED..........................................................................45

5.3 CODE...............................................................................................................47

5.4 TESTING..........................................................................................................54

CHAPTER 6: CONCLUSION.........................................................................................60

6.1 FUTURE SCOPE.............................................................................................60

REFERENCE.....................................................................................................................61

CERTIFICATE OF PLAGIARISM...................................................................................62

AUTHOR’S DETAILS......................................................................................................63

v
CHAPTER-1

INTRODUCTION

This Web-app is developed using Flask Web-Framework. The models used to predict the
disease are trained on large Datasets. All links for datasets and the python notebook used
for model creation are mentioned below in this readme. There are alot concerns about
increasing reliance on technology. Nevertheless, as a society, we continue to push
technology to new heights. From how we order food items to how we provide healthcare,
machine learning, and artificial intelligence continue to help us surpass our wildest dreams.
These are some of advantages:

This is very important, especially if early detection and treatment can bring the best results.
Using this algorithm can literally save lives.

Some universities have found through the creation of databases that their artificial
intelligence can do as well as a doctor in the diagnosis process but also do better in early
detection. AI can also give diagnosis suggestions based on the structured data entered by
symptom, give medication suggestions based on the diagnosis code, and predict adverse
drug reactions based on other medication taken.

Organizations like Health Catalyst are using AI to reduce hospital-acquired infections


(HAIs).

Early detection of these dangerous infections can reduce the mortality and morbidity
associated with them.

Using ML, companies are crowdsourcing to better understand healthcare issues. Having a
large. These research methods have become more accessible to people in marginalized
communities who otherwise would not be able to participate. Finally, participating in
research helps patients feel more capable while providing meaningful feedback.

Machine is used to improve medication from anesthesia to breast cancer treatment to daily
medication. The famous IBM supercomputer Watson is working with companies such as
Pfizer to enhance drug discovery, especially for immune disease and cancer. Google has
been involved for several years and found that machine learning has impressive potential
in guiding and in improving treatment ideas. Personalized medicine is also a way to treat

1
patients in the future, and machine learning is helping to personalize patients’ feedback on
their medication.

A web application can predict the following diseases:

 Brain Tumor
 Malaria
 Pneumonia

Models with their Accuracy of Prediction

Disease Type of Model Accurac


y62

Brain Tumor Deep Learning Model (CNN) 94.02%

Malaria Deep Learning Model (CNN) 95.06%

Pneumonia Deep Learning Model (CNN) 91.28%

1. Brain Tumor
Deep learning (a sub-discipline of machine learning) has been gaining prominence in
almost every field related to decision-making in recent years, including economics,
healthcare, marketing, and sales. In the healthcare field, machine learning and deep
learning are showing promising results in various fields such as disease diagnosis using
medical images, surgical robots, and improvement of hospital efficiency. One of the deep
learning applications for detecting brain tumors in

MRI images.

2
Tools and Libraries used

Brain tumor detection project uses the below libraries and frameworks:

● Python – 3.x
● TensorFlow – 2.4.1
● Keras – 2.4.0
● Numpy – 1.19.2
● Steps to Develop Brain Tumor Classifier in Machine Learning
● Our approach to building the classifier is discussed in the steps:
● Perform Exploratory Data Analysis (EDA) on brain tumor dataset
● Build a CNN model
● Train and evaluate our model on the dataset

2. Malaria
Malaria is a contagious disease that affects millions of lives per year. Traditional diagnosis
of malaria in the laboratory requires an experienced person and careful inspection to
discriminate between healthy and infected red blood cells (RBCs).

Machine learning algorithms also aid humans to process huge and complex medical
datasets and then analyze them into clinical insights.

Cognitive computing replicates the way humans solve problems while artificial
intelligence and machine learning techniques search for creating novel ways for solving
problems that humans can potentially do better. Research has been done during the last
decades using ML algorithms for cost effective solutions to support healthcare to reduce
diseases. Malaria originated from the Plasmodium parasite through mosquito-borne
infection. Malaria is very common worldwide, mainly in tropical regions.

3
Tools and Libraries used

Malaria tumor detection project uses the below libraries and frameworks:

3. Python – 3.x
4. TensorFlow – 2.4.1
5. Keras – 2.4.0
6. Numpy – 1.19.2

3. Pneumonia
Pneumonia is a form of an acute respiratory infection that affects the lungs. The lungs are
made up of small sacs called alveoli, which fill with air when a healthy person breathes.
When an individual has pneumonia, the alveoli are filled with pus and fluid, which makes
breathing painful and limits oxygen intake.Pneumonia is the single largest infectious cause
of death in children worldwide. Pneumonia killed 808 694 children under the age of 5 in
2017, accounting for 15% of all deaths of children under five years old. Pneumonia affects
children and families everywhere but is most prevalent in South Asia and subSaharan
Africa.

Tools and Libraries used

Pneumonia tumor detection project uses the below libraries and frameworks:

7. Python – 3.x
8. TensorFlow – 2.4.1
9. Keras – 2.4.0
10. Numpy – 1.19.2

4
1.1 OBJECTIVE

The report aims to contribute to the development of technologies related to Machine


Learning applied to medicine by building a project where a neural network model can give
a diagnosis from a chest xray image of a patient and explain its functioning as simply as
possible. As we are going to deal mainly with lung related issues, it’s appropriate to know
more about what they really are, in addition to their causes, effects, and history.

Respiratory illnesses are the ones that affect the respiratory system, which are responsible
for the production of oxygen to feed the body. These illnesses are produced by infections,
smoke inhalation, and exposure to substances such as redon, asbestos… To this group of
illnesses belongs illnesses such as asthma, pneumonia, tuberculosis, and Covid19.

The big epidemic belonging to this group of illnesses was the one produced by tuberculosis
that affected the lungs. This epidemic is caused by the unacceptable working conditions of
the Industrial Revolution. This health problem has been known for centuries, but it was the
moment when it was first recognized as a huge health problem that caused many deaths
and significant losses. Respiratory disorders began to be treated in the early 19th century
by the French physician René Theophile Hyacinth, who invented the stethoscope. Since
then, measures against these diseases have been divided into prevention (vaccination) and
medical care for patients.

Covid19, which has had a major impact on our world over the past two years, is one of the
respiratory diseases caused by the SARSCoV2 virus that affects the respiratory system. It
is spread by airborne droplets and droplets released when talking, sneezing or coughing. It
first appeared in Wuhan, China in December 2019 and spread rapidly around the world
until March 11, 2020, when the WHO declared a pandemic.

5
1.2 PREVIOUS ATTEMPT

Decades ago, artificial intelligence (AI) became the paradigm underlying many computing
projects that could be applied to various areas of our lives. One of them is Health, and the
influence of AI is growing day by day. Moreover, no one knows the boundaries of this area
today. Due to the current global pandemic situation, AI has also been applied to treat
Covid19 disease. In this paper, we propose a chest X-ray image classification system using
machine learning. Specifically, we implemented a deep learning prototype to perform that
image recognition. More precisely, it consists of several layers of convolutional artificial
neurons and a series of dense layers of neurons (multilayer perceptrons).

Results Classification accuracy exceeded 95% using images not entered into the system. In
addition, recently artificial vision techniques, especially image analysis belonging to
GradCAM, have been demonstrated, which is an attempt to return the most important
regions of images used by convolutional neural networks in classification tasks. At this
time, it has not been confirmed whether the sites obtained with GradCAM are similar to
the sites used by lung disease specialists to diagnose pneumonia.

“Covid net”, is a free access model which lets researchers improve the AI tool that detects
SARSCoV2. The target of this AI network is to promote the development of highly
accurate and practical deep learning solutions to detect COVID19 cases and accelerate the
treatment of those most in need. In conclusion, due to the lack of laboratory analysis kits,
in addition to delayed results and limited resources, AI would be a valuable tool for health
systems and patients.

To solve the problem of classifying a patient’s chest x ray image providing an accurate
diagnostic, as we discussed earlier, we will use an Artificial Intelligence technique called
Convolutional Neural Networks. This kind of network consists of an algorithm that takes
an image as input and detects a set of visual features for which it has been trained. The
goal of this particular project is to classify the input image according to one of the five
diagnoses our model can perform. Thus, the network uses the recognized features of the
image to feed a classical fully connected neural network and obtains probabilistic
predictions for the five different classes that the image may belong to as output. The class
with the highest activation (probability) is the class that the model chooses as the correct
diagnosis for the x-ray image.

6
1.3 RELATED WORK

Before starting the experiment, we studied how people learn about disease prediction so
that they can broaden their horizons and learn. In 2011, Ujma Ansari used a decision tree
model to predict heart disease and achieved a high accuracy of 99%. This inspires us to use
the best version of the decision tree, which is a random forest. Unfortunately this article
uses a dataset with 3000 instances, but doesn't provide a link on how to get the data. The
UCI website only provides 303 dataset instances, so I'm curious how the author got 3000
dataset instances. In 2012, Chaitrali S. Dangare performed predictions using three models:
Naive Bayes, Decision Trees, and Neural Networks. We are using the same data set as that.
The difference between his work and ours is that he added two more features to the dataset.
This means that his work has 15 features and our dataset has 13 features. There is not much
difference between 13 and 15 features in his work, but what he did with the dataset inspires
us to make useful changes to the dataset (trying to normalize the dataset) to thoroughly
refine our results. However, at the time of this writing, only three models exist. More
models need to be considered to draw conclusions. In 2017, Kaan Uyar and Ahmet İlhan
used the same experiments and the same datasets we used for the project. During the
analysis, "The rating distribution is interpreted as 54% heart disease and 46% heart
disease." The data set I'm loading from Kaggle has 54% 1s and 46% 0s in the target
column. From their analysis, we understand that 1 indicates no heart disease and vice
versa. To make this easier to understand, we display a confusion matrix in the results by
swapping 1's and 0's in the target column so that 1 represents the presence of heart disease.
Studying articles , we learned that the strengths of neural networks are their fault tolerance
and ability to work with inadequate human knowledge. So, in our project, we decided to
spend some time using neural networks to detect heart disease.

7
1.4 LITERATURE FINDING

Convolutional neural networks represent a growing field within the literature. Our search
found 10 studies that detailed the methodology of segmentation involving convolutional
neural networks. The methodology examined in this review will be divided into
subsections relating each step of the segmentation process. The main findings will be
reported. An example segmentation algorithm will be proposed based on the findings from
the literature. The main output metric is the Sorensen-Dyes Coefficient (DSC) and is
calculated as:

DSC = 2∣X∩Y∣||X|+∣Y∣

The (X) represents the cardinal element in the first set (automatic segmentation), and (Y)
represents the second set, generally the manually segmented set that the automatic
segmentation set is tested against. The ⋂ symbol represents where the segmentations
intersect. Where DSC is not reported, and the accuracy will be used. Table first reports the
main finding of studies involving CNNs.

For the training set, most studies used the Multimodal Brain Tumor Segmentation
benchmark which is a dataset of manually segmented MRIs containing high-grade and low-
grade gliomas set up by the Medical Image Computing and Computer assisted Interventions.
Only one study used a training set from their own institutions. This study negated the need
for initial manual segmentation due to using a watershed algorithm which automatically
segmented the training dataset. This improved the accuracy of segmentation from 82 to 89%
and could be used for the development of future CNNs.

Specifics of Convolution layers were not detailed Extensively. This is partly because
feature extraction involves multiple algorithms and multiple methodologies. For example,
Perkuhn et al. used 53 kernels for feature extraction in four convolutional layers. It would
be difficult to summarize such extensive and numerous convolution methodology.

Overfitting was done in a variety of ways. Three articles did not correct or did not report
details of overfitting. The majority of overfitting was done via down sampling. This
involves reducing the resolution of the image in order to reduce interpretation of irrelevant
fine details within the training dataset. Pereira et al.

Various algorithms have been used to correct for nonlinearity. These include Leakage
Rectifier Blocks, Maximum Nonlinearity, Noisy Rectifier Linear Blocks, Rectified Linear
Blocks, and Parametric Rectified Linear Blocks, which are modifications of traditional
rectified linear blocks. One study used three modifications: a leak rectifier device, a
Softmax function, and a hyperbolic tangent function. Two studies did not report on applied
nonlinear corrections.

8
An example of a segmentation process was developed based on a literature search.
Segmentation process should be fully automated and in ideal situations be performed in
institutions with the same scanner protocols given discrepancies that would affect the
segmentation process . However, this would negate the generalisability to other contexts
and CNNs need to be optimized for the multi institutional context. Normalization of image
could be done by methods proposed in the BraTS segmentation challenge. This was done
by standardizing multi institutional images to 1 × 1 × 1 mm voxel parameters which were
then skull stripped. This initial training input can be done via the watershed algorithm
which has been shown to have superior segmentation potential than manual segmentation .
ElasticTransformation (NNET) nearest neighbor resampling UNet deep convolution
algorithm proposed by Hasan et al. It represents an increase in DSC, so it can be applied to
the initial filter. The overfitting can be improved using the ELOBA_λ algorithm proposed
by Naceur et al. It showed DSCs of 0.89, 0.76 and 0.81 for whole tumor, tumor core and
expanded tumor, respectively. The FLAIR volume can be split using the proposed method
as the DSC reports 0.917 for the FLAIR high intensity volume. Nonlinearity correction has
not been extensively studied which cannot be recommended.

Fig 1.1

For this image, the model makes the following predictions: A set of values before

means that the processed image has a 0.001% chance of bacterial pneumonia and a
99.925% chance of Covid. , 0.005% probability for the normal class, 0.066% probability
for the tuberculosis class, and 0.001% probability for the viral pneumonia class.

9
1.5 SCOPE AND IMPORTANCE OF PROJECT

The main application of disease segmentation in the clinical sphere is quantitative image
analysis. diseases have traditionally been analyzed qualitatively through inspection, and
this has given rise to an elaborate feature lexicon summarized by projects such as Visually
Access Rembrandt Images. Radiomics is a field focused on quantitative feature analysis.
This field is focused on extracting voxel and volume features of the disease habitat and
predicting clinical outcomes such as survival. It has been used to grade disease, evaluate
response to therapy and predict genetic status of GBM—for example, isocitrate
dehydrogenase status in GBM, which is of clinical significance since negative status (or
‘wildtype’) implies a more aggressive disease. The segmentation and processes involved in
extraction can be translated into meaningful analysis in the radio mix. Radiologic features
such as shape, texture, strength and structure of microvascular structures have been
extensively studied in GBM.

Shape represents the most extensively studied radiomic feature. Filtration matrices which
are applied during the convolution of image during the segmentation process can
subsequently be used to predict clinical outcomes like survival. For example, in a study by
Sanghani et al, 2200 shape, volumetric, and texture features were extracted from 163
patients. Using kernels for each feature, i.e. shape, volume, prediction, texture of overall
survival was sorted into groups with short (< 10 months), medium (10–15 months), and
long (> 15 months) term survival with 88.95% accuracy. In the same study, prediction of
long (> 400 days) and short (< 400 days) was shown to have a higher accuracy of 98.8%.
This demonstrates the novelty of radio mix and the importance of translating segmentation
algorithms into radiology in predicting clinical outcomes.

Other applications are in treatment planning, particularly for radiation therapy and targeted
chemotherapy. Assessment of the microvascular structure in malaria can be performed
using fractal analysis, which evaluates repeating patterns of vasculature that are not readily
represented by simple Euclidean geometry. A sensitivity-weighted imaging (SWI) study of
malaria vasculature showed a decrease in fractal dose after treatment with an
antiangiogenic drug (bevacizumab). The figure shows the modeling of the tumor
vasculature in the FracLac program. This shows the applicability of quantitative analysis to
predict tumor response to treatment. Similarly, the volume and signs of disease, such as
edema, bed, and necrosis, can be distinguished to indicate response to radiation therapy.
This represents a new use of the segmentation process to generate meaningful results that
impact clinical practice.

Machine learning plays an important role in automating quantitative analysis of images.


The data set is trained using feature extraction from the training data set, which requires
fixed parameter inputs. Machine learning with multiple iterations can provide more
accurate results than standard voxel-based manipulation methods. Survival prediction for

1
short-, medium-, and long-term survival classifications showed intermediate accuracy of
up to 57.8% using ensemble learning (a combination of multiple machine learning
algorithms) in a study of nine types of deep learning models. Further work is required in
this area to investigate the survival model with the best predictive machine learning, which
can be achieved by converting segmentation feature extraction and modeling into radio
mix.

1
CHAPTER-2
PYTHON (LANGUAGE USED)

2.1 INTRODUCTION TO PYTHON

Python is a widely used high level, general purpose, interpreted, dynamic programming
language. Its design philosophy emphasizes code readability, and its syntax allows
programmers to express concepts in fewer lines of code than would be possible in
languages such as C++ or Java. The language provides constructs intended to enable clear
programs on both a small and large scale. Python supports multiple programming
paradigms, including object oriented, imperative, and functional programming or
procedural styles. It features a dynamic type of system and automatic memory
management and has a large and comprehensive standard library. The Python interpreter
can be installed on a variety of operating systems, so you can run your Python code on a
variety of systems.

1
2.2 WHY DO PEOPLE USE PYTHON?
The primary factors cited by Python users seem to be these:

● Python is object oriented. Structure supports such concepts as abstraction


polymorphism, operation overloading, and multiple inheritance.
● Indentation is the great future in Python.
● It’s open source(free) Downloading and installing Python is free and easy Source
code is easily accessible
● It’s powerful Dynamic typing Built-in types and tools Library utilities and Third-
party utilities (NumPy, SciPy) Automatic memory management
● Its portable Python runs virtually every major platform used today. As long as you
have a compatible Python interpreter installed, Python programs will run in the
same manner, irrespective of any platform.
● Python runs on multiple platforms such as (Windows, Mac, Linux, Raspberry Pi,
etc.).
● Python has a simple syntax like English.
● The Python syntax allows developers to write programs in fewer lines than in other
programming languages available.
● Python runs on the interpreter machine. That means that code can be executed as
soon as it is written. This means prototyping can be very fast.
● Python can be viewed procedurally, object-oriented, or functionally.

1
2.3 FEATURES

● Easy To Learn & Use While Coding


● Extensible Feature

● Interpreted Language Expressive Language
Cross-Platform Portable Language Dynamic Memory Allocation High-Level Interpreted Language

Graphical User Interface (GUI) Support: Object-Oriented Language
● Open Source Programming Language Large Standard Library
● Easy To Integrate
● Embeddable




1
2.4 PYTHON CODE EXECUTION

Traditional runtime Python execution model: The source code you enter is converted to
bytecode and then executed in the Python virtual machine. Code is automatically compiled
but interpreted.

Fig 2.1

Source Code Extension - .py

Bytecode Extension - .pyc (compiled Python code)

Python is also part of the software called an interpreter. An interpreter is a program needed to run
Python code and scripts. Technically, an interpreter is a software layer that works between a
program and computer hardware to make code work.

1
2.5 WHAT CAN WE DO WITH PYTHON?
● System programming
● Graphical User Interface Programming
● Internet Scripting
● Component Integration 6
● Database Programming
● Gaming, Images, XML , Robot and mor
● Python can be used on a server to create web applications.
● Python can be used alongside software to create workflows.
● Python can connect to database systems. It can also read and modify files.
● Python can be used to handle big data and perform complex mathematics.
● Python can be used for rapid prototyping, or for production-ready software
development.

1
2.6 CODE SAMPLE

Fig 2.2

Suppose the above python program is saved as YourName.py. Here first is the name and
.py is the extension. The execution of the Python program involves 2 Steps:

1. Compilation

2. Interpreter

Compilation: The program is converted into byte code. Byte code is a fixed set of
instructions that represents arithmetic, memory operations, comparison, etc. It can run on
any operating system and hardware. The byte code instructions are created in the .pyc file.

Interpreter: The next step involves converting the byte code into machine code. This step
is necessary as the computer can understand only machine code (binary code). Python
Virtual Machine first understands the operating system and processor in the computer and
then converts it into the machine code. Further, these machine code instructions are
executed by the processor and the results are displayed.

1
CHAPTER-3
TECHNOLOGY USED AND BASIC WORKING

3.1 INTRODUCTION TO DEEP LEARNING


Deep learning is a machine learning (ML) technique that teaches computers/software to do
things that humans do naturally. Learn for example. Deep learning is a key technology for
autonomous vehicles that can recognize stop signs or distinguish between pedestrians and
streetlights. It is the heart of voice control in consumer devices such as phones, tablets,
laptops, TVs and speakerphones. Deep learning has gotten a lot of attention for good
reason. This is the achievement of a result that was not previously possible.

In deep learning, computer models learn to perform classification tasks directly on images,
text, or sound. Deep learning models can achieve the accuracy that sometimes exceeds
human-level performance. The model is trained using a large set of labels and a neural
network architecture with many layers.

Deep learning is part of a broad suite of machine learning methods based on artificial
neural networks with representation learning. Learning can be unsupervised, supervised
and semi-supervised.

Deep Learning architectures such as deep neural networks, deep belief networks, deep
reinforcement learning, recurrent neural networks and convolutional neural networks have
been applied to fields including computer vision, speech recognition, natural language
processing,medical image analysis, climate science, material inspection, machine
translation, bioinformatics, drug design, and board game programs, where they have
produced results comparable to and in some cases surpassing human expert performance.

The adjective ‘deep’ in deep learning (DL) refers to the use of multiple layers in a network.
Initial work has shown that linear perceptrons cannot be universal classifiers, but networks
with non-polynomial activation functions with a single hidden layer of unlimited width are
possible. Deep learning is a modern variant that includes unlimited layers of limited size
allowing for practical applications and optimized implementations while maintaining
theoretical diversity under mild conditions. Layers in deep learning allow for a "structured"
part as they deviate significantly from heterogeneous, biologically based connectivity
models for efficiency, learnability, and understandability.

1
3.2 HISTORY OF DEEP LEARNING

Some sources show that Frank Rosenblatt has developed and studied all the basic
components of today's deep learning systems. He explained it in his book "Principles of
Neurodynamics: Perceptrons and the Theory of Brain Mechanisms" published by Cornell
Aeronautical Laboratory, Inc. in 1962. Perceptron was published in 1967 by Alexey
Ivakhnenko and Lapa. The 1971 article described an eight-tier deep network trained by a
group method of data processing. Other deep learning work architectures, especially those
designed for computer vision, began with the Neocognitron Fukushima, introduced by
Kunihiko in 1980. The term

Deep learning was introduced to the machine learning community by Rina Dechter in 1986
and by Igor Aizenberg and his colleagues in 2000. Boolean threshold neuron context in
artificial neural networks.

1989, Yann Le Cunetal. A standard backpropagation algorithm that has existed since 1970
as the reverse mode of automatic differentiation has been applied to deep neural networks
for recognizing handwritten zip codes on email. Training lasted three days while the
algorithm was working.

In 1994, André de Carvalho, along with Mike Fairhurst and David Bisset, published the
experimental results of a multi-layered Boolean neural network, also known as a
weightless neural network, consisting of a three-layer self-organizing neural network
module (SOFT) for feature extraction. From the Neural Network Module (GSN) with
independently trained multi-layer classification. Each layer in the feature extraction
module extracts features that are more complex than the previous layer.

In 1995, Brendan Frey demonstrated that it was possible to train (over two days) a network
containing six fully connected layers and several hundred hidden units using the wake
sleep algorithm, co-developed with Peter Dayan and Hinton. Many factors contribute to the
slow speed, including the vanishing gradient problem analyzed in 1991 by Sepp
Hochreiter.

Since 1997, Sven Behnke has extended the feedforward hierarchical convolutional
approach in the Neural Abstraction Pyramidby lateral and backward connections in order
to flexibly incorporate context into decisions and iteratively resolve local ambiguities.

Simpler models that use task specific handcrafted features such as Gabor filters and
support vector machines (SVMs) were a popular choice in the 1990s and 2000s, because of
artificial neural network's (ANN) computational cost and a lack of understanding of how
the brain wires its biological networks.

Both shallow and deep learning (e.g., recurrent nets) of ANNs have been explored for
many years.These methods never outperformed non uniform internal handcrafting

1
Gaussian mixture model/Hidden Markov model (GMMHMM) technology based on
generative models of speech trained discriminativelyKey difficulties have been analyzed,
including gradient diminishing and weak temporal correlation structure in neural predictive
models.Additional difficulties were the lack of training data and limited computing power.

Most speech recognition researchers moved away from neural nets to pursue generative
modeling. An exception was at SRI International in the late 1990s. Funded by the US
government's NSA and DARPA, SRI studied deep neural networks in speech and speaker
recognition. The speaker recognition team led by Larry Heck reported significant success
with deep neural networks in speech processing in the 1998 National Institute of Standards
and Technology Speaker Recognition evaluation. The SRI deep neural network was then
deployed in the Nuance Verifier, representing the first major industrial application of deep
learning.

The principle of elevating "raw" features over handcrafted optimization was first explored
successfully in the architecture of deep autoencoder on the "raw" spectrogram or linear
filterbank features in the late 1990s,showing its superiority over the MelCepstral features
that contain stages of fixed transformation from spectrograms. The raw features of speech,
waveforms, later produced excellent largescale results.

Many aspects of speech recognition were taken over by a deep learning method called long
short term memory (LSTM), a recurrent neural network published by Hochreiter and
Schmidhuber in 1997. LSTM RNNs avoid the vanishing gradient problem and can learn
"Very Deep Learning" tasks that require memories of events that happened thousands of
discrete time steps before, which is important for speech. In 2003, LSTMs began
competing with traditional speech recognition systems for specific tasks. It was then
combined with Connectionist temporal classification (CTC) in the stack of LSTM-RNNs.
In 2015, Google's speech recognition reportedly improved performance by a dramatic 49%
using CTC-trained LSTMs and is now available in Google Voice Search.

In 2006, Geoff Hinton, Russlan Salakhutdinov, Osindero, and The publications effectively
pre-trained multi-layer feedforward neural networks layer by layer, treating each layer as
an unmanned, constrained Boltzmann machine and monitored. I showed you how to use
backpropagation. It has been adjusted. The dissertation referred to learning for a network
of deep beliefs.

Deep learning is part of cutting-edge systems in a variety of areas, especially computer


vision and automated speech recognition (ASR). The results of commonly used scoring
sets such as TIMIT (ASR) and MNIST (Image Classification) and numerous large
vocabulary speech recognition tasks are steadily improving. Convolutional neural networks
(CNNs) have been replaced by LSTM CTCs in ASR. But more successful with computer
visionThe impact of deep learning in industry began in the early 2000s, when CNNs
already processed an estimated 10% to 20% of all the checks written in the US, according

2
to Yann LeCun.Industrial applications of deep learning to largescale speech recognition
started around 2010.

The 2009 NIPS Workshop on Deep Learning for Speech Recognition was motivated by the
limitations of deep generative models of speech, and the possibility that given more
capable hardware and large data sets that deep neural nets (DNN) might become practical.
It was believed that pre-training DNNs using generative models of deep belief nets (DBN)
would overcome the main difficulties of neural nets. However, it was discovered that
replacing pre training with large amounts of training data for straightforward
backpropagation when using DNNs with large, context dependent output layers produced
error rates dramatically lower than the stateoftheart Gaussian mixture model
(GMM)/Hidden Markov Model (HMM) and also than more advanced generative model
based systems. The nature of the recognition errors produced by the two types of systems
was characteristically different, offering technical insights into how to integrate deep
learning into the existing highly efficient, runtime speech decoding system deployed by all
major speech recognition systems.Analysis around 2009–2010, contrasting the GMM (and
other generative speech models) vs. The DNN model stimulated early industrial investment
in deep learning for speech recognition, eventually leading to ubiquitous and dominant
usage in the industry. This analysis was performed with comparable performance (error
rate less than 1.5%) between the discriminant DNN and the generative model.

In 2010, researchers extended deep learning from TIMIT to large vocabulary speech
recognition by adopting a large output layer of DNN based on the contextual HMM state
constructed by the decision tree. Advances in

hardware has renewed interest in deep learning. In 2009, Nvidia was involved in the so-
called "Big Bang" of deep learning, "when a deep learning neural network was trained
using a Nvidia graphics processing unit (GPU)." This year, Andrew Ng discovered that
GPUs could increase the speed of deep learning systems by about 100 times. GPUs are
especially good for machine learning matrix / vector computations. GPUs accelerate
training algorithms by orders of magnitude and reduce execution times from weeks to
days. In addition, special hardware and algorithm optimizations can be used to efficiently
process deep learning models.

2
3.3 TYPES OF DEEP LEARNING

● Feed Forward Neural Network


● Radial basis Function Neural Network
● Multilayer Perceptron
● Convolution Neural Network
● Recurrent Neural Network
● Modular Neural Network
● Sequence to Sequence Model

FEED FORWARD NEURAL NETWORK:

This type of neural network is the simplest neural network in which flow control starts at
the input layer and moves to the output layer.

This type of network has either only one layer or only one hidden layer.

There is no backpropagation method in this network because data only travels in one
direction.

In this network, the sum of the weights given to the inputs is given to the inputs. Layer

This type of network is used in face recognition algorithms using computer vision.

2
RADIAL BASIS FUNCTION NEURAL NETWORKS:

This type of neural network usually contains one or more layers, preferably two. energy
industry. A recovery system that restores power as quickly as possible to avoid power
outages.

MULTILAYER PERCEPTRON:

This type of network has 3 or more layers and is used to classify nonlinear data.

This type of network is fully connected to each node.

These networks are widely used in speech recognition and in other machine learning
technologies.

2
CONVOLUTIONAL NEURAL NETWORK (CNN)

CNNs are a variant of the multi-layer perceptron. A

CNN can contain more than one convolution layer, and since it contains convolution
layers, the network is very deep with fewer parameters.

CNNs are very efficient for image recognition and identification of various image patterns.

RECURRENT NEURAL NETWORK:

RNN recurrent neural network is a type of neural network in which the output of a
particular neuron is returned as an input to the same node.

: This method helps the network predict the output.

This kind of network is useful for keeping memory small, which is very useful for chatbot
development.

This kind of network is used to develop chatbots and text-to-speech technologies.

2
MODULAR NEURAL NETWORK:

This type of network is not a single network, but a combination of several smaller neural
networks.

All subnets make up a large neural network and all work independently of each other to
achieve a common goal.

These networks are very useful for breaking down big problems into smaller pieces and
then solving them.

2
SEQUENCE TO SEQUENCE MODELS:

This type of network is usually a combination of two RNNs. The network does the
encoding and decoding operations. That is, it consists of an encoder that is used to process
the input, and there is a decoder that processes the output.

Typically, this network is used for text processing. The text does not match the output text.

3.4 WHY DEEP LEARNING

 FEATURE GENERATION AUTOMATION

Deep learning algorithms can generate new features from a limited number of features in
the training data set without additional human intervention. This means that deep learning
can perform complex tasks that often require extensive feature engineering.

For enterprises, this means faster deployment of applications or technologies that provide
the highest accuracy, works Well with Unstructured Data:

One of the biggest benefits of deep learning is the ability to work with unstructured data. In
a business context, this is especially important considering that most business data is
unstructured. Text, image, and voice are among the most common data formats used by
businesses. Existing machine learning algorithms have limited ability to analyze
unstructured data. In other words, this vast amount of information is often underutilized.
And this is where deep learning promises to have the biggest impact.

2
Training deep learning networks with unstructured data and proper labeling can help
businesses optimize almost anything from marketing and sales to finance.

● BETTER SELF LEARNING CAPABILITIES:

The multiple layers in deep neural networks allow models to become more efficient at
learning complex features and performing more intensive computational tasks. It outshines
machine learning in machine perception tasks that involve unstructured datasets.

This is due to deep learning algorithms' ability to eventually learn from its own errors. It
verifies the accuracy of its predictions/outputs and makes necessary adjustments. On the
other hand, classical machine learning models require varying degrees of human
intervention to determine the accuracy of output.

 SUPPORTS PARALLEL AND DISTRIBUTED ALGORITHMS:

A typical neural network takes days to learn the parameters that define the model. Parallel
and distributed algorithms solve this problem by allowing deep learning models to be
trained much faster. Models can be trained using local training (using one machine to train
the model), the GPU, or a combination of both.

However, the sheer volume of training data set involved can make it impossible to store
them on a single machine. This is where data parallelism begins. Training is more efficient
if the data or the model itself is spread across multiple machines.

Parallel and distributed algorithms allow you to train deep learning models at scale. For
example, if you are training a model on a single machine, it can take up to 10 days to
review all the data. On the other hand, parallel algorithms can be distributed across
multiple systems/computers to complete training in less than a day. Depending on the size
of the training dataset and GPU processing power, training can be completed in a day using
2-3 machines to 20 or more machines.

2
● COST EFFECTIVENESS:

Training deep learning models can be expensive, but once trained, it can help businesses
cut unnecessary costs. In industries such as manufacturing, consulting, or retail, the costs
of inaccurate forecasts or product defects are enormous. This often outweighs the cost of
training a deep learning model.

Deep learning algorithms can significantly reduce margins of error across industries and
industries by taking into account differences in learning capabilities. This is especially true
when comparing the limitations of classical machine learning models to deep learning
algorithms.

● ADVANCE ANALYTICS:

Deep learning, when applied to data science, can offer better and more effective processing
models. Its ability to learn unsupervised drives continuous improvement in accuracy and
outcomes. It also offers data scientists with more reliable and concise analysis results.

The technology powers most prediction software today with applications ranging from
marketing to sales, HR, finance, and more. If you use a financial forecasting tool, chances
are that it uses a deep neural network. Similarly, smart sales and marketing automation
packages use deep learning algorithms to make predictions based on historical data.

● SCALABILITY:

Deep learning is highly scalable due to its ability to process massive amounts of data and
perform a lot of computations in a cost effective and time effective way. This directly
impacts productivity and modularity and portability.

For instance, Google Cloud’s AI platform prediction allows you to run your deep neural
network at scale on the cloud. So, in addition to better model organization and versioning,
you can also leverage Google’s cloud infrastructure to scale batch prediction. This then
improves efficiency by automatically scaling the number of nodes in use based on request
traffic.

2
3.5 HOW DEEP LEARNING WORKS?

Deep learning networks learn by discovering intricate structures in data they experience.
By building computational models that are composed of multiple processing layers, the
networks can create multiple levels of abstraction to represent the data.

For example, a deep learning model known as a convolutional neural network can be
trained using large numbers (as in millions) of images, such as those containing cats. This
type of neural network typically learns from the pixels contained in the images it acquires.
It can classify groups of pixels that are representative of a cat’s features, with groups of
features such as claws, ears, and eyes indicating the presence of a cat in an image.

Deep learning is fundamentally different from conventional machine learning. In the


example, a domain expert would need to spend considerable time engineering a
conventional ML system to detect the features that represent a cat. With deep learning, all
that is needed is to supply the system with a very large number of cat images, and the
system can autonomously learn all the features that represent a cat.

For many tasks, like computer vision, speech recognition, machine translation, and
robotics, the performance of deep learning systems far exceeds that of conventional
machine learning systems. This is not to say that building deep learning systems is
relatively easy compared to conventional machine learning systems. Feature recognition in
deep learning is autonomous, but in order for a deep learning model to be efficient, it must
tune thousands of hyperparameters (handles).

Content data in HTML. Because of the versatility and types of data it can collect, Beautiful
Soup is used by data scientists and data analysts, as well as machine and deep learning
developers looking for data to train programs.

Beautiful Soup does the job very quickly and efficiently and doesn't require a lot of
hardware to run. It is very convenient and works with many different websites and encoded
data types. Beautiful Soup is easy to use even for those completely new to Python thanks
to its simplified code, comprehensive documentation, and active online community.

2
CHAPTER-4
NEURAL NETWORK

4.1 DEFINITION
Neural networks are artificial intelligence technologies that teach computers how to
process data in the same way as the human brain. It is a kind of machine learning process
called deep learning that uses interconnected nodes or neurons in a hierarchy similar to the
human brain.

Abstract

Studies of the genetics of certain inherited diseases require expertise in the determination
of disease status even for single locus traits. For example, in the diagnosis of autosomal
dominant limb girdle muscular dystrophy (LGMD1A), it is not always possible to make a
clearcut determination of disease, because of variability in the diagnostic criteria, age at
onset, and differential presentation of disease. Mapping such diseases is greatly simplified
if the data present a homogeneous genetic trait and if disease status can be reliably
determined. Here, we present an approach to determination of disease status, using
methods of artificial neural network analysis. The method entails "training" an artificial
neural network, with input facts (based on diagnostic criteria) and related results (based on
disease diagnosis). The network contains weight factors connecting input "neurons" to
output "neurons," and these connections are adjusted until the network can reliably produce
the appropriate outputs for the given input facts. The trained network can be "tested" with a
second set of facts, in which the outcomes are known but not provided to the network, to
see how well the training has worked. The method was applied to members of a pedigree
with LGMD1A, now mapped to chromosome 5q. We used diagnostic criteria and disease
status to train a neural network to classify individuals as "affected" or "not affected." The
trained network reproduced the disease diagnosis of all individuals of known phenotype,
with 98% reliability. This approach defined an appropriate choice of clinical factors for
determination of disease status. It also provided insight into the classification of diseases
considered to have an "unknown" phenotype based on standard clinical diagnostic
methods.

3
4.2 A FEW CONCRETE EXAMPLES:

For example, the facial recognition system may indicate "eyebrows are above the eyes" or
"mustache is under the nose." The whiskers are above and/or on the side of the mouth."
Preloading the rules can speed up training and make the model more robust. But it's also
irrelevant, unhelpful, wrong and counterproductive to the nature of the problem. You make
very important decisions about which rules (if any) to build based on your assumptions
about.

4.3 CLASSIFICATION OF NEURAL NETWORK


Different Types of Basics in Classification of Neural Networks

3
It classifies the different types of Neural Networks as:

1. Shallow Neural Networks (Collaborative Filtering)

Neural networks are made up of groups of perceptron that mimic the neural structure of the
human brain. A shallow neural network has one hidden perceptron layer. A common
example of shallow neural networks is collaborative filtering. The hidden layer of the
perceptron is trained to mark similarities between objects in order to generate
recommendations. Recommendation systems from Netflix, Amazon, YouTube, etc. We
use the collaborative filtering version to recommend products based on your interests.

3
2. Multilayer Perceptron (Deep Neural Networks)

A neural network with one or more hidden layers is called a deep neural network. Spoiler
alert! All subsequent neural networks are a form of deep neural networks that have been
modified/improved to solve domain-specific problems. In general, they help achieve
versatility. With enough hidden layers of neurons, deep neural networks can approximate
complex real-world problems.

The universal approximation theorem is the basis of deep neural networks for training and
fitting any model. Each version of the deep neural network is developed as a fully
connected layer of maximally concatenated products of matrix multiplications optimized
by a backpropagation algorithm. We will continue to explore improvements that lead to
various forms of deep neural networks.

3
3. Convolutional Neural Network (CNN)

CNNs are the most mature form of deep neural networks that provide the most accurate,
i.e. better than human, computer vision results. A CNN consists of a convolutional layer
created by scanning each pixel of an image in a data set. As the data is approximated layer
by layer, the CNN begins to recognize patterns, recognizing objects in the image. These
objects are widely used in various applications for identification, classification, etc. Recent
techniques such as transfer learning in CNNs have significantly improved model
inaccuracy. Google Translator and Google Lens are the latest examples of CNNs.

Since CNNs are mostly used for tasks not related to computer vision, their applications are
exponential. A very simple yet intuitive explanation of CNNs can be found here.

4. Recurrent Neural Network (RNN)

RNNs are a modern form of deep neural networks for problem solving in NLP. Simply put,
an RNN feeds the outputs of multiple hidden layers back to the input layer in order to
aggregate and pass approximations to the next iteration (epoch) of the input data set. It also
helps the model to learn on its own and revise its predictions somewhat faster. These
models are very useful for understanding the meaning of texts in NLP tasks. There are
many variants of RNNs such as Long-Term Memory (LSTM), Gated Recurrent Unit
(GRU), etc. In the diagram below, the activations of h1 and h2 are fed to x2 and x3
respectively.

3
5. Long Short-Term Memory (LSTM)

LSTMs are specifically designed to solve the problem of disappearing gradients with
RNNs. Vanishing gradients occur in large neural networks where the gradient of the loss
function tends to approach zero, causing the neural network to pause for training. LSTM
solves this problem by preventing the activation function on a repeated component and
keeping the stored value unchanged. This small change significantly improved the final
model, leading tech giants to adopt LSTMs in their solutions. Let's move on to the
"simplest and easiest to understand" LSTM picture.

3
6. Attention-based Networks

In fact, attention models are increasingly replacing newer RNNs. Attention patterns are
built by focusing on a subset of a given information, thus eliminating an overwhelming
amount of background information that is not needed for the current task. The attention
model is based on a combination of soft and hard attention by backpropagating soft
attention. A hierarchically arranged multi-state model is called a transformer. These
transformers are more efficient at running the stack in parallel, producing up-to-date results
with relatively little data and model training time. Attention assignment is very efficient
when used with CNN/RNN and can generate textual descriptions of images as follows:

Attention-Based Networks

Tech giants such as Google and Facebook are rapidly adapting attention models to build
solutions.

3
7. Generative Adversarial Network (GAN)

Deep learning models provide state-of-the-art results, but can add noise to real-world data,
tricked by far more intelligent people. GANs are the latest developments in deep learning
to handle these scenarios. GANs use unsupervised learning to train deep neural networks
using data generated from AI models along with real data sets to improve the accuracy and
performance of the models. This adversarial data is mainly used to fool the discriminant
model to build an optimal model. The resulting models tend to have better approximations
than these noises can overcome. Research interest in GANs has led to more complex
implementations such as Conditional GAN (CGAN), Laplace Pyramid GAN (LAGAN),
Super Resolution GAN (SRGAN), etc.

Conclusion:

Deep neural networks extend the capabilities of computers. It is not limited to


classification (CNN, RNN) or prediction (joint filtering) as well as data generation (GAN).
This data ranges from beautiful forms of Art to the controversial fake of Deep, but
outperforms humans in daily work. Therefore, while striving to create efficient neural
network models, we must also consider the ethics and impact of AI. Time for a neat
infographic about neural networks.

3
38
4.4 PREDICTIVE ANALYSIS
Neural networks, sophisticated algorithms used in predictive analytics, are biologically
inspired by the structure of the human brain. Neural networks are very simple models
compared to the human brain, but they work well enough for our purposes.

Neural networks, widely used in data classification, process past and present data to
estimate future values and reveal complex correlations hidden in data in a manner similar
to that used by the human brain.

Neural networks can be used to predict time series data such as weather data. Neural
networks can be designed to detect patterns in input data and produce a noise-free output.

The structure of the neural network algorithm consists of three layers.

The input layer passes past data values to the next (hidden) layer. Black circles represent
nodes in the neural network.

The hidden layer encapsulates several complex functions for generating predictors. Often
these features are hidden from users. The set of nodes in the hidden layer (black circles) is
a mathematical function that modifies the input. These functions are called neurons.

The output layer collects predictions made on the hidden layer and produces final result,
the prediction of the model.

Let's take a closer look at how a neural network generates a predicted output based on the
input data. The hidden layer is a key component of a neural network because of the
neurons it contains. It performs basic calculations and works together to produce output.

Each neuron takes a series of inputs. Each is associated with a numeric value known as a
weight (more on that in a moment) and an offset. The output of each neuron is a function
of the output plus the weighted sum and bias of each input.

Most neural networks use mathematical functions to activate neurons. In mathematics, a


function is a relationship between a set of inputs and a set of outputs, following the rule
that each input corresponds to an output.

For example, consider a negative function whose input can be an integer and whose output
is negative. Essentially, functions in mathematics behave like black boxes, taking inputs
and producing outputs.

Neurons in a neural network can use sigmoid functions to map inputs to outputs. When
used that way, a sigmoid function is called a logistic function and its formula looks like
this:

3
f(input) = 1/(1+eoutput)

Here f is the activation function that activates the neuron, and e is a widely used
mathematical constant that has the approximate value of 2.718.

You might wonder why such a function is used in neurons. Well, most sigmoid functions
have derivatives that are positive and easy to calculate. They’re continuous, can serve as
types of smoothing functions, and are also bounded functions.

This combination of characteristics, unique to sigmoid functions, is vital to the workings of


a neural network algorithm — especially when a derivative calculation — such as the
weight associated with each input to a neuron — is needed.

The weight for each neuron is a numerical value that can be derived using either
supervised training or unsupervised training such as data clustering.

In the case of supervised training, weights are derived by feeding sample inputs and
outputs to the algorithm until the weights are tuned (that is, there’s a near perfect match
between inputs and outputs).

In the case of unsupervised training, the neural network is only presented with inputs; the
algorithm generates their corresponding outputs. When the algorithms are presented with
new but similar inputs and the algorithm produces new outputs that are similar to previous
outputs, then the neurons’ weights have been tuned.

4
Advantages/Disadvantages of Neural Network

Advantages:

Gradual corruption: A network slows over time and undergoes relative degradation.
Network issues don't immediately corrode.

Ability to teach machines: artificial neural networks learn events and make decisions by
commenting on those events.

Parallel Processing Power: Artificial neural networks have the numerical potential to
perform more than one task at the same time.

Disadvantages:

Hardware Dependencies: Artificial neural networks require a processor with parallel


computing power in their structure. For this reason, the hardware implementation is
dependent.

Unexplained Network Function: This is the most important problem with ANNs. When
ANN provides a trial solution, it does not give a clue as to why or how. This reduces trust
in the network.

Ensuring proper network structure: no special rules for defining the structure of artificial
neural networks

4
CHAPTER-5

CODING

5.1 PREPROCESSING DATA

The data preprocessing part is important in machine learning where missing, unlabeled,
mislabeled, or mismatched data can mess up the training of models learning features from
that data. Therefore, it is very important to apply the appropriate skills to ensure that the
information is ready to be used in the learning process. A common way to preprocess

data is to use a Python library like Keras in this case. For example, if an image file is
corrupted or empty, it should be removed from the data set to avoid errors. Otherwise, if
the file size is different from the other files, you will need to resize it to the correct size. So
sometimes there is a data preprocessing technique called "data augmentation" that can help
to improve the performance of our models. By rotating, scaling, transforming, and
applying a series of transforms to the input image, you can increase the model's ability to
generalize the learned features. If you are diagnosing a

chest x-ray, you don't need to "complete" the

data set because the x-ray's location varies. However, we need to preprocess the dataset to
ensure that the images are ready to be used for training.

Here you have an example of how the data is preprocessed in this project:

1. But, first, we import the libraries that we are going to need to develop the project.

import tensorflow as tf

import numpy as np

import matplotlib.pyplot as plt

4
import itertools

import math

import os

2. Since this data split aims to train a model with the training set and test its accuracy
and generalization with the test set, the model cannot "see" the data in the test set.
During the segmentation process, random images are selected from all dataset
classes. The "seed" parameter can also change the randomness of the method used
to feed the random number generator associated with the selection of images to be
included in each set.

Implement details

The first thing we need to do to build the model is to load the pretrained Convolutional part
from the Keras API into the base model without the last layer. In this part we will build the
rest of the layers. There are many pre-trained models to choose from for this kind of
feature extraction task, but the MobileNetV3Small model has the best performance and
minimal workspace. It aims to improve the performance of convolutional networks by
training with imagenet, one of the largest datasets in the world with millions of images.

baseModel = tf.keras.applications.MobileNetV3Large(input_shape=(256, 256,3),


weights='imagenet', include_top=False, classes=numClasses)

After creating the basic convolutional model, we need to set up the classification parts that are
important to take advantage of the basic model architecture. In this case, we use the
GlobalMaxPooling2D layer to reduce the dimension of the feature map and load it into a dense
network generated by a hidden layer of 256 neurons and an output layer with the same number of
neurons as the class using the ReLU activation function. In our problem (5). This part of the
network also has a batch regularization layer that improves the accuracy of the model results, and
several methods to reduce overfitting, such as Dropout and L2 regularizer.
4
last_output = baseModel.layers[-1].output

x = tf.keras.layers.Dropout(0.5) (last_output)

x = tf.keras.layers.GlobalMaxPooling2D() (last_output)

x = tf.keras.layers.Dense(256,
kernel_regularizer=tf.keras.regularizers.l2(0.02), activation =

activity_regularizer=tf.keras.regularizers.l2(0.02), kernel_initializer='he_normal')(x)

x = tf.keras.layers.BatchNormalization() (x)

x = tf.keras.layers.Dropout(0.45) (x)

x = tf.keras.layers.Dense(numClasses, activation='softmax')(x)

model = tf.keras.Model(inputs=baseModel.input, outputs=x)

Once the model architecture is built, it needs to be trained and tested to fit the input
dataset. So now, we will define the loss function used to evaluate the performance during
training and the optimizer algorithm that will tune the model parameters to minimize the
loss function. In this case, we use the Stochastic Gradient Descent with an initial learning
rate of 0.1 as optimizer and Sparse Categorical Cross Entropy, one of the most usual losses
in multiclass classification tasks like this. In addition to the loss, we also add the
‘accuracy’ metric, which, as its name indicates, shows the model’s performance in the
form of a percentage. However, we can use the loss function as itself, but the main reason
for not doing that is the use in which each one is used. For example, the main goal of a loss
function is to minimize it when it is trained to optimize the model. At the same time, this
metric is an indicator of how well the model performs not only in training, but also in
testing and inference.

model.compile(optimizer=tf.keras.optimizers.SGD(learning_rate=0.1),
loss=tf.keras.losses.SparseCategoricalCrossentropy(), metrics=['accuracy'])

4
Finally, we define the numbers on which the model will learn. So, at each epoch, the
training set is split into a series of batches with the same number of images (usually 32)
and fed to the network to match the parameters. So the model is trained on one epoch in
many batches. You can split the training set. The purpose of this data segmentation is to
control the stability with which the learning algorithm trains the network, as shown in the
following image.

Fig 5.1

5.2 PYTHON LIBRARIES USED:

Tensorflow:

TensorFlow is an open source framework developed by Google researchers to run machine


learning, deep learning and other statistical and predictive analytics workloads. Like
similar platforms, it's designed to streamline the process of developing and executing
advanced analytics applications for users such as data scientists, statisticians and predictive
modelers.

The TensorFlow software handles data sets that are arrayed as computational nodes in
graph form. The edges that connect the nodes in a graph can represent multidimensional
vectors or matrices, creating what are known as tensors. Because TensorFlow programs
4
use a data flow architecture that works with generalized intermediate results of the
computations, they are especially open to very large scale parallel processing applications,
with neural networks being a common example. The

platform includes a set of high-level and low-level APIs. Google recommends using the
highest level possible to make data pipeline development and application programming
easier. But knowing how to use a low-level API called TensorFlow Core can be useful for
experimenting and debugging applications, the company says. It also gives users a "mental
model" of the inner workings of machine learning technologies, according to Google.

Keras:

● Keras is a deep learning API written in Python and running on top of machine
learning frameworks. It is designed with a focus on allowing you to experiment
quickly. Being able to move from idea to result as quickly as possible is the key to
good research.
● Keras is:
● Simple but not simple. Keras offloads the developer's cognitive load, allowing them
to focus on the really important parts of the problem.
● Flexible Keras uses the principle of progressive complexity discovery. Simple
workflows should be fast and easy, and arbitrarily scaled workflows should be
possible with clear paths based on what you have already learned. The
● powerful Keras delivers industry-leading performance and scalability. Used by
organizations and companies including NASA, YouTube, or Waymo.

Numpy:

NumPy is a library for the Python programming language that adds support for large
multidimensional arrays and matrices, as well as a large set of advanced mathematical
functions for working with these arrays.

NumPy knows that int refers to np.int_, bool refers to np.bool_, float refers to np.float_,
and complex refers to np.complex_. Other data types have no Python equivalent.

4
5.3 CODE:

Since we are looking at three diseases in this project:

Brain Tumor

Malaria

Pneumonia

There are three separate codes to complete the project, so I will paste the main functions of
the code here.

import os

import numpy as np

import mysql.connector

from flask import Flask, render_template,redirect,request,session,flash,url_for

from tensorflow.keras.models import load_model

from tensorflow.keras.applications.imagenet_utils import preprocess_input

from tensorflow.keras.preprocessing import image

from PIL import Image

from datetime import timedelta

app = Flask( name )

4
app.secret_key = os.urandom(24)

app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(minutes=5)

conn = mysql.connector.connect(host="localhost", user="root",password="ads",


database="users")

cursor = conn.cursor()

@app.route('/')

def login():

return render_template('login.html')

@app.route('/login_validation', methods=['post'])

def login_validation():

email = request.form.get('email')

password = request.form.get('password')

cursor.execute(""" SELECT * FROM `users` WHERE `email` LIKE '{}' AND


`password` LIKE '{}' """

.format(email,password))

users = cursor.fetchall()

if len(users)>0:

session['user_id'] = users[0][0]

session.permanent = True

4
return redirect('/home')

else:

return redirect('/')

@app.route('/add_user', methods=['post'])

def add_user():

name = request.form.get('uname')

email = request.form.get('uemail')

password = request.form.get('upassword')

cursor.execute("INSERT INTO `users` (`user_id`,`FullName`,`Email`,`password`)


VALUES (NULL,'{}','{}','{}')".format(name,email,password))

conn.commit()

cursor.execute("""SELECT * FROM `users` WHERE `email` LIKE


'{}'""".format(email))

myuser = cursor.fetchall()

session['user_id'] = myuser[0][0]

flash(f"User registered successfully")

return redirect('/home')

@app.route('/register')

def register():

return render_template('register.html')

4
@app.route('/home', methods=['get'])

def home():

if 'user_id' in session:

return render_template('home.html')

else:

return redirect('/')

@app.route("/malaria", methods=['GET', 'POST'])

def malariaPage():

return render_template('malaria.html')

@app.route("/pneumonia", methods=['GET', 'POST'])

def pneumoniaPage():

return render_template('pneumonia.html')

@app.route("/brain", methods=['GET', 'POST'])

def brainPage():

return render_template('brain.html')

@app.route("/malariapredict", methods = ['POST', 'GET'])

def malariapredictPage():

5
if request.method == 'POST':

try:

if 'image' in request.files:

img = Image.open(request.files['image'])

img = img.resize((36,36))

img = np.asarray(img)

img = img.reshape((1,36,36,3))

img = img.astype(np.float64)

model = load_model("models/malaria.h5")

preds = np.argmax(model.predict(img)[0])

except:

message = "Please upload an Image"

return render_template('malaria.html', message = message)

return render_template('malaria_predict.html', preds = preds)

@app.route("/pneumoniapredict", methods = ['POST', 'GET'])

def pneumoniapredictPage():

if request.method == 'POST':

try:

if 'image' in request.files:

img = Image.open(request.files['image']).convert('L')

img = img.resize((36,36))

img = np.asarray(img)

img = img.reshape((1,36,36,1))

img = img / 255.0

model = load_model("models/pneumonia.h5")

5
pred = np.argmax(model.predict(img)[0])

except:

message = "Please upload an Image"

return render_template('pneumonia.html', message = message)

return render_template('pneumonia_predict.html', pred = pred)

model = load_model(r'C:\Users\Admin\Desktop\Medidoc\MEDIDOC- master\models\


tumor_prediction.h5', compile=False)

@app.route("/brainpredict", methods = ['POST', 'GET'])

def brainpredictPage():

if request.method == 'POST' and 'image' in request.files:

img = Image.open(request.files['image'])

img = img.resize((224,224))

img = np.expand_dims(img, axis=0)

img_data= preprocess_input(img)

preds = model.predict(img_data)

if preds[0][0] >= 0.9:

prediction = 'This MRI Scan does not have Brain Tumor.'

elif preds[0][0] < 0.9:

prediction = 'This MRI Scan is predicted to have Brain Tumor, Please Consult to
the Doctor.'

return render_template('brain_predict.html', prediction=prediction)

5
else:

message = "Please upload an image"

return render_template('brain.html', message=message)

@app.route('/doctors_list')

def doctorsPage():

return render_template('doctors.html')

@app.route('/hospitals_list')

def hospitalsPage():

return render_template('hospitals.html')

@app.route('/contact')

def contactPage():

return render_template('contact_us.html')

@app.route('/connect_doctor')

def connect_doctorPage():

return render_template('connect_doctor.html')

@app.route('/about_us')

def about_usPage():

return render_template('about_us.html')

5
@app.route('/logout')

def logout():

session.pop('user_id')

return redirect('/')

if name == ' main ':

app.run()

5.5 TESTING AND OUTPUT:

Fig 5.2

5
Fig 5.3

Fig 5.4

5
Fig 5.5

Fig 5.6

5
Fig 5.7

Fig 5.8

5
Fig 5.9

5
Fig 5.10

Fig 5.11

Fig 5.12

5
CHAPTER-6

CONCLUSION

When we reach 95% accuracy, we can conclude that the model makes a large number of
correct guesses, but there is also a lot of work that needs to be done to improve the results
of this machine learning algorithm on these complex problems. However, articles like this
one, which attempt to explain the power of modern technology to solve large-scale
problems that were previously unsolvable, will be useful for increasing your overall
understanding of artificial intelligence. Also, knowing how the technology we use works
improves our ability to use it correctly and promotes critical and creative thinking.

ML and DM methods are widely used in clinical decision support systems to help
clinicians make decisions. Data analytics can be used to make more efficient and effective
decisions, eliminate medical errors, improve patient health, and reduce costs. In the articles
studied and discussed, the performance of machine learning methods depends on the nature
of the data set and the size of the data set between the training and test sets. A key property
of medical data sets is that they are inherently highly disproportionate, and majority and
minority classifiers are not balanced, resulting in unstable predictions when working with
classifiers. Other features of medical data sets have missing values. Data sample size can
also be used as another feature, as available data is usually limited in scope. There is no
proper DM method to solve all these problems.

6.1 FUTURE SCOPE:

Predictive analysis of medical data sets is critical because it helps clinicians make effective
clinical decisions. This article points out that time is another important factor influencing
professional decision making. This study shows that new machine learning methods have
different accuracies when using the same data set. New machine learning algorithms will
be developed to provide accurate and detailed predictions of future tasks.

6
REFERENCES

1. Lokesh, S., Kumar, P. M., Devi, M. R., Parthasarathy, P., and Gokulnath, C., An
automatic tamil speech recognition system by using bidirectional recurrent neural
network with self-organizing map. Neural Comput. Applic. 1–11, 2018.
2. Kanisha, B., Lokesh, S., Kumar, P. M., Parthasarathy, P., and Chandra Babu, G.,
Speech recognition with improved support vector machine using dual classifiers
and cross fitness validation. Pers. Ubiquity. Comput. 1–9, 2018.
3. Kumar, P. M., Lokesh, S., Varatharajan, R., Babu, G. C., and Parthasarathy,
PCloud and IoT based disease prediction and diagnosis system for healthcare using
fuzzy neural classifiers. Futur. Gener. Comput. Syst. 86:527–534, 2018.
4. Chandra, I., Sivakumar, N., Gokulnath, C. B., and Parthasarathy, P., IoT based fall
detection and ambient assisted system for the elderly. Clust. Comput. 1–9, 2018.
5. Mathan, K., Kumar, P. M., Panchatcharam, P., Manogaran, G., and Varadharajan,
R., A novel Gini index decision tree data mining method with neural network
classifiers for prediction of heart disease. Des. Autom. Embedded. Syst. 1–18,
2018.
6. Parthasarathy, P., and Vivekanandan, S., Investigation on uric acid biosensor model
for enzyme layer thickness for the application of arthritis disease diagnosis. Health
Inf. Sci. Syst. 6:1–6, 2018.
7. Parthasarathy, P., and Vivekanandan, S., A comprehensive review on thin film-
based nano-biosensor for uric acid determination: Arthritis diagnosis. World Rev.
Sci. Technol. Sustain. Dev. 14(1):52–71, 2018.
8. Parthasarathy, P., and Vivekanandan, S., A numerical modeling of an amperometric-
enzymatic based uric acid biosensor for GOUT arthritis diseases. Inform. Med.
Unlocked, 2018.
9. Varadharajan, R., Priyan, M. K., Panchatcharam, P., Vivekanandan, S., and
Gunasekaran, M., A new approach for prediction of lung carcinoma using back
propagation neural network with decision tree classifiers. J. Ambient Intell.
Humaniz. Comput. 1–12, 2018.
10. Parthasarathy, P., and Vivekanandan, S., Urate crystal deposition, prevention and
various diagnosis techniques of GOUT arthritis disease: A comprehensive review.
Health Inf. Sci. Syst. 6(1):19, 2018.

6
Certificate of Plagiarism

Signature of Student Signature of Guide

Signature of HOD, CSE

6
AUTHOR’S DETAILS

Aditi Shukla (1834810006)

Mobile: +91 7395052949

Email: Shuklaaditi1005@gmail.com

Address: 8/136 Arya Nagar, Kanpur, Uttar Pradesh, 208002

Alshifa Sabir (1834810011)

Mobile: +91 9918302236

Email: sabiralshifa1999@gmail.com

Address: 117/673 Radha Sharda Nagar, Kanpur, Uttar Pradesh,


208025

Anya Shukla (1834810018)

Mobile: +91 9161205248

Email: anyashukla2000@gmail.com

Address: 116/940 Radha Vihar Rawatpur gaon, Kanpur, Uttar


Pradesh, 208019
Deeksha Katiyar (1834810031)

Mobile: +91 8004103563

Email: katiyardeeksha9@gmail.com

Address: saraiprayag, Kannauj, Uttar Pradesh, 209735

Kaushiki Katiyar (1834810042)

Mobile: +91 9161205248

Email: Kaushikikat@gmail.com

Address: 101,A-Block Imperial heights Kanpur, Uttar Pradesh,


208017

You might also like