0% found this document useful (0 votes)
3 views85 pages

Project Report

The document is a project report for a Lung Cancer Detection System using machine learning, submitted by students of Government Engineering College, Kushalnagar, for their Bachelor of Engineering degree. It outlines the project's objectives, methodology, and the significance of early lung cancer detection through a machine learning model trained on various patient data. The report includes acknowledgments, system requirements, implementation details, and testing results, highlighting the potential impact of the system on healthcare outcomes.

Uploaded by

kirankumart5656
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views85 pages

Project Report

The document is a project report for a Lung Cancer Detection System using machine learning, submitted by students of Government Engineering College, Kushalnagar, for their Bachelor of Engineering degree. It outlines the project's objectives, methodology, and the significance of early lung cancer detection through a machine learning model trained on various patient data. The report includes acknowledgments, system requirements, implementation details, and testing results, highlighting the potential impact of the system on healthcare outcomes.

Uploaded by

kirankumart5656
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

“JNANASANGAMA”,BELAGAVI-590018

A PROJECT REPORT(BCS786)

ON

“LUNG CANCER DETECTION SYSTEM USING ML”

Submitted in partial fulfilment of the requirements for the award of the degree of

BACHELOR OF ENGINEERING
IN
COMPUTER SCIENCE AND ENGINEERING

Submitted by

MANASA M K 4GL22CS023
SANJANA H P 4GL22CS047
T CHANNABASAVA 4GL22CS053
GNANESH KUMAR D P 4GL23CS406

Under the Guidance of


[Link] PRASAD B S B.E,M.E, Ph.D.
Associate professor, Department of CS&E.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


GOVERNMENT ENGINEERING COLLEGE
MADAPATNA, KUSHALANAGARA - 571234
2025-26
GOVERNMENT ENGINEERING COLLEGE
KUSHALNAGAR-571234,KODAGU,KARNATAKA.
Affiliated to VTU,Belagavi,Approved by AICTE New Delhi
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

CERTIFICATE

This is Certified that the project work entitled “LUNG CANCER DETECTION SYSTEM USING
ML” is a bonafide work carried out by MANASA M K(4GL22CS023) , SANJANA H
P(4GL22CS047) T CHANNABASAVA(4GL22CS053) , GNANESH KUMAR D P(4GL23CS406).In
partial fulfillment
for the award of Bachelor of Engineering in Computer Science and Engineering of Visvesvaraya Tech-
nological University, Belagavi during the year 2025-2026. It is certified that all
corrections/suggestions indicated for internal evaluation have been incorporated in the report deposited
in the department li- [Link] project report has been approved as it is satisfied the academic
requirements in respect of project work prescribed for the Bachelor of Engineering Degree.

———————————- ——————————
Signature of the Guide Signature of the
Coordinator [Link] PRASAD B S [Link] B
Associate Professor Project Coordinator
[Link] CS&E [Link] CS&E

——————————– ———————————
Signature of HOD Signature of the Principal
[Link] S [Link] K I
Head of [Link] CS&E Principal GEC,Kushalnagar

EXTERNAL VIVA-VOCE

Name of the Examiners Signature with date

1. ————————- ————————

2. ————————- ————————-
GOVERNMENT ENGINEERING COLLEGE
KUSHALNAGAR-571234,KODAGU,KARNATAKA.
Affiliated to VTU,Belagavi,Approved by AICTE New Delhi
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

DECLARATION

We , MANASA M K (4GL22CS023) , SANJANA H P (4GL22CS047) , T CHANNABASAVA


(4GL22CS053) , GNANESH KUMAR D P(4GL23CS406) are respectively styudying in the 7th
semester B.E, Computer Science and Engineering Department, Government Engineering College,
Kushalnagar, hereby declare that the entire project entitled “LUNG CANCER DETECTION SYS-
TEM USING ML” has been carried out under the guidance of [Link] PRASAD B S,
Department of Computer Science and Engineering, Government Engineering College, Kushalnagar.
This project work is submitted to Visvesvaraya Technological University, Belagavi, in partial
fulfilment of the requirement for the award of the degree of Bachelor of Engineering in Computer
Science and Engineering during the academic year 2025-2026. This project work has not been
submitted previously for the award of any other degree or diploma to any other institution or
university.

Date:
Place: Kushalnagara

NAME OF THE STUDENTS USN SIGNATURE


MANASA M K 4GL22CS023
SANJANA H P 4GL22CS047
T CHANNABASAVA 4GL22CS053
GNANESH KUMAR D P 4GL23CS406
ACKNOWLEDGMENT
We express our sincere gratitude and indebtedness to those who guided us throughout this project pe-
riod. Coming up with this project was not easy, and the enlightenment of experienced teachers played
a paramount role in guiding us in the right direction.

We are extremely grateful to our own and beloved [Link] Prasad B.S, Associate Profes-
sor,Department of Computer Science and Engineering, for guiding us throughout the project .

We place our heartfelt thanks to [Link] B, Associate Professor, Department of Computer


Science and Engineering, for coordinating the project.

We are highly indebted to Head of the Department Of CSE [Link] S for giving us the op-
portunity.

We sincerely thank Dr. Parashivamuthy K. I., Principal of Government Engineering College,


Kushal- nagar, for his continuous encouragement and for providing us the opportunity to carry out this
project successfully.

We would like to thank all the teaching and non-teaching faculty of the [Link] extend a very
heartfelt thanks to our parents and friends for all the moral support they provided during the
preparation of this Project.

MANASA M K
SANJANA H P
T CHANNABASAVA
GNANESH KUMAR D P

i
Abstract

Lung cancer remains one of the leading causes of cancer-related mortality worldwide, primarily due to
late-stage diagnosis and limited early detection methods. This project proposes a Lung Cancer
Detection System that leverages machine learning techniques to identify potential lung cancer at an
early stage based on clinical and demographic data. The system utilizes a supervised learning model
trained on relevant features such as age, smoking history, genetic predisposition, environmental
exposure, and radiographic findings. These model aims to achieve high accuracy, sensitivity, and
specificity in cancer risk prediction. The final model is deployed via a user-friendly interface that
allows healthcare providers to input patient data and receive real-time risk assessments. This system
has the potential to support early intervention, improve patient outcomes, and reduce the burden on
healthcare [Link] cancer is one of the most prevalent and deadly forms of cancer, accounting
for millions of deaths annually worldwide. Its high mortality rate is primarily attributed to late-stage
diagnosis when the disease has already progressed significantly. Early detection remains a critical
factor in improving survival rates and treatment outcomes. Traditional diagnostic methods such as
biopsy, X-rays, CT scans, and histopathological examinations, while effective, are often time-
consuming, expensive, and may not be accessible in resource-limited settings. Hence, there is an
urgent need for an intelligent, cost-effective, and non-invasive approach to assist clinicians in
predicting lung cancer risk at an earlier stage. This project proposes a Lung Cancer Prediction System
based on machine learning (ML) techniques designed to analyze patient data and predict the likelihood
of lung cancer with high accuracy and reliability.

ii
Table of Contents

Acknowledgment i

Abstract ii

Table of Contents iii

List of Figures iv

List of Tables v

List of Acronyms v

1 INTRODUCTION 1
1.1 Scope of the Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Challenges . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Existing System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.5 Proposed system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.6 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.7 Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

2 LITERATURE REVIEW 6
2.1 Objectives of literature survey . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.1 Attention enhanced inceptionNext based hybrid deep learning model for lung
cancer detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.2 Advancing Oncology Diagnosis:AI enabled early detection of Lung cancer through
image analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.3 Early Detection of Lung Cancer Using Predictive Modeling Incorporating CT-
GAN Features and Tree-Based Learning . . . . . . . . . . . . . . . . . . . . . . 8
2.2.4 Early diagnosis of Lung Cancer diagnosis Throgh Deep learning . . . . . . . . . 8
2.2.5 End-to-end Fully Automated Lung Cancer detection System . . . . . . . . . . . 9
2.2.6 Advancing techniques for accurate lung cancer system . . . . . . . . . . . . . . 9
2.2.7 A transformer based multi scale deep learning model for lung cancer . . . . . . . 9
2.2.8 A wireless and machine learning based lung cancer detection system . . . . . . . 10
2.2.9 An integrated Data analysis for lung cancer detection system . . . . . . . . . . . 10
2.2.10 Advanced Cardiovascular disease detection system . . . . . . . . . . . . . . . . 11

iii
3 SYSTEM REQUIREMENTS SPECIFICATION 12
3.1 Purpose of Software Requirement Specification......................................................................12
3.2 Specific Requirements..............................................................................................................12
3.3 Product Perspective..................................................................................................................12
3.4 Functional Requirements.........................................................................................................13
3.5 Non-Functional Requirements.................................................................................................13
3.6 Hardware and Software Requirement......................................................................................13
3.6.1 Hardware Resource......................................................................................................13
3.6.2 Software Resources......................................................................................................14
3.7 Software Environment and tool................................................................................................14
3.7.1 Programming language................................................................................................14
3.7.2 Python Programming Language..................................................................................14
3.7.3 Website Frontend Development using HTML,CSS Javascript...................................14
3.7.4 Flask backend in Python..............................................................................................15
3.7.5 Deep Learning model in python..................................................................................15
3.8 Details of specification.............................................................................................................15
3.8.1 User view.....................................................................................................................16
3.8.2 Architectural view........................................................................................................18
3.8.3 Network Components..................................................................................................19

4 SYSTEM ANALYSIS AND DESIGN 20


4.1 Economical feasibility..............................................................................................................20
4.1.1 Economical Feasibility................................................................................................20
4.1.2 Technical Feasibility....................................................................................................20
4.1.3 Social Feasibility..........................................................................................................21
4.2 System Architecture..................................................................................................................21
4.3 System Design..........................................................................................................................22
4.4 Dataflow Diagram.....................................................................................................................23
4.5 Detailed Design........................................................................................................................24
4.6 Sequential diagram...................................................................................................................24

5 SYSTEM IMPLEMENTATION 26
5.1 Implementation module............................................................................................................26
5.1.1 Preprocessing Feature Engineering with Equilibrium Optimizer...............................26
5.1.2 Model Training and Evaluation...................................................................................27
5.1.3 Website Integration......................................................................................................28

6 CODE IMPLEMENTATION 30
6.1 Importing Libraries...................................................................................................................30
6.2 Data Collection.........................................................................................................................30
6.3 Data Preprocessing...................................................................................................................31
6.4 Splitting Data into Train Test and validation Set.....................................................................32
6.5 Model Selection........................................................................................................................33
6.6 Train The Model.......................................................................................................................33
6.7 Evaluating the Model...............................................................................................................35
6.8 Frontend Development.............................................................................................................37
6.9 Deployment..............................................................................................................................38

7 SYSTEM TESTING 39
7.1 Testing Process.........................................................................................................................39
7.2 Testing Objectives....................................................................................................................39
7.3 Test Environment.....................................................................................................................40
7.4 System Testing........................................................................................................................40
7.5 Testing Types Applied.............................................................................................................41
7.6 Testing Scenarios.....................................................................................................................42
7.7 Results and Observations..........................................................................................................43
7.8 Issues Identified and Fixed......................................................................................................43
7.9 Results and Observations..........................................................................................................43

8 RESULTS DISCUSSION AND PERFORMANCE ANALYSIS 45


8.1 Snapshots..................................................................................................................................45
8.1.1 Login Page...................................................................................................................45
8.1.2 Patients Details............................................................................................................45
8.1.3 User Interface...............................................................................................................50
8.1.4 Prediction Normal........................................................................................................51
8.1.5 Prediction cancer.........................................................................................................52
8.1.6 Confusion Matrix.........................................................................................................53
8.1.7 Performance analysis...................................................................................................55
8.1.8 Percentage of Normal vs Cancer Image......................................................................57

9 CONCLUSION AND FUTURE ENHANCEMENT 58


9.1 Conclusion................................................................................................................................58
9.2 Future Scope of the Project......................................................................................................58

Bibliography 59
List of Figures
Figure 3.1 : User veiw Flow Diagram for Lung Cancer Detection System............................................16
Figure 3.2 : Architechtural veiw Flow Diagram for Lung Cancer Detection System............................18
Figure 3.3 : Architechtural veiw Flow Diagram for Lung Cancer Detection System............................19
Figure 4.1 : Architechtural veiw Flow Diagram for Lung Cancer Detection System............................21
Figure 4.2 :System design for Lung Cancer Detection System..............................................................23
Figure 4.3 :Data Flow design for Lung Cancer Detection System.........................................................23
Figure 4.4 :Detailed design for Lung Cancer Detection System.............................................................24
Figure 4.5 :Sequential design for Lung Cancer Detection System.........................................................25
Figure 5.1 :Preprocessing Feature Engineering with EO........................................................................27
Figure 5.2:Model Training And Evaluation............................................................................................27
Figure 5.3:Preprocessing Feature Engineering with EO.........................................................................29
Figure 6.1 :Importing Libraries for LC...................................................................................................30
Figure 6.2 :Data Collection for LC.........................................................................................................31
Figure 6.3 :Data collection for LC..........................................................................................................31
Figure 6.4:Data splitting for LC..............................................................................................................33
Figure 6.5:Model Seelection for LC........................................................................................................33
Figure 6.6 :Evaluation for LC.................................................................................................................34
Figure 6.7 :Model Evaluation for LC......................................................................................................36
Figure 6.8 : Frontend Development for LC............................................................................................37
Figure 6.9 : Deployment for LC..............................................................................................................38
Figure 8.1 : Login Page for LC...............................................................................................................45
Figure 8.2 : Login Page for LC...............................................................................................................48
Figure 8.3: Patients Details page for LC.................................................................................................49
Figure 8.4 : User Interface for LC...........................................................................................................50
Figure 8.5 : Normal image......................................................................................................................51
Figure 8.6 : Cancer Image.......................................................................................................................53
Figure 8.7 : Confusion Matrix for LC.....................................................................................................54
Figure 8.8 : Performance Analysis for LC..............................................................................................56
Figure 8.9 : Performance Analysis for LC..............................................................................................57

iv
List of Tables
Table 7.1 : Testing results for Lung Cancer detection System.........................................................42
Table 7.2 : Identified issues and Fixes in Lung Cancer detection System........................................44

LIST OF ACRONYMS

PIR Passive Infrared


IR Infrared
NodeMCU Node Microcontroller Unit
ESP8266 a low-cost Wi-Fi microchip with full TCP/IP
AI Artificial Intelligence
TensorFlow an open-source machine learning library developed by Google
IAT Intelligence Awareness Target as a
Service IE2S Intelligence Energy Efficiency as a
Service IST Intelligence Service TAS
HVAC Heating, Ventilation, and Air
Conditioning DDPG Deep Deterministic Policy
Gradients DQN Deep Q-learning Networks
DDQN Double Deep Q-learning Networks
1D-DCNN One-Dimensional Deep Convolutional Neural Network
LSTM Long-short Term Memory
DCNN Deep Convolution Neural Network
LoRa Long Range

v
Lung cancer detection using machine learning (BCS786) 2025-26

CHAPTER 1

1 INTRODUCTION
Lung cancer remains one of the most significant global health challenges of the 21st century, with
con- siderable implications for mortality, morbidity, and healthcare systems. Characterized by the
uncontrolled proliferation of cells in the lungs, this malignancy has long been associated with tobacco
use, although it also arises in non-smokers due to a variety of genetic, environmental, and occupational
factors. Despite advances in diagnostic imaging, molecular profiling, and therapeutics, lung cancer
continues to have a poor prognosis, often due to late-stage diagnosis. This background explores the
foundational aspects of lung cancer to inform policy, clinical, and research [Link]
diagnostic techniques for lung cancer include chest X-rays, computed tomography (CT) scans,
biopsies, and bronchoscopy. While these methods are effective, they are often expensive, invasive, and
time-consuming, and may not be readily available in all healthcare settings, especially in low-resource
environments. These limitations have fueled research into the development of computer-aided
diagnosis (CAD) systems and predictive models that can help identify individuals at high risk of lung
cancer using easily obtainable data such as demo- graphic information, lifestyle factors, and medical
[Link] cancer is one of the most prevalent and deadly forms of cancer globally, largely due to its
late-stage diagnosis and rapid progression. Traditional diagnostic methods, such as chest X-rays, CT
scans, and biopsies, while effective to a degree, often fail to detect the disease at its early stages,
leading to delayed treatment and poor prognosis. In response to these limitations, researchers have
increasingly turned to machine learning (ML) as a promising tool for im- proving lung cancer detection
and prediction. Machine learning, a subset of artificial intelligence, enables the development of
predictive models that can analyze complex datasets—including medical imaging, clinical records, and
genomic information—to identify patterns and make data-driven decisions. These models can assist
healthcare professionals by providing more accurate and earlier diagnoses, supporting risk
stratification, and even forecasting patient outcomes. Common ML algorithms used in lung can- cer
prediction include support vector machines, decision trees, random forests, logistic regression, and
deep learning techniques such as convolutional neural networks, especially when processing
radiological images. By leveraging large datasets and sophisticated pattern recognition, ML-based
systems have demonstrated improved diagnostic accuracy and efficiency compared to traditional
methods. However, challenges such as data quality, model interpretability, and clinical integration
remain significant barriers to widespread adoption. Nonetheless, ongoing advancements in computing
power, data availability, and algorithm design continue to push the boundaries of what is possible,
making machine learning a vital area of research in the fight against lung [Link],
integrating machine learning with electronic health records and real-time monitoring tools opens new
avenues for continuous patient risk assessment. The use of explainable AI is also gaining traction,
aiming to make ML models more transparent and trust- worthy for clinical decision-making. As more
annotated medical datasets become publicly available, the training and validation of robust models are
becoming increasingly feasible. Overall, machine learning is not only enhancing early detection but
also paving the way for personalized medicine in lung cancer [Link] innovations are helping

Dept. of CS&E GEC, KUSHALNAGAR Page 1


Lung cancer detection using machine learning (BCS786) 2025-26
bridge the gap between technology and clinical practice.

Dept. of CS&E GEC, KUSHALNAGAR Page 2


Lung cancer detection using machine learning (BCS786) 2025-26

1.1 Scope of the Work


The project focuses on early detection of lung cancer using machine learning techniques. It aims to
reduce manual diagnosis errors through automated analysis of medical data. The system accepts CT
scan images and patient symptoms as input data. CNN (Convolutional Neural Network) is used for
image feature extraction and classification. Decision Tree algorithm is employed for analyzing
symptom-based data. The model integrates both image and symptom data to enhance prediction
accuracy. It helps doctors in decision-making by providing reliable cancer predictions. It supports
faster and more accurate detection compared to traditional methods. The dataset used is preprocessed
to remove noise and improve training efficiency. The model’s accuracy is evaluated using
performance metrics like precision and recall. The application can be extended to support real-time
medical image diagnosis. The project promotes the use of AI in healthcare for early disease prediction.
It provides a cost-effective and scalable solution for hospitals and clinics. Future enhancements may
include integration with cloud systems for remote analysis.

1.2 Motivation
• Early Detection Saves Lives:Lung cancer is one of the leading causes of death worldwide, and
most cases are diagnosed at later [Link] and accurate detection can significantly improve
the chances of successful treatment and survival.

• Limitation of traditional techniques:Manual diagnosis from medical images is time-consuming


and prone to human [Link] project is motivated by the goal of creating an efficient,reliable
and automated diagnostic support system.

1.3 Challenges
Developing a Lung Cancer detection system using machine learning involves several technical and
practi- cal challenges One major challenge is the quality and availability of medical datasets, as real
clinical data is limited, imbalanced, and often contains noise or missing values. This requires careful
preprocessing and feature engineering to ensure reliable training. Another challenge is the high
variability in patient CT scan image patterns and biomedical features, which makes it difficult for the
model to generalize well across diverse populations. Selecting the most relevant features from
multiple acoustic measures is also complex, as unnecessary features may reduce the model’s accuracy.
Additionally, choosing the right model and tuning its hyperparameters requires extensive
experimentation to achieve optimal per- [Link] the trained model into a user-friendly
web application introduces challenges such as ensuring fast prediction time, handling batch uploads,
and maintaining data privacy.

• Limited availability of high-quality, real-world clinical datasets.


• Imbalanced data where Lung cancer data are smaller than normal cells.
• Presence of noise, missing values, and inconsistencies in biomedical image features.

Dept. of CS&E GEC, KUSHALNAGAR Page 3


Lung cancer detection using machine learning (BCS786) 2025-26

• High variability in patient CT scan image patterns, affecting model generalization.


• Difficulty in selecting the most relevant acoustic features for accurate prediction.
• Need for extensive hyperparameter tuning to achieve optimal model performance.
• Ensuring the model does not overfit due to small dataset size.
• Integrating ML models into a Flask web application with smooth performance.

1.4 Existing System


Traditional lung cancer prediction systems using machine learning primarily relied on structured clinical
data and conventional ML algorithms to assess cancer risk. These systems used patient information
such as age, gender, smoking history, exposure to carcinogens, family medical history, and basic
laboratory results. Early models typically employed algorithms like logistic regression, decision trees,
Na¨ıve Bayes classifiers, and support vector machines (SVMs). These approaches aimed to identify
patterns and correlations within the data to predict the likelihood of lung cancer, often focusing on
distinguishing between high-risk and low-risk individuals. One well-known traditional model is the
PLCOm2012, developed using data from the Prostate, Lung, Colorectal, and Ovarian Cancer
Screening Trial. It uses a multivariable logistic regression model to predict six-year risk of lung
cancer, guiding decisions on screening eligibility. Although these traditional systems were less
complex than modern deep learning- based models, they were interpretable, computationally efficient,
and easier to implement in clinical environments. However, their accuracy was limited by the
simplicity of the features and their inability to process complex data types like medical images or
genomic sequences..lung cancer prediction using machine learning (ML) have significantly advanced
over recent years, driven by the need for early and accurate diagnosis to improve patient survival
rates. These systems primarily utilize various ML algorithms to analyze medical data such as imaging
scans (CT, X-ray, MRI), clinical records, and sometimes genetic information to predict the presence or
progression of lung cancer. Early approaches often involved traditional ML techniques like Support
Vector Machines (SVM), K-Nearest Neighbors (KNN), Decision Trees, and Random Forests. These
methods, while effective to some degree, relied heavily on manual feature engineering and often
struggled with complex data patterns.

1.5 Proposed system


The proposed lung cancer prediction system utilizes advanced machine learning techniques to enable
early and accurate detection of lung cancer from medical imaging and clinical data. By combining
deep learning models for image analysis with traditional ML algorithms on patient information, the
system aims to improve diagnostic accuracy and provide interpretable results. This approach addresses
challenges such as data imbalance and feature extraction to support timely clinical decision-making
and enhance patient outcomes.

Dept. of CS&E GEC, KUSHALNAGAR Page 4


Lung cancer detection using machine learning (BCS786) 2025-26

1.6 Problem Statement


Lung cancer remains one of the most prevalent and deadly forms of cancer worldwide, primarily due
to its diagnosis at advanced stages when treatment options are limited and less effective. Traditional
diagnostic methods, such as imaging and biopsies, are often expensive, time-consuming, and
susceptible to human error, which can delay early detection. Early identification of lung cancer
significantly increases the chances of successful treatment and survival. With the growing availability
of medical data, machine learning presents a promising approach to detect lung cancer patterns and
predict risks with higher accuracy and efficiency. However, building a reliable prediction system
requires not only high-quality data but also the integration of robust algorithms and clinical insights.
This project aims to develop a machine learning-based lung cancer prediction system that can assist
healthcare professionals in early diagnosis and personalized treatment planning.

1.7 Objectives
Here are well-defined objectives for a Lung Cancer Prediction System, suitable for inclusion in
technical proposal, or project documentation. These objectives focus on medical, technical, and social
aspects of the lung cancer prediction system.
• To design a system architecture that integrates software components.
• To implement and evaluate the performance of the proposed system in terms of energy savings
and user satisfaction.

• To compare the proposed system with existing energy management solutions and highlight its
advantages.

– Early Detection and Diagnosis: Accurately identify individuals at high risk of developing
lung cancer at an early stage. Early-stage lung cancer is often asymptomatic but has a
significantly higher survival rate.
– Risk Stratification: Stratify patients based on risk factors such as age, smoking history,
genetic predispositions, environmental exposures. Tailored screening and surveillance
plans can be implemented more effectively by focusing on high-risk groups.
– Integration of Multimodal Data: Integrate diverse data types (e.g., electronic health
records, imaging, genetic data, lab tests) into a unified predictive model. Multimodal
approaches improve predictive performance .
– Improve Diagnostic Accuracy: Enhance the diagnostic precision of lung cancer compared
to traditional clinical methods. Reduce false positives and false negatives to avoid
unnecessary procedures or missed diagnoses.
– Clinical Decision Support:Provide clinicians with data-driven recommendations or risk
scores to aid in [Link] evidence-based clinical pathways, improve
consis- tency in care, and reduce physician workload.

Dept. of CS&E GEC, KUSHALNAGAR Page 5


Lung cancer detection using machine learning (BCS786) 2025-26

– Real-Time Prediction Capability: Enable real-time or near-real-time prediction for use in


clinical settings or health screenings. Timely insights can significantly impact treatment
decisions and patient outcomes.
– Interpretability: To provide explainable and interpretable results that can assist clinicians
in understanding and trusting the model’s predictions.
– Robust and Scalable Model: To build a robust, scalable, and efficient system capable of
working with diverse datasets and applicable in real clinical environments.
– Real-Time Processing: Design the system to deliver fast and efficient predictions suitable
for real-time clinical applications.
– User Interface: Develop a user-friendly interface that allows to help in diagnosis.

Dept. of CS&E GEC, KUSHALNAGAR Page 6


Lung cancer detection using machine learning (BCS786) 2025-26

CHAPTER 2

2 LITERATURE REVIEW

A literature survey or a literature review in a project report shows the various analyses and research
made in the field of interest and the results already published, taking into account the various
parameters of the project and the extent of the project. Literature survey is mainly carried out in order
to analyse the background of the current project which helps to find out flaws in the existing system
guides on which unsolved problems we can work out. So, the following topics not only illustrate the
background of the project but also uncover the problems and flaws which motivated to propose
solutions and work on this project.
A literature survey is a text of a scholarly paper, which includes the current knowledge including
substantive findings, as well as theoretical and methodological contributions to a particular topic.
Liter- ature reviews use secondary sources, and do not report new or original experimental work. Most
often associated with academic oriented literature, such as a thesis, dissertation or a peer-reviewed
journal article, a literature review usually precedes the methodology and results sectional though this is
not always the case. Literature reviews are also common in are search proposal or prospectus (the
document that is approved before a student formally begins a dissertation or thesis). Its main goals are
to situate the current study within the body of literature and to provide context for the particular reader.
Literature reviews are a basis for researching nearly every academic field. A literature survey includes
the following: enumerate

• Existing theories about the topic which are accepted universally.


• Books written on the topic, both generic and specific.
• Research done in the field usually in the order of oldest to latest.
• Challenges being faced and on-going work, if available.

Literature survey describes about the existing work on the given project. It deals with the problem
associated with the existing system and also gives user a clear knowledge on how to deal with the
existing problems and how to provide solution to the existing problems.

2.1 Objectives of literature survey


• Learning the definitions of the concepts.
• Access to latest approaches, methods and theories
• Discovering research topics based on the existing research
• Concentrate on your own field of expertise even if another field uses the same words, they
usually mean completely.

Dept. of CS&E GEC, KUSHALNAGAR Page 7


Lung cancer detection using machine learning (BCS786) 2025-26

• It improves the quality of the literature survey to exclude side tracks Remember to
explicate what is excluded.

2.2 Related Work


2.2.1 Attention enhanced inceptionNext based hybrid deep learning model for lung cancer
detec- tion

This research introduces an Attention Enhanced InceptionNeXt-Based Hybrid Deep Learning Model for
the critical task of early lung cancer detection using Computed Tomography (CT) images. The
model’s core innovation is the fusion of Convolutional Neural Networks (CNN’s) and Vision
Transformers (ViTs) to leverage the strengths of both architectures. It integrates novel InceptionNeXt
blocks with optimized grid and block attention mechanisms. This hybrid approach effectively captures
both fine-grained local details and large-scale global contextual features in complex lung nodule
patterns. The comprehensive system is capable of not only differentiating between malignant and
benign nodules but also classifying specific subtypes, including adenocarcinoma, large cell carcinoma,
and squamous cell [Link] model was rigorously validated using two public datasets, Chest CT
and IQ-OTH/NCCD, demonstrating statistically significant superiority over five leading CNN-based
and five ViT-based [Link] achieved impressive, state-of-the-art classification accuracies of 99.54
percent on the IQ-OTH/NCCD dataset and
98.41 percent on the Chest CT dataset. Crucially, the architecture is lightweight, containing only 18.1
million parameters. This makes the model an efficient, scalable, and powerful solution for clinical
environments. By providing highly accurate and fast diagnostics, this model holds significant potential
to improve clinical workflows and ultimately increase patient survival [Link] study focuses on
developing a machine learning-based system to predict lung cancer using medical imaging data,
primarily CT scans, along with relevant clinical information such as patient demographics and medical
history. It aims to design and evaluate algorithms capable of early detection of lung cancer nodules
and classification of their malignancy [1].

2.2.2 Advancing Oncology Diagnosis:AI enabled early detection of Lung cancer through image
analysis

Against the backdrop of the pervasive global challenge of cancer, with particular emphasis on lung can-
cer (LC), this study centers its investigation on the critical realm of early detection leveraging artificial
intelligence (AI) within the domain of histological image analysis. Through the fusion of
DenseNet201 with color histogram techniques, a novel hybrid feature set emerges, engineered to
elevate classification accuracy. The comprehensive evaluation encompasses eight diverse machine
learning (ML) algorithms, spanning from K-Nearest Neighbors (KNN) to Support Vector Machines
(SVM), including notable con- tenders such as LightGBM (LGBM), CatBoost, XGBoost, decision
trees (DT), random forests (RF), and multinomial naive Bayes (MultinomialNB). This rigorous
examination illuminates a distinguished model, achieving a remarkable accuracy rate of
99.683methodology to breast cancer detection, utilizing the BreakHis dataset, yields a commendable
accuracy rate of 94.808histopathological analysis, position- ing it as a pivotal force in advancing

Dept. of CS&E GEC, KUSHALNAGAR Page 8


Lung cancer detection using machine learning (BCS786) 2025-26
diagnostic capabilities. A meticulous comparative analysis not only

Dept. of CS&E GEC, KUSHALNAGAR Page 9


Lung cancer detection using machine learning (BCS786) 2025-26

underscores the merits but also elucidates the limitations of existing AI applications in medical
imaging, thereby charting a roadmap for future refinements and clinical deployments. Consequently,
continued research in AI within clinical settings is advocated, with the ultimate aim of fortifying early
cancer diagnosis and subsequently enhancing patient outcomes through judicious therapeutic
interventions [2].

2.2.3 Early Detection of Lung Cancer Using Predictive Modeling Incorporating CTGAN
Features and Tree-Based Learning

The paper titled “Early Detection of Lung Cancer Using Predictive Modeling Incorporating CTGAN
Features and Tree-Based Learning” proposes an advanced hybrid framework for accurate and early
lung cancer prediction. The study addresses the major issue of class imbalance in medical datasets,
where cancer cases are fewer than normal samples. It uses Conditional Tabular Generative Adversarial
Networks (CTGAN) to generate realistic synthetic data for the minority class, creating a more balanced
dataset. This enriched data is then used to train a Random Forest classifier, which ensures robust and
interpretable predictions. The hybrid CTGAN-RF model achieved an impressive accuracy of
98.93percent, with high precision and recall. It effectively reduces false positives and negatives,
improving diagnostic reliability. The model also highlights important features influencing lung cancer
risk, making it valuable for clinical use. Its scalability and interpretability make it suitable for other
medical applications as well. Overall, the framework enhances predictive performance and supports
early detection, potentially saving more lives [3].

2.2.4 Early diagnosis of Lung Cancer diagnosis Throgh Deep learning

Lung cancer continues to be a leading cause of cancer-related mortality globally, primarily due to
late-stage diagnosis. Non-invasive diagnostic techniques, especially those based on exhaled breath
analysis, have recently garnered significant interest. This study explores a novel approach to lung
cancer detection by analyzing volatile organic compounds (VOCs) such as formaldehyde, ethanol,
acetone, and chloroform present in exhaled breath. Signal processing techniques, including Wavelet
Transform (WT) and Wavelet Packet Transform (WPT), were employed to generate and analyze
signals derived from VOC data. Features extracted from these transformed signals were subsequently
classified using various machine learning and deep learning models, namely Support Vector Machine
(SVM), k-Nearest Neighbours (KNN), Random Forest (RF), Multi-Layer Perceptron (MLP), and
Convolutional Neural Network (CNN). A comprehensive comparative evaluation was conducted to
assess the impact of WT and WPT on model performance. Results indicate that WPT significantly
enhances feature representation, improving classification accuracy across models. Among all evaluated
models, the CNN outperformed others, achieving a maximum accuracy of 98.21capability of deep
learning models in handling complex VOC patterns and highlights their potential in clinical
applications. The findings of this research affirm that integrating advanced signal processing
techniques with deep learning can substantially improve the accuracy and reliability of non-invasive
lung cancer diagnostics. The proposed method offers a promising, efficient, and patient-friendly
alternative to conventional diagnostic procedures [4].

Dept. of CS&E GEC, KUSHALNAGAR Page 10


Lung cancer detection using machine learning (BCS786) 2025-26

2.2.5 End-to-end Fully Automated Lung Cancer detection System

The computer aided diagnosis of lung cancer is majorly focused on detection and segmentation with
very less work reported on volume estimation and grading of cancerous nodule. Further, lung cancer
segmentation systems are semi automatic in nature requiring radiologists to demarcate cancerous
portions on every slice. This leads to subjectivity and delayed diagnosis. Further, these techniques
are based on standard convolution leading to inaccurate segmentation in terms of actual boundary
retention of the cancerous nodule. Also, there is a need of automatic system that not only grades the
lung cancer based on actual parameters but also enables early warning for flagging of anomalies in
periodic screening. This research work reports the design of a fully automated end-to-end screening
system that consists of 5 major models with an improved performance on cancer detection,
segmentation, volume estimation, grading, and an early warning system. The traditional convolutional
technique is modified to allow for retention of actual shape of cancerous nodule. The simultaneous
segmentation of cancer, lymph nodes and trachea is also achieved through a focus module and a
modified loss function to remove redundancy and achieve an accuracy of 92.09estimation model is
developed using GPR interpolation to give an improved accuracy of 94.18model based on the TNM
classification standard is developed to grade the detected cancerous nodule to one of the six grades
with an accuracy of 96.4system for changes in the CT scans of lung cancer patients under treatment.
The research is undertaken in collaboration with Nanavati Hospital, Mumbai, and all the models are
validated on a real dataset obtained from the hospital [5]

2.2.6 Advancing techniques for accurate lung cancer system

Early detection of lung cancer is crucial for improving patient survival and reducing mortality.
However, medical datasets often face challenges like irrelevant features and class imbalance,
complicating accurate predictions. This study presents a comprehensive AI-powered lung cancer
classification approach that enhances predictive accuracy and treatment planning. Our methodology
combines Recursive Feature Elimination with Support Vector Machines (RFE-SVM) for effective
feature selection and employs the XGBoost ensemble learning algorithm for classification, optimized
using the Nelder-Mead algorithm. Evaluating the model’s generalizability on two distinct lung cancer
datasets, results show that our approach outperforms traditional machine learning models, achieving
100importance of advanced computational techniques in healthcare, paving the way for more
personalized and effective patient care [6].

2.2.7 A transformer based multi scale deep learning model for lung cancer

Lung cancer surgery presents significant challenges due to its complexity and the need for precise
risk stratification to improve patient outcomes. This study presents a Transformer-based multi-scale
deep learning framework that integrates imaging, clinical, and genomic data to optimize decision-
making surrounding surgery. By using the self-attention mechanism in Transformers and multi-scale
feature extraction, the model expertly explores different data modalities. Therefore, it enables a precise
prediction of surgical risks, such as delayed extubation and mortality; besides, it further performs risk
stratification, having the model improve resource utilization by identifying high- and low-risk patients,

Dept. of CS&E GEC, KUSHALNAGAR Page 11


Lung cancer detection using machine learning (BCS786) 2025-26
ensuring that intervention is matched accordingly and resources are not wasted on unnecessary
measures.

Dept. of CS&E GEC, KUSHALNAGAR Page 12


Lung cancer detection using machine learning (BCS786) 2025-26

Thorough evaluations, including ablation experiments, case analyses, and error analyses, prove the
model’s robustness and practical applicability in a clinical setting. This study demonstrates the game-
changing potential of advanced deep learning techniques in the field of precision medicine and provides
a concrete framework for personalized treatment in lung cancer surgery, laying the foundation for
broader healthcare applications [7].

2.2.8 A wireless and machine learning based lung cancer detection system

Lung cancer remains one of the leading causes of cancer-related deaths globally, with approximately
2.5 million new cases and 1.8 million deaths reported annually according to World Health
Organization in 2022. Early and accurate detection is crucial for improving survival rates through
timely treatment. However, current detection methods face challenges such as invasiveness, high costs,
and delayed diag- nosis. Electrochemical biosensors, which use potentiostats to detect biological
analytes by controlling cell voltage and measuring current, voltage, or impedance, offer a rapid and
sensitive alternative. Nev- ertheless, many existing potentiostats are limited by narrow voltage ranges,
single current measurement capabilities, and inadequate support for advanced electrochemical
techniques. This study presents a novel wireless electrochemical biosensor potentiostat system
enhanced with machine learning and Internet of Things (IoT) integration for the detection of lung
cancer biomarkers, specifically the CD63 protein. The system is designed to be portable, energy
efficient, cost-effective, and high sensitive, supporting advanced electrochemical techniques such as
cyclic voltammetry (CV) and square wave voltammetry (SWV). It achieves a limit of detection (LoD)
of 2 × 101 particles/mL and a sensitivity of 5.188 µA per log concentration unit, comparable to the
commercial systems like uStat8000 potentiostat. Furthermore, the integrated random forest classifier
enables fast and automated data interpretation, achieving accuracy rates of 83.5portable, and scalable
solution for point-of-care diagnostics, contributing to early detection and improved prognosis in lung
cancer management [8].

2.2.9 An integrated Data analysis for lung cancer detection system

Lung cancer is the leading cause of cancer death worldwide, regardless of gender. Among the types of
lung cancer, Lung Squamous Cell Carcinoma (LUSC) is the second most common type, characterized
by a diagnosis in advanced stages, a poor prognosis, and a high association with smoking. Due to the
severity of lung cancer, it is essential to understand its molecular mechanisms. In this context, this
study uses transcriptomic and clinical data to implement bioinformatics pipelines, and machine
learning, through random forest models to predict patients’ overall survival and obtain a gene signature
of LUSC for tumor progression. We analyzed clinical and molecular data from the project LUSC-
TCGA, and we performed differential expression analyses (DEA) comparing normal tissues against
tumor tissues. Based on DEA-selected genes, the patients were divided into three clusters, followed by
a feature selection and classification. Finally, it was possible to obtain classifications results close to
70clusters. Finally, we also performed a functional enrichment analysis. The clustering analysis
revealed in cluster 2, enriched genes such as CDT1, CENPI, and NLGN1, associated with the
molecular EMT (epithelialto-mesenchymal transition) process [9]

Dept. of CS&E GEC, KUSHALNAGAR Page 13


Lung cancer detection using machine learning (BCS786) 2025-26

2.2.10 Advanced Cardiovascular disease detection system

Smoking has a serious complicated impact on Cardiovascular Health (CVH), which makes it an easily
controlled risk factor for Cardiovascular Disease (CVD). The importance of early diagnosis and
treatment is crucial because of CVD, which remains to be the leading cause of morbidity and death
across the globe, therefore, smoking behaviour prediction is essential. This research explores the
complex relationship between smoking and CVD, and clarifies how smoking negatively impacts CVH.
The first step of the analysis is removing the Not-a-Number (NaN) values in the smoking behaviour
bio signals data because all NaN values are in the target column ‘smoking’, which could lead to
generate biased predictions. Further, robust scaling is applied to standardize the data, where all features
are on the same scale. The Random Forest feature selection technique is applied to select the most
relevant features for smoking status prediction. The Borderline-Synthetic Minority Oversampling
Technique is used to balance the minority class with the majority class, to reduce the risk of overfitting
in results. Finally, the cleaned and preprocessed data is passed to the Proposed Blending Model (PBM).
In PBM, the Echo State Network and GoogleNet are placed on the base layer, and AlexNet is placed on
the meta layer to make a robust smoking status prediction model. In terms of accuracy, precision,
recall, and f1-score, the PBM outperforms the baseline techniques with an improvement score of 5are
validated through a 10-fold cross-validation method, which can increase its reliability and durability.
Finally, the SHapley Additive exPlanations technique is used to understand the predictions made by
the PBM. It can reveal the explainability and interpretability of the PBM. Conclusively, during the
thorough simulation process, the results are collected and the ablation study is performed. The
simulation results show that the early prediction of hidden smokers can help to reduce the effect of the
CVDs. It also makes proactive healthcare strategies possible for better future outcomes and public
health [10].

Dept. of CS&E GEC, KUSHALNAGAR Page 14


Lung cancer detection using machine learning (BCS786) 2025-26

CHAPTER 3

3 SYSTEM REQUIREMENTS SPECIFICATION


The Lung Cancer Prediction System is designed to predict the risk of lung cancer using machine
learning techniques such as CNN and Decision Tree algorithms. It analyzes patient data, symptoms,
and lung images to detect possible cancer presence at an early stage. The system requires Python,
TensorFlow, and related ML libraries for implementation. It aims to assist doctors by providing
accurate and quick predictions. The software needs a computer with at least 8GB RAM, GPU support,
and a stable internet connection. The system includes data preprocessing, training, and testing
modules. It provides results with prediction accuracy and confidence scores. Security and privacy of
patient data are ensured through encryption and access control. The user interface is simple and allows
easy data input and result viewing. Overall, it acts as a supportive diagnostic tool for early lung cancer
detection.
3.1 Purpose of Software Requirement Specification
The purpose of the Software Requirements Specification (SRS) is to clearly define the complete de-
scription of the software’s functionality, objectives, and performance requirements. It serves as a guide
for developers, testers, and users to understand what the system should do. The SRS ensures that all
stakeholders have a common understanding, reducing errors and misunderstandings during
development. It also helps in planning, design, and verification of the software to meet user needs
effectively.

3.2 Specific Requirements


The specific requirements of the Lung Cancer Prediction System include collecting patient data such
as age, smoking history, and symptoms as input. The system must preprocess this data and use trained
machine learning models like CNN and Random Forest for prediction. It should provide accurate and
fast results with a user-friendly interface. The system must ensure data security and confidentiality.
Additionally, it should support graphical result visualization and allow easy model updates with new
datasets.

3.3 Product Perspective


The product perspective of the Lung Cancer Prediction System is to serve as an intelligent medical
support tool that assists doctors and patients in early detection of lung cancer. It functions as a
predictive system that analyzes medical data and symptoms using machine learning algorithms like
CNN and Random Forest. The system can be integrated with hospital databases or used as a
standalone diagnostic tool. It bridges the gap between manual diagnosis and automated prediction,
improving accuracy and efficiency. Overall, it aims to enhance clinical decision-making and reduce
diagnostic time through AI-driven analysis.

Dept. of CS&E GEC, KUSHALNAGAR Page 15


Lung cancer detection using machine learning (BCS786) 2025-26

3.4 Functional Requirements


• The system should allow users to input patient data such as age, gender, smoking history,
and symptoms.
• It should preprocess and clean the input data before prediction.
• The system must use trained ML models (CNN and Random Forest) to analyze and predict
the presence of lung cancer.
• It should display prediction results along with confidence levels or accuracy scores.
• The system should allow uploading of medical images (like CT or X-ray scans) for CNN-
based analysis.
• It should store and retrieve patient reports securely.
• The system must allow administrators to update or retrain the model with new datasets.

3.5 Non-Functional Requirements


• The system should provide quick and accurate predictions with minimal response time.
• It must ensure data privacy and security through encryption.
• The interface should be simple, intuitive, and user-friendly.
• The system should be reliable and available 24/7 without frequent crashes.
• It must be scalable to handle large datasets and multiple users.
• The software should be compatible with major operating systems and browsers.
• It should maintain high accuracy, preferably above 90

3.6 Hardware and Software Requirement

3.6.1 Hardware Resource

– Personal Computer/laptop
∗ Processor:intel i5/i7 or AMD Ryzen 5/7
∗ RAM:Minimum 8GB (16 GB recommended for deep learning)
∗ Storage:At least 256 GB SSD for fast data access
– Cloud Resources(e.g.,Google Colab,AWS,Azure):
∗ GPU support (NVINDIA Tesla K80/T4/V100) for training deep learning models.
∗ On demand Scalable Computer instances

Dept. of CS&E GEC, KUSHALNAGAR Page 16


Lung cancer detection using machine learning (BCS786) 2025-26

3.6.2 Software Resources

Programming Languages and Environment


Python:Primary language due to its strong machine learning librariesJupyter Notebook:For in-
teractive data exploration and model training

• Machine Learning Libraries


• TensorFlow: For implementing deep learning models.
• Librosa / Python-speech-features: For audio feature extraction
• Scikit-learn: For additional machine learning utilities.
• NumPy: For data manipulation and numerical computations
• Matplotlib / Seaborn:: For visualization of model performance
• Pandas: For data manipulation and analysis.

3.7 Software Environment and tool


3.7.1 Programming language

The language used for implementation of project must be platform independent,simple and power-
ful,object oriented,robust,interactive ,easy to learn, dynamic and extensible.

3.7.2 Python Programming Language

The Lung Cancer Prediction System is developed using the Python programming language due to its
simplicity, flexibility, and powerful machine learning libraries such as TensorFlow, Keras, and Scikit-
learn. In this project, Python is used for data preprocessing, model training, and prediction tasks using
algorithms like CNN and Random Forest. The backend handles the core logic, database connections,
and ML model integration, ensuring smooth data flow and accurate predictions. The frontend is
designed with HTML, CSS, and Flask framework to create a user-friendly interface for inputting patient
details and displaying results. The system allows users to upload medical data or images, which are
processed by the backend for analysis. The connection between frontend and backend ensures real-
time interaction and efficient performance. This architecture provides both functionality and
simplicity, making it suitable for clinical or educational use. Overall, the integration of Python in both
backend computation and web development makes the project efficient, accurate, and easy to maintain.

3.7.3 Website Frontend Development using HTML,CSS Javascript

The frontend of the Lung Cancer Prediction website is designed to be intuitive and responsive,
ensuring that users can easily navigate across different sections such as symptom entry, image upload,
and result

Dept. of CS&E GEC, KUSHALNAGAR Page 17


Lung cancer detection using machine learning (BCS786) 2025-26

viewing. HTML defines the structure of the web pages, while CSS provides an attractive layout with
well-organized forms and visually appealing buttons.
JavaScript enhances interactivity by performing real-time checks on user inputs, image size, and
format before sending them to the backend. The system also provides alerts or messages to guide users
during data entry. Once the user submits the information, the frontend communicates securely with the
backend to process the data through machine learning models. After prediction, the result—whether
normal, low risk, or high risk—is displayed with clear visualization.
Overall, the frontend ensures a seamless user experience, combining simplicity, clarity, and
efficiency for accurate lung cancer prediction.

3.7.4 Flask backend in Python

The backend of the Lung Cancer Prediction System is developed using Flask, a lightweight and
powerful web framework in Python. Flask handles all server-side operations, such as receiving user
inputs, processing uploaded lung images, and integrating with machine learning models for prediction.
When the user submits symptoms and image data from the frontend, Flask routes this information to
the prediction module, where trained models like CNN and Random Forest analyze it. The CNN
model processes the image to detect lung abnormalities, while the Random Forest model evaluates
symptom- based data to enhance accuracy. Flask then combines the results and sends the final
prediction back to the frontend for display. The backend ensures smooth communication between the
user interface and the ML algorithms, maintaining data security, scalability, and efficiency. It also
allows easy model updates and real-time prediction, making the system reliable for practical medical
applications.

3.7.5 Deep Learning model in python

The Deep Learning model in the Lung Cancer Prediction System is implemented using Python with
frameworks like TensorFlow and Keras. The model primarily uses a Convolutional Neural Network
(CNN), which is highly effective in analyzing medical images such as chest X-rays or CT scans. The
CNN extracts important features like textures, shapes, and patterns from the lung images to detect
possible cancerous regions. The dataset is preprocessed by resizing images, normalizing pixel values,
and augmenting data to improve model performance. The network consists of multiple convolutional,
pooling, and dense layers that help in accurate feature extraction and classification. The model is
trained on a large dataset to differentiate between normal and cancer-affected lungs. Once trained, it is
integrated into the Flask backend for real-time prediction. This deep learning model enhances
accuracy, reliability, and early detection, making the system a powerful tool for lung cancer diagnosis.

3.8 Details of specification


The Lung Cancer Prediction System using Machine Learning is designed to provide early and accurate
detection of lung cancer by analyzing both medical images and patient symptoms. The system is
developed using Python as the primary programming language, integrating machine learning and deep
learning algorithms such as Convolutional Neural Network (CNN) and Random Forest for precise
Dept. of CS&E GEC, KUSHALNAGAR Page 18
Lung cancer detection using machine learning (BCS786) 2025-26
prediction.

Dept. of CS&E GEC, KUSHALNAGAR Page 19


Lung cancer detection using machine learning (BCS786) 2025-26

The frontend of the system is built using HTML, CSS, and JavaScript, offering a simple and
interactive interface where users can input symptoms and upload lung X-ray or CT scan images. The
backend uses the Flask framework in Python, which acts as a bridge between the user interface and the
ML models, managing requests, processing inputs, and displaying the prediction results.
The system accepts both image and text data as inputs. The CNN model processes image data to
identify abnormal lung patterns, while the Random Forest algorithm analyzes symptom-based data to
improve prediction accuracy. The outputs are categorized into different risk levels—normal, low risk,
or high risk—helping in early diagnosis. The database stores user data, images, and prediction results
securely. The system is designed to be scalable, lightweight, and efficient, allowing deployment on
both local and cloud servers.
The software requires Python 3.8 or above, Flask, TensorFlow/Keras, and scikit-learn libraries.
The hardware requirements include at least 8GB RAM, a modern processor (Intel i5 or above), and a
stable internet connection for online use. The system ensures high accuracy, reliability, and fast
processing, minimizing manual diagnostic errors. With a user-friendly interface and AI-driven
backend, this project demonstrates how technology can assist in automated medical diagnosis,
reducing human workload and supporting timely clinical decision-making.

3.8.1 User view

The user view of the Lung Cancer Prediction System provides a simple, interactive, and intuitive
interface designed for easy use by both patients and healthcare professionals. When the user opens the
system, they are greeted with a clean homepage that explains the purpose of the project and guides
them through the prediction process. The user can enter symptom details such as cough, chest pain,
shortness of breath, or fatigue into provided input fields. Additionally, the system allows users to
upload lung images such as chest X-rays or CT scans directly from their device. Once the necessary
data is entered, the user simply clicks the “Predict” button to submit their information.
Behind the scenes, the data is processed by machine learning and deep learning models integrated
through Flask in Python. The results are then displayed clearly on the screen, indicating whether the
user is at normal, low, or high risk of lung cancer. The interface is responsive, ensuring compatibility
across different devices like laptops and mobile phones. The user also receives guidance messages for
incomplete inputs or incorrect image formats. Overall, the user view emphasizes ease of access, clear
communication, and reliability, making the system efficient for real-time lung cancer prediction and
helping users gain valuable health insights in a few simple steps.

• User Interaction: The process begins when the user visits the website dashboard, where
they can upload a lung image (such as an X-ray or CT scan) or enter symptoms manually
for analysis.
• Upload Image / Symptoms: The system accepts inputs from users in the form of medical
images or textual symptom data. These inputs are the foundation for predicting whether the
lung condition is normal or cancerous.

Dept. of CS&E GEC, KUSHALNAGAR Page 20


Lung cancer detection using machine learning (BCS786) 2025-26

Figure 3.1 : User view

• Real-Time Processing: Once the input is received, the system starts processing the data
immediately to provide instant results without manual intervention.
• Image Pre-processing: The uploaded images go through preprocessing steps like resizing,
normalization, and denoising. These operations remove unwanted noise and standardize
the image quality, ensuring accurate model predictions.
• Feature Extraction AI Model: After preprocessing, important features are extracted from
the image using advanced AI and machine learning techniques. These features are then
analyzed by the trained deep learning model to identify disease patterns.
• Prediction Output (Probability Score): The AI model produces a probability score, such as
“98.5 percent Malignant,” which represents the confidence level of the model in detecting
cancerous regions in the lung.
• Classification Rule: Based on the probability score, a threshold (usually 50percent) is
applied. If the score exceeds the threshold, the system classifies the case as “Malignant”;
otherwise, it is labeled as “Benign.”
• Calculate Performance Metrics: The system also computes important performance metrics
like Accuracy and F1 Score, which indicate how well the AI model performs in
classification tasks.
• Result Display (on Dashboard): Finally, the dashboard displays the classification result
(e.g., “Malignant” with 98.5percent confidence) along with performance indicators like F1
Score and Accuracy, giving users clear insight into the system’s prediction quality.

Dept. of CS&E GEC, KUSHALNAGAR Page 21


Lung cancer detection using machine learning (BCS786) 2025-26

• End: The process ends with a summarized output shown to the user, completing the
automated lung cancer prediction cycle.

3.8.2 Architectural view

The Lung Cancer Prediction Architecture is designed to integrate the user interface, backend API, and
model storage to enable smooth disease prediction. The frontend acts as the user interface where
patients or users upload lung images through a web page built using HTML and Flask framework. Once
the image is uploaded, it is sent as an HTTP POST request to the Flask backend (API layer) for
processing. In the backend, the image first passes through the feature extraction module (/api/feature-
extraction), where preprocessing steps like resizing and normalization are performed to prepare the
data for analysis.

Figure 3.2: Architechtural view

The processed image is then sent to the deep learning prediction module (/api/predict), which uses
a Convolutional Neural Network (CNN) model to infer whether the lung image indicates a malignant
or benign condition. After obtaining the prediction, the result is forwarded to the result generator
(/api/result-generator) that converts the model output into a JSON-formatted response for easy commu-
nication with the frontend. The frontend then displays this prediction result to the user in real time.
Additionally, the system maintains data/model storage, where logs, metadata, and the trained CNN
model are stored for future updates and retraining. This architecture ensures scalability, modularity, and
efficient communication between user and AI components, enabling fast and reliable lung cancer
prediction.

Dept. of CS&E GEC, KUSHALNAGAR Page 22


Lung cancer detection using machine learning (BCS786) 2025-26

3.8.3 Network Components

The network components of the Lung Cancer Prediction System play a crucial role in connecting the
different layers of the application to ensure smooth data flow and model interaction. The system
typically consists of three main components — Frontend, Backend Server, and Database/Model
Storage. The Frontend acts as the user interface where patients or users upload lung images or input
symptoms through a web dashboard. This interface communicates with the backend via HTTP
requests or RESTful APIs. The Backend Server, usually implemented using Flask or Django in
Python, handles the core processing tasks such as image pre-processing, feature extraction, and model
prediction.

Figure 3.3: Network Components

It interacts with the Machine Learning or Deep Learning model, often built using libraries like
TensorFlow or Keras, to classify lung images as malignant or benign. The Database or Storage Layer
stores important data such as user inputs, processed results, logs, and trained model files. Additionally,
network communication protocols like HTTP/HTTPS ensure secure and reliable data transfer between
client and server. In some systems, cloud services like AWS or Google Cloud are used to deploy the
model and manage scalability. Together, these components form a robust, interconnected network that
enables accurate and real-time lung cancer prediction using machine learning.

Dept. of CS&E GEC, KUSHALNAGAR Page 23


Lung cancer detection using machine learning (BCS786) 2025-26

CHAPTER 4

4 SYSTEM ANALYSIS AND DESIGN


System Analysis and Design is a structured process used to understand a problem, identify system
requirements, and create an efficient solution. It involves analyzing existing systems, defining user
needs, and designing the system’s architecture and data flow. The goal is to improve performance,
accuracy, and usability. It includes both logical and physical design phases to ensure smooth
implementation. Overall, it provides a blueprint for developing effective and reliable software systems.

4.1 Economical feasibility


The Feasibility Study of the Lung Cancer Prediction System using Machine Learning evaluates the
practicality and effectiveness of developing the system. It is technically feasible as ML algorithms like
CNN and Decision Tree can accurately analyze medical data. It is economically feasible since it
reduces diagnosis costs compared to traditional medical tests. It is operationally feasible because it
provides quick and reliable results through an easy-to-use interface. The system is also time feasible,
as predictions are generated instantly, helping in early detection and treatment [Link] study
focused on three core aspects:

• ECONOMICAL FEASIBILITY
• TECHNICAL FEASIBILITY
• SOCIAL FEASIBILITY

4.1.1 Economical Feasibility

Economic Feasibility evaluates whether the project is cost-effective and worth the investment. For the
Lung Cancer Prediction System, it requires minimal cost compared to traditional diagnosis methods
using scans or lab tests. The system uses open-source machine learning tools, reducing software
expenses. Maintenance and operational costs are low since predictions are automated. Overall, the
system provides a budget-friendly and efficient solution for early cancer detection, offering high value
for its development cost.

4.1.2 Technical Feasibility

Technical Feasibility examines whether the required technology and resources are available to develop
the system effectively. The Lung Cancer Prediction System is technically feasible as it uses existing
technologies like Python, Flask, and machine learning algorithms such as CNN or Decision Tree. The
hardware and software requirements are minimal and easily available. The system can efficiently
process and analyze medical data to provide accurate predictions. Hence, it is technically possible to
design, implement, and maintain this system with current tools and expertise.

Dept. of CS&E GEC, KUSHALNAGAR Page 24


Lung cancer detection using machine learning (BCS786) 2025-26

4.1.3 Social Feasibility

Social Feasibility evaluates how well the system will be accepted and used by society. The Lung
Cancer Prediction System is socially feasible because it helps in early detection of cancer, which can
save lives and reduce suffering. It increases health awareness among people and encourages
preventive medical checkups. The system is user-friendly and can be used by both medical
professionals and the public. Overall, it gains social acceptance due to its positive impact on public
health and community well-being.

performance analysis Performance Analysis of the Lung Cancer Prediction System using Machine
Learning focuses on evaluating the system’s accuracy, speed, and reliability. The model’s
performance is measured using metrics like accuracy, precision, recall, F1-score, and confusion
matrix. It efficiently processes medical data and provides quick predictions with high accuracy. The
system performs well under different input conditions and maintains stability during real-time
execution. Overall, it delivers consistent, accurate, and efficient results for lung cancer detection.

Technical Analysis

• System Enhancement: The Lung Cancer Prediction System is designed to improve


traditional diagnostic methods by automating cancer detection using machine learning
algorithms. It enhances accuracy, reduces human error, and provides faster results through
real-time data analysis.
• Technology Stack: The system is developed using Python, Flask, and HTML/CSS for the
frontend, while machine learning libraries like TensorFlow, Keras, and Scikit-learn are
used for model training and prediction. The database is managed using MySQL or SQLite.
• Skill Availability: The required technical skills such as Python programming, data prepro-
cessing, model training, and web development are commonly available among developers
and students, making the project implementation feasible.
• Deployment Flexibility: The system can be easily deployed on local servers or cloud
platforms like AWS, Google Cloud, or Heroku, allowing flexible access through a web
interface for doctors, patients, and researchers.

4.2 System Architecture


This diagram illustrates the system architecture of a machine learning–based application designed to
process and predict outcomes efficiently. The process begins with the user, who interacts with the
system through a web interface created using HTML, CSS, and JavaScript. This interface collects
user input or uploaded data, such as files or parameters, and sends it to the backend for processing.
The Flask backend acts as the communication bridge, handling routing and API requests between the
frontend and the machine learning modules. Within the backend, there are specific processing units
like the Feature Extractor, which extracts key characteristics or features from the input data, and the
APK Validator/Scanner, which checks data validity and ensures security. After preprocessing, the
Dept. of CS&E GEC, KUSHALNAGAR Page 25
Lung cancer detection using machine learning (BCS786) 2025-26
refined data

Dept. of CS&E GEC, KUSHALNAGAR Page 26


Lung cancer detection using machine learning (BCS786) 2025-26

Figure 4.1: System Architechture

is passed into the Random Forest Classifier, the core machine learning model responsible for analyzing
patterns and generating predictions. This classifier processes the input data and calculates prediction
scores or classification results. The results are then sent to the Model Output and Scores (UI) section,
where the user can view the outcomes clearly. Additionally, a visualization module presents the
model’s performance and predictions graphically for better understanding. The circular connection
between the classifier and backend indicates iterative learning or feedback. This architecture ensures
smooth data flow, secure processing, and real-time, accurate prediction results through a user-friendly
web interface.

4.3 System Design


This diagram illustrates the System Design of the Lung Cancer Prediction System using Machine
Learn- ing. The process begins when the user uploads lung image files or enters symptom details
through a web- based interface. The uploaded images are handled by the File Upload Interface (UI),
while the symptom data is entered through a Symptoms Input Interface (UI). Both inputs undergo
Feature Extraction—one module extracts image-based features like texture or shape, and the other
extracts symptom-based fea- tures such as coughing, chest pain, or fatigue patterns. These extracted
features are then passed to the CNN (Convolutional Neural Network) and Random Forest Classifier,
which serve as the system’s core machine learning models. The CNN processes image data to identify
possible tumor patterns, while the Random Forest analyzes symptom data for classification accuracy.
Together, they enhance prediction reliability through a hybrid approach. The Prediction Module then
calculates a confidence score and risk level indicating the probability of lung cancer. The final results

Dept. of CS&E GEC, KUSHALNAGAR Page 27


Lung cancer detection using machine learning (BCS786) 2025-26
are displayed on the Result Viewer Web Interface, allowing users or doctors to easily interpret the
outcomes. The feedback loop to the classifier

Dept. of CS&E GEC, KUSHALNAGAR Page 28


Lung cancer detection using machine learning (BCS786) 2025-26

supports system learning and model refinement. Overall, this design ensures efficient data flow, high
prediction accuracy, and a user-friendly interface for early lung cancer detection.

Figure 4.2: System design

4.4 Dataflow Diagram


This diagram represents the workflow and data flow of the Lung Cancer Prediction System using
Machine Learning. It begins with the End User, who provides input data in the form of medical images
and symptom details. The data enters the Input Data Collection module, where images and symptoms
are gathered for further processing. This collected data is stored as Raw Input Data, which includes
medical images and numerical information. The next stage is Data Preprocessing and Feature
Engineering, where data is cleaned, normalized, and converted into a usable format for machine
learning models. The system then performs Image Feature Extraction using the Convolutional Neural
Network (CNN) to identify visual patterns or abnormalities in lung images. Simultaneously, Symptom
Feature Extraction takes place using machine learning methods, converting patient symptoms into
measurable attributes. These extracted features are combined through an Integrated Feature Vector
Creation process, which merges both image- based and symptom-based data for improved prediction
accuracy. The combined features are then fed into the Lung Cancer Model Training phase, which
utilizes Random Forest and CNN algorithms to build predictive models. These trained models are
stored in the Trained Models data repository for future use. The prediction results, including risk
probabilities and classification outcomes, are stored in the Prediction Results and Probabilities database.
The next step involves Results Interpretation and Visualization, where the model output is analyzed and
converted into understandable information. Finally, the End User View displays the diagnosis,

Dept. of CS&E GEC, KUSHALNAGAR Page 29


Lung cancer detection using machine learning (BCS786) 2025-26
confidence score, and detailed explanation through a user-friendly interface. This

Dept. of CS&E GEC, KUSHALNAGAR Page 30


Lung cancer detection using machine learning (BCS786) 2025-26

Figure 4.3 : Dataflow

workflow ensures a smooth transition from data input to accurate prediction and visualization for lung
cancer detection.

4.5 Detailed Design


The given diagram represents the database schema design for a Lung Cancer Prediction System using
Machine Learning. It consists of three main tables: Patient Data, Prediction Results, and ML Models.
The Patient Data table stores important patient information such as patient ID, age, sex, smoking
status, pack years, calcification, spiculation, family history, and scan date. The diagnosis field is
considered the target variable used for training and testing the machine learning models. The
Prediction Results table contains the outputs produced by the model, including prediction ID, patient
ID as a foreign key, prediction time, probability score, predicted class, and confidence interval. It also
includes clinician review fields for expert evaluation of the model’s predictions. The ML Models table
keeps track of all the models used, containing details like model ID, model name, algorithm type such
as Random Forest or CNN, input data type, training data size, accuracy, specificity, deployment status,
and creation date. Altogether, these tables create a well-structured and connected database that helps in
managing patient data, tracking model performance, and ensuring transparent and efficient predictions
in the healthcare system.

4.6 Sequential diagram


The diagram illustrates the complete workflow of a machine learning–based medical prediction
system. Initially, the user uploads patient data or scans through the web interface, which sends the data
to the backend server. The backend server then forwards the clinical and image data to the ML

Dept. of CS&E GEC, KUSHALNAGAR Page 31


Lung cancer detection using machine learning (BCS786) 2025-26
prediction service

Dept. of CS&E GEC, KUSHALNAGAR Page 32


Lung cancer detection using machine learning (BCS786) 2025-26

Figure 4.4: Detailed Design

Figure 4.5 : Sequential design

that uses CNN and Random Forest models to analyze and predict disease risk. The ML service returns
the prediction results, including confidence scores and visual summaries. These results are then stored
securely in the database along with the patient and model details. The system acknowledges successful
data storage to ensure reliability. The summarized prediction report is displayed to the user through
the frontend interface. Additionally, an optional clinician review and feedback process is included for
professional validation. Clinicians can review the predicted outcomes, provide feedback or confirm the
prediction accuracy. Finally, the updated feedback is stored in the system to enhance prediction
credibility and maintain medical accuracy.

Dept. of CS&E GEC, KUSHALNAGAR Page 33


Lung cancer detection using machine learning (BCS786) 2025-26

CHAPTER 5

5 SYSTEM IMPLEMENTATION
The implementation phase of any project developers the phase alities the final solution, which solve
the problem at land. The implementation phase moves the actual materialization of the ideas which are
expressed in the analysis decstment and developed in the design phase. Implementation should be
perfect mappi of the design document in a suitable programming langitage in inder to achieve the
necessary final product. Often the product is ruined due to incorrect programming language chosen for
implementation or unsuitable method of programeting. It is better for the coding phase to be directly
linked to the design phase in the sense if the design it in terms of object oriented terms then
implementation should be preferably carried out in a object oriented way.
The implementation stage in a system project in its own right. It involves

• Careful planning
• Investigation of the current system and the constraints on implementation
• Training of staff in the newly developed system

Implementation of any software is always preceded by important decisions regarding selection of the
platform, the language used, etc, these decisions are often influenced by several factors such as real
environment in which the system works, the speed that is required, the security concerns, and other
implementation specific details. There are three major implementation decisions that have been made
before the implementation of this project. They are as follows:

• Selection of the platform (Operating System).


• Selection of the programming language for development of the application.
• Coding guideline to be followed.

5.1 Implementation module


5.1.1 Preprocessing Feature Engineering with Equilibrium Optimizer

The diagram represents the process of preparing and optimizing data for a medical prediction system.
It starts with two types of input data—image data (CT/X-ray scans) and clinical data (symptoms,
patient details). Image preprocessing extracts radiomic features like shape, texture, and margins, while
clinical feature engineering cleans and encodes tabular data. Both sets of features are then unified and
optimized using dimensionality reduction methods. The final result is an optimized feature set ready
for use in machine learning models. Key Processes:

• Image Preprocessing Feature Extraction – Isolates nodules and extracts radiomic features from
CT/X-ray scans.

Dept. of CS&E GEC, KUSHALNAGAR Page 34


Lung cancer detection using machine learning (BCS786) 2025-26

• Clinical Feature Engineering – Handles missing data, encodes categorical variables, and
normalizes numerical values.

• Feature Unification Selection – Combines image and clinical features and reduces
dimensionality using techniques like PCA or RFE.

• Final Feature Optimization – Produces a refined, high-quality feature set for accurate model
training and prediction.

Figure 5.1 : Preprocessing Feature engineering with EO

5.1.2 Model Training and Evaluation

This diagram represents the machine learning stage of a medical prediction system. The optimized feature
set is used as input for two models—CNN for image data and Random Forest for clinical data. The
CNN learns spatial patterns from scans, while the Random Forest identifies key clinical factors. Both
models work together to generate predictions, classifying results as malignant or benign with
confidence levels. The final step involves evaluating model performance using various accuracy and
validation metrics.
Key Concepts :

• Machine Learning Models – CNN handles image data, and Random Forest processes
clinical data to learn features and patterns.
• Prediction Classification – Produces risk scores and determines whether a case is
malignant or benign.
• Model Fusion – Combines outputs from both models for a more accurate and reliable diag-
nosis.
• Evaluation Metrics – Uses accuracy, sensitivity, specificity, F1-score, and ROC curve
analysis to validate model performance.

Dept. of CS&E GEC, KUSHALNAGAR Page 35


Lung cancer detection using machine learning (BCS786) 2025-26

Figure 5.2 : Model Training and Evaluation

5.1.3 Website Integration

This diagram illustrates a clinical decision support system designed to predict patient risk based on
medical images and clinical data. The process begins when User Input Data (CT scans and clinical
features) is uploaded via a web portal to a Frontend Web Server which validates the data. This data is
then sent to a Backend Prediction Server, which routes the image data to a CNN Model for image-
based risk prediction, and the tabular data to a Random Forest model for feature-based risk prediction.
The backend server then fuses the predictions from both models (using a weighted average) to generate
the final result, which is stored in a database. Finally, the outcome is presented to the user on a
Frontend Display Dashboard, showing the Malignant/Benign Result, a Confidence Score, the Risk
Level, and key visualizations like CNN and RF heatmaps for model interpretability.

Dept. of CS&E GEC, KUSHALNAGAR Page 36


Lung cancer detection using machine learning (BCS786) 2025-26

Figure 5.3 : Web integration

Dept. of CS&E GEC, KUSHALNAGAR Page 37


Lung cancer detection using machine learning (BCS786) 2025-26

CHAPTER 6

6 CODE IMPLEMENTATION

6.1 Importing Libraries


In this step, we import all the Python libraries needed for data processing, visualization, and model
build- ing. These libraries help us load data, clean it, analyze it, and train the machine learning
[Link] Python libraries needed for data handling, visualization, and model [Link] the first
step of develop- ing a lung cancer detection system using machine learning, we import all the
necessary libraries. These libraries provide ready-made tools for handling data, processing medical
images, visualizing graphs, training machine learning models, and evaluating performance. Examples:
NumPy, Pandas, Matplotlib, Seaborn, Scikit-Learn, TensorFlow/Keras (if using deep learning),
OpenCV (if using CT images).

Figure 6.1 : Importing Libraries for LC

6.2 Data Collection


Data collection is the first and most important step in building a lung cancer detection system using
machine learning. At this stage, relevant data such as lung CT scan images or lung cancer patient
records are gathered from trusted sources. Good-quality data ensures that the model can learn
meaningful patterns and produce accurate predictions. The dataset may come from public

Dept. of CS&E GEC, KUSHALNAGAR Page 38


Lung cancer detection using machine learning (BCS786) 2025-26
repositories, hospitals, research

Dept. of CS&E GEC, KUSHALNAGAR Page 39


Lung cancer detection using machine learning (BCS786) 2025-26

centers, or online medical databases. Once collected, the data is stored in a structured format so that it
can be easily processed in later stages.

Figure 6.2 : Data Collection for LC

6.3 Data Preprocessing


Preprocessing ensures that the dataset suitable for model training .

1. Image Resizing:
Convert all images to a fixed size (e.g., 224×224 or 512×512) so that the model receives
uniform input.

2. Normalization: Normalize pixel values (0–255 → 0–1) to reduce intensity variation.

3. Noise Removal:
Use filters to reduce noise
Gaussian filter
Median filter
Bilateral filter
This improves image clarity and segmentation quality.

Dept. of CS&E GEC, KUSHALNAGAR Page 40


Lung cancer detection using machine learning (BCS786) 2025-26

Figure 6.3 : Data Collection for LC

4. Lung Segmentation:
Extract only the lung region using:
Thresholding
Morphological operations (erosion,
dilation) U-Net segmentation models
Segmentation removes unnecessary surrounding tissues.

5. data Augmentation:
Enhances dataset size and variety:
Rotation seperation

6.4 Splitting Data into Train Test and validation Set


In machine learning, a dataset is usually divided into three separate subsets to ensure that the model
learns effectively and performs well on unseen data. These subsets are:

1. Training Set
The training set is the largest portion of the dataset.
It is used to train the machine learning model, meaning the model learns patterns, relationships,
and features from this data.
Proper training helps the model generalize to new, unseen data.

Dept. of CS&E GEC, KUSHALNAGAR Page 41


Lung cancer detection using machine learning (BCS786) 2025-26

2. Validation Set
The validation set is a smaller portion of the dataset.
It is used during training to tune model parameters (like hyperparameters) and to prevent overfitting.
The model does not learn from this set directly, but its performance here helps decide the best
configuration for the model.

3. Test Set
The test set is completely unseen by the model during training.
It is used to evaluate the final performance of the trained
model.
This ensures that the model is not just memorizing the training data but can generalize well to
new real-world data.

Figure 6.4 : Data Splitting for LC

6.5 Model Selection


Model selection is the process of choosing the most suitable machine learning algorithm for a specific
task, based on the nature of the data and the problem requirements. Selecting the right model is crucial
because different algorithms have different strengths, weaknesses, and performance [Link] a
lung cancer detection system, model selection involves evaluating algorithms that can accurately
classify patient data or medical images as benign or malignant. For example:Convolutional Neural
Networks (CNNs) are preferred for CT scan image analysis.

6.6 Train The Model


Training the model is a crucial step in building a machine learning system. During this phase, the
model learns patterns and relationships from the training dataset to make accurate predictions. In the

Dept. of CS&E GEC, KUSHALNAGAR Page 42


Lung cancer detection using machine learning (BCS786) 2025-26
context of a lung cancer detection system, the model is trained using features extracted from patient
data or CT

Dept. of CS&E GEC, KUSHALNAGAR Page 43


Lung cancer detection using machine learning (BCS786) 2025-26

Figure 6.5 : Model Selection for LC

scan images, such as tumor size, shape, or image pixel patterns. The training process adjusts the
model’s internal parameters so that it can correctly classify new, unseen samples as benign or
malignant.

Dept. of CS&E GEC, KUSHALNAGAR Page 44


Lung cancer detection using machine learning (BCS786) 2025-26

Figure 6.6 : Evaluation for LC

6.7 Evaluating the Model


Model evaluation is the process of assessing how well a trained machine learning model performs on
unseen data. It is a critical step in determining the accuracy, reliability, and generalization ability of
the model before it is deployed in real-world applications.
In a lung cancer detection system, model evaluation ensures that the system can correctly classify
patient data or medical images as benign or malignant. Common evaluation metrics include: F1
Score,Accuracy Precision,confusion MatrixIn the context of a lung cancer detection system, evaluation
ensures that the model can correctly classify patient data or medical images as benign or malignant,
which is crucial for early diagnosis and treatment planning. Evaluation not only measures overall
accuracy but also provides insights into the types of errors the model makes, such as false positives or
false negatives, which are particularly important in medical applications. Accuracy: Proportion of
correctly predicted samples
Precision: Ability to correctly identify positive cases (malignant tumors)

Dept. of CS&E GEC, KUSHALNAGAR Page 45


Lung cancer detection using machine learning (BCS786) 2025-26

Recall (Sensitivity): Ability to detect all actual positive cases Confusion Matrix: Visual
representation of predicted vs actual classes It is a critical step in determining the accuracy, reliability,
and generalization ability of the model before it is deployed in real-world applications. Lung cancer
remains one of the leading causes of cancer-related deaths worldwide, primarily due to late-stage
diagnosis and the aggressive nature of the disease. Early detection significantly improves the chances
of successful treatment and long-term survival. However, traditional diagnostic methods, such as
manual examination of CT scans or X-rays, can be time-consuming, prone to human error, and require
highly skilled radiologists. Machine learning (ML) offers a transformative approach to this challenge
by enabling automated, accurate, and efficient analysis of medical imaging data. By leveraging
algorithms—particularly deep learning models like Convolutional Neural Networks (CNNs)—the
system can learn to identify subtle patterns and anomalies in lung tissue that may indicate the presence
of cancer, even at its earliest stages.

Figure 6.7: Model Evaluation for LC

Dept. of CS&E GEC, KUSHALNAGAR Page 46


Lung cancer detection using machine learning (BCS786) 2025-26

6.8 Frontend Development


Frontend development refers to creating the user interface (UI) and user experience (UX) of a web
application. It is what users see and interact with in a web browser. In a lung cancer detection system,
the frontend allows users to:

• Upload patient data or CT scan images


• Trigger model predictions
• View results (e.g., benign or malignant)
• See visualizations or reports

Frontend development typically uses HTML for structure, CSS for styling, and JavaScript for
interactivity. It ensures that the system is user-friendly, responsive, and accessible, making complex
machine learning functionality easy to use for doctors or patients.

Figure 6.8 : Frontend Development for LC

Dept. of CS&E GEC, KUSHALNAGAR Page 47


Lung cancer detection using machine learning (BCS786) 2025-26

6.9 Deployment
Deployment is the final phase of a machine learning project, where a trained model is made accessible
and usable in a real-world environment. In a lung cancer detection system, deployment allows
healthcare professionals or patients to interact with the system, input patient data or medical images,
and receive predictions in a user-friendly interface.
The deployment process ensures that the model is reliable, scalable, and efficient, integrating the
backend (trained model) with the frontend (user interface).eployment is the stage in a machine learning
project where the trained model is made operational and integrated into a system that end-users can
access. For a lung cancer detection system, deployment allows doctors, radiologists, or healthcare staff
to input patient data or CT scan images and receive automated predictions for early diagnosis.

Figure 6.9 : Deployment for LC

Dept. of CS&E GEC, KUSHALNAGAR Page 48


Lung cancer detection using machine learning (BCS786) 2025-26

CHAPTER 7

7 SYSTEM TESTING
System testing is a critical phase in the development of the Lung Cancer Detection System, ensuring
that the entire machine learning–based application functions correctly, reliably, and efficiently as a
unified whole. After individual modules—such as data preprocessing, feature extraction, model
training, and prediction—are developed and tested independently, system testing evaluates the
integrated system to verify that all components work together seamlessly.

7.1 Testing Process


The testing process followed a systematic and structured methodology to verify the proper functioning
of all modules within the sytem.

• Unit Testing:Each Module, such as data preprocessing,model prediction, and flask routing, to
produce the correct output.

• integration testing:Verified that the interaction between modules worked extensively without
any data mistakes.

• System testing:The complete, integrated system was tested as a whole to ensure it fulfilled all
user and system requirements.

• User Acceptance Testing (UAT):End-users tested the system interface for usability,chlarity,
and output accuracy.

7.2 Testing Objectives


The primary objectives of system testing are as follows:

• To ensure that the Lung cancer detection System operates correctly and produces accurate results.
• To validate that all functional requirements (data upload, preprocessing, model prediction, and
result visualization) are implemented correctly.

• To verify that the machine learning model generates consistent predictions across different input
datasets.

• To ensure that the user interface (http web app) is responsive, error-free, and provides
appropriate feedback to users.

• To confirm that the system meets non-functional requirements, such as performance, security,
and scalability.

• To identify and fix defects before deployment.

Dept. of CS&E GEC, KUSHALNAGAR Page 49


Lung cancer detection using machine learning (BCS786) 2025-26

Testing also ensures that the system can handle unexpected inputs gracefully without crashing or
producing erroneous outputs. For example, when invalid or incomplete data is uploaded, the system
should provide an informative error message instead of failing silently.

7.3 Test Environment


The test environment was configured to closely replicate the actual deployment setup. It included both
hardware and software configurations to ensure real-world performance evaluation.
Hardware Configuration:

• Processor: Intel Core i5 / i7


• RAM: 8 GB or higher
• Storage: 256 GB SSD
• System Type: 64-bit Operating System

Software Configuration:

• Operating System: Windows 10 / Ubuntu 22.04 LTS


• Programming Language: Python 3.10
• Libraries: pandas, numpy, scikit-learn, flask, matplotlib, joblib
• Web Framework: Flask 3.0
• Browser: Google Chrome / Mozilla Firefox

The test environment was isolated from the development environment to ensure that no
development dependencies affected testing outcomes. The system was deployed locally on
localhost:5000 for Flask-based testing and accessed via browser.

7.4 System Testing


System testing evaluates the integrated system as a whole. It ensures that all modules, when combined,
perform harmoniously and deliver accurate results. For this project, system testing covered both
functional and non-functional aspects.
Functional Testing Areas:

• Data Upload functionality.


• Preprocessing accuracy (scaling, normalization, and missing value handling).
• Model prediction correctness.
• User interface navigation and form validation.

Dept. of CS&E GEC, KUSHALNAGAR Page 50


Lung cancer detection using machine learning (BCS786) 2025-26

• Result visualization (charts, classification output, and downloadable reports).

Non-Functional Testing Areas:

• Performance under different dataset sizes.


• Response time and throughput.
• System robustness under invalid inputs.
• Compatibility with multiple browsers and screen resolutions.

Each function was tested against defined input-output specifications, and the outputs were
compared with expected results. The testing outcomes were recorded in a test report for further
evaluation.

7.5 Testing Types Applied


Various types of testing were employed to ensure comprehensive validation of the system:

• Unit Testing: Conducted on individual modules like data preprocessing and prediction.
Example: Verifying that normalization produces values between 0 and 1.

• Integration Testing: Tested the connection between Flask frontend and the machine learning
model. Example: Ensuring that input from the web form correctly reaches the backend and
returns a valid prediction.

• Functional Testing: Checked that each user requirement is fulfilled accurately.


• Regression Testing: Ensured that modifications in preprocessing logic or UI design did not
affect previously working features.

• Performance Testing: Assessed the model’s prediction time and Flask’s response latency under
heavy load.

• Usability Testing: Conducted with sample users to ensure ease of navigation, readability, and
user-friendliness.

• Validation Testing: Compared actual model predictions with known dataset labels to confirm
predictive accuracy.

Together, these testing types validated that the system performs as expected across multiple layers of
functionality and user interaction.

Dept. of CS&E GEC, KUSHALNAGAR Page 51


Lung cancer detection using machine learning (BCS786) 2025-26

7.6 Testing Scenarios


Testing scenarios were created to simulate both valid and invalid user actions. Each scenario included
input data, expected output, and the actual observed output. Examples include:

• Scenario 1: Valid Dataset Upload Input: Correctly formatted CSV file. Expected Output:
“Data uploaded successfully” and table preview displayed. Actual Output: Successful.

• Scenario 2: Invalid File Type Upload Input: Uploading a PDF instead of CSV. Expected
Output: Error message — “Invalid file format. Please upload a CSV file.” Actual Output:
Successful validation.

• Scenario 3: Prediction with Valid Inputs Input: Valid CT scan image Expected Output:
”Cancer” or ”normal”. Actual Output: Consistent with expected results.

• Scenario 4: Stress Test Input: Uploading dataset with 10,000+ records. Expected Output:
System should remain stable and responsive. Actual Output: Performance maintained with
minimal delay.

All scenarios were executed multiple times to confirm repeatability and stability under different
conditions.

SI NO Test Type Test Data Expected Result Actual Result Pass/Fail


(In- put)
1 Unit Test- patient data Model detects confusion matrix Pass
ing (form input) Can- cer / Healthy shown on screen
with confidence
2 Functional CSV file (CT Each row Image Classifica- Pass
Testing scanned im- classified as tion
age) normal / can- cer
detections dis-
played in screen
3 Integration Training Model trains suc- Model saved in Pass
Testing dataset from cessfully and saves /models folder
NCCD .csv file
4 System Load saved Model loads cor- Predictions gen- Pass
Testing model rectly and predicts erated without
([Link]) new inputs re- training
5 Negative Wrong/invalid App shows error Error handled Pass
Testing CSV (missing message (doesn’t gracefully, user
values or crash) informed
wrong format)

Table 7.1 : Testing results for Lung Cancer detection System

Dept. of CS&E GEC, KUSHALNAGAR Page 52


Lung cancer detection using machine learning (BCS786) 2025-26

7.7 Results and Observations


The testing phase produced highly satisfactory results. The Lung Cancer detection System achieved
excellent accuracy and performance across all modules. Key results are summarized below:

• This model achieved an accuracy of 95% on the test dataset.


• Flask web interface successfully handled multiple simultaneous user requests.
• Data preprocessing consistently produced normalized outputs between [0, 1].
• The system handled invalid inputs without crashing, ensuring robustness.
• User interface received positive feedback for its simplicity and clarity.

7.8 Issues Identified and Fixed


During testing, several issues were identified and subsequently resolved:

• Issue 1 – Missing Value Error: When datasets contained NaN values, the model failed during
prediction. Fix: Implemented automatic handling using mean imputation in the preprocessing
module.

• Issue 2 – File Upload Error: Non-CSV uploads caused Flask crashes. Fix: Added validation
checks for file format before processing.

• Issue 3 – Model Inconsistency: Early versions of the model produced fluctuating predictions
due to unscaled features. Fix: Integrated normalization before model inference.

• Issue 4 – User Interface Lag: Response delay observed for large datasets. Fix: Optimized
server-side processing and used asynchronous file handling.

• Issue 5 – Incorrect Error Messages: Some exceptions were not properly displayed to the user.
Fix: Implemented detailed exception handling in Flask routes.

7.9 Results and Observations


The testing phase produced highly satisfactory results. The Lung Cancer Prediction System achieved
excellent accuracy and performance across all modules. Key results are summarized below:

• The SVM model achieved an accuracy of 96.3% on the test dataset.


• Flask web interface successfully handled multiple simultaneous user requests.
• Data preprocessing consistently produced normalized outputs between [0, 1].
• The system handled invalid inputs without crashing, ensuring robustness.

Dept. of CS&E GEC, KUSHALNAGAR Page 53


Lung cancer detection using machine learning (BCS786) 2025-26

• User interface received positive feedback for its simplicity and clarity.

Observation: The system demonstrated consistent performance even under large dataset sizes.
Average response time for predictions remained under 1.5 seconds, confirming suitability for real-time
deployment.
Graphical outputs, such as the confusion matrix and ROC curve, further validated the model’s
reliability and minimal misclassification.
After fixes, all modules were re-tested to confirm stability and correctness. Final testing confirmed
that the system was ready for deployment and capable of delivering reliable Parkinson’s prediction
results in real time.

Issue Fix
Missing Value Error – When Automatic handling using mean
datasets contained NaN values, the imputation in preprocessing
model failed during prediction. mod- ule.
File Upload Error – Non-CSV up- Validation checks for file format
loads caused Flask crashes. before model processing.
Model Inconsistency – Early ver- Integration of normalization be-
sions of the model produced fluc- fore model inference.
tuating predictions due to unscaled
features.
User Interface Lag – Response de- Optimized server-side processing and
lay observed for large datasets. asynchronous access.
Incorrect Error Messages – Some Detailed exception handling in
exceptions were not properly dis- Flask routes.
played to the user.

Table 7.2 : Identified Issues and Fixes in Lung Cancer detection System System

Dept. of CS&E GEC, KUSHALNAGAR Page 54


Lung cancer detection using machine learning (BCS786) 2025-26

CHAPTER 8

8 RESULTS DISCUSSION AND PERFORMANCE ANALYSIS


After training and deploying a machine learning model, it is essential to analyze its results and
performance to understand its effectiveness and reliability. In a lung cancer detection system, this
involves examining how accurately the model can classify patient data or CT scan images as benign or
malignant, and identifying any patterns in its [Link] results section presents the outcomes of
the model, such as prediction accuracy, confusion matrices, and other performance metrics. The
discussion interprets tand any observed trends, such as common misclassifications or sensitivity to
certain data features.

8.1 Snapshots
8.1.1 Login Page

This page is designed to collect the basic personal information of the patient before proceeding to the
diagnosis process. It includes input fields for the patient’s name and email, ensuring that the uploaded
medical images and prediction results are properly associated with the correct patient. After entering
the details, the user can click the Next button to move forward to the image upload or diagnostic
section. This interface helps in maintaining organized medical records and enables easy
communication of the diagnostic results to the [Link] Patient Details page acts as the starting
point of the system where the user enters essential personal information such as Name and Email. This
step ensures proper identification and management of patient data throughout the diagnostic process.
The interface is simple, user-friendly, and designed with a clean medical theme for easy interaction.
Once the required information is entered, the Next button allows the patient to proceed to the image
upload section. By collecting these details, the system can securely store medical records, personalize
prediction results, and even enable communication of reports directly to the patient’s email. This page
plays an important role in establishing a structured and traceable workflow within the healthcare
diagnostic [Link] Login Page is the secure entry gateway of the system, designed to ensure
that only authorized users can access the medical diagnosis and patient management features. This
page typically contains input fields for Username/Email and Password, along with a Login button that
verifies the provided credentials. The authentication process helps protect sensitive medical data and
maintains privacy, which is critical in healthcare [Link] user interface is simple, intuitive, and
easy to navigate, allowing doctors, technicians, or registered users to sign in without any complexity.
Behind the interface, a secure backend authentication mechanism validates the login information
before granting access to the dashboard or next functional page. If incorrect details are provided, the
system can display helpful error messages prompting the user to retry.

8.1.2 Patients Details

The Lung Cancer Detection System is a machine learning–based application designed to assist in the

Dept. of CS&E GEC, KUSHALNAGAR Page 55


Lung cancer detection using machine learning (BCS786) 2025-26
early assessment of lung cancer risk. Early detection plays a vital role in improving treatment
outcomes and survival rates, and this system provides an accessible, user-friendly platform for
individuals or healthcare

Dept. of CS&E GEC, KUSHALNAGAR Page 56


Lung cancer detection using machine learning (BCS786) 2025-26

Figure 8.1 : Login Page for LC

professionals to input relevant medical information and receive an AI-based risk evaluation. The login
and patient information interface serves as the first stage of the system. It allows users to securely
access the platform and enter essential patient details required for analysis. The form collects
demographic information such as age and gender, along with various clinical symptoms and lifestyle
factors commonly associated with lung cancer. These include parameters like anxiety, allergy history,
alcohol consumption, and respiratory symptoms such as coughing, among others. By systematically
capturing these inputs, the system ensures that the machine learning model receives structured and
comprehensive data to generate an accurate prediction. The interface is designed to be intuitive,
visually clear, and easy to navigate, ensuring that users can efficiently enter information without
medical expertise. This streamlined data collection process ultimately enhances the system’s reliability
and supports effective risk assessment for better clinical [Link] patient information page
is a crucial component of the Lung Cancer Risk Assessment System, designed to collect essential user
data in a structured and interactive manner. The interface is visually appealing, featuring a dark-
themed background with medical imagery that enhances user experience and reinforces the healthcare

Dept. of CS&E GEC, KUSHALNAGAR Page 57


Lung cancer detection using machine learning (BCS786) 2025-26
context of the application. At the top of

Dept. of CS&E GEC, KUSHALNAGAR Page 58


Lung cancer detection using machine learning (BCS786) 2025-26

the page, a bold and clear title—”Enter Patient Information to Assess Lung Cancer Risk”—guides
users about the purpose of this section. The design focuses on simplicity and clarity, ensuring that
users, including non-technical individuals, can easily understand and navigate through the form. The
interface begins by capturing basic demographic information such as Age. The age input field accepts
numerical values, as age is an important determinant in predicting lung cancer risk. It is followed by a
Gender dropdown menu that allows the user to select the appropriate gender category. Gender-based
differences play a significant role in medical risk prediction models, making this input essential. Next,
the form shifts to Symptoms and Medical History, highlighted in a clickable, styled hyperlink format for
easy navigation and visibility. This section includes several dropdown menus that gather specific
health-related attributes such as:

• Anxiety
• Allergy
• Alcohol Consumption
• Coughing

Each dropdown provides standardized options, ensuring consistency and accuracy in the data that is
fed into the machine learning model. These clinical and lifestyle factors are among the most influential
attributes in the prediction of lung cancer, as supported by medical research and patient datasets. The
form layout is cleanly organized, with each field clearly labeled to minimize user confusion. The
dropdowns ensure that users select valid inputs, reducing the possibility of incorrect or incomplete data
submission. The interface design emphasizes accessibility, responsiveness, and user-friendliness,
making it suitable for both clinical environments and personal health assessment scenarios. Overall, this
patient information page is an essential gateway for collecting relevant inputs that will be processed by
the machine learning algorithm. Its intuitive layout, professional design, and structured data fields
contribute to accurate and reliable lung cancer risk [Link] login page acts as the secure entry
point to the Lung Cancer Detection System, ensuring that only authorized users—such as healthcare
professionals, researchers, or registered patients—can access the application. This page is designed
with a strong emphasis on security, simplicity, and usability, all of which are critical for health-related
digital platforms. Visually, the login page maintains a modern and professional interface, typically set
against a themed medical background that reflects the system’s focus on healthcare and diagnostics.
The clean layout helps users instantly understand the purpose of the system while also providing a
sense of trust and [Link] fields ensure secure identification of each user. The input boxes are
clearly labeled and styled to be easily readable, even for older users or those with limited technological
experience. The password field hides user input for privacy, especially in shared environments like
clinics or [Link] overall design ensures that users can seamlessly transition from the login page
to the patient information form without confusion. The simplicity of the interface reduces cognitive
load, allowing users to focus on the main task—entering patient details and obtaining lung cancer risk
[Link], the Welcome Page creates a smooth and friendly entry point to the system. It sets
the tone for the entire application by maintaining a balance between professionalism and user-
friendliness.

Dept. of CS&E GEC, KUSHALNAGAR Page 59


Lung cancer detection using machine learning (BCS786) 2025-26

Figure 8.2 : Patients Details for LC

Its design encourages users to proceed confidently toward entering their information and exploring
the lung cancer risk prediction tools powered by machine learning. At the center of the page, a bold
and informative heading—such as “Lung Cancer Detection System using Machine Learning”—

Dept. of CS&E GEC, KUSHALNAGAR Page 60


Lung cancer detection using machine learning (BCS786) 2025-26
immediately

Dept. of CS&E GEC, KUSHALNAGAR Page 61


Lung cancer detection using machine learning (BCS786) 2025-26

communicates the primary function of the platform. The background typically includes healthcare-
themed visuals, subtle patterns, or medical illustrations to create a sense of trust, seriousness, and
relevance to the domain of health diagnostics.

Figure 8.2 : Pateints Details for LC

At the center of the page, a bold and informative heading—such as “Lung Cancer Detection
System using Machine Learning”—immediately communicates the primary function of the platform.
The background typically includes healthcare-themed visuals, subtle patterns, or medical illustrations
to create a sense of trust, seriousness, and relevance to the domain of health diagnostics.

Dept. of CS&E GEC, KUSHALNAGAR Page 62


Lung cancer detection using machine learning (BCS786) 2025-26

8.1.3 User Interface

Figure 8.4 : User Interface for LC

The Welcome Page serves as the introductory interface to the Lung Cancer Detection System,
providing users with a clear understanding of the system’s purpose and guiding them toward the next
steps. Designed with a clean and visually appealing layout, this page creates a professional first
impression while ensuring ease of navigation for all users, including patients, clinicians, and
[Link] the center of the page, a bold and informative heading—such as “Lung Cancer
Detection System using Machine Learning”—immediately communicates the primary function of the
platform. The background typically includes healthcare-themed visuals, subtle patterns, or medical
illustrations to create a sense of trust, seriousness, and relevance to the domain of health
[Link] the heading, a brief description may be provided to highlight the objective of the
system. This introduction explains that the platform uses advanced machine learning algorithms to
analyze key health indicators and predict the potential risk of lung cancer. The goal is to assist in early
detection, enhance medical decision-making, and make risk assessment more accessible. The
Welcome Page generally includes clear navigation options, such as:
“Login” button for registered users
“Get Started” or “Assess Risk” for new users
Information links like About, Help, or
Contact
These buttons are visually distinct and positioned strategically to ensure intuitive access to the next
steps. Overall, the Welcome Page creates a smooth and friendly entry point to the system. It sets the
tone for the entire application by maintaining a balance between professionalism and user-friendliness.
Its design encourages users to proceed confidently toward entering their information and exploring the
lung cancer risk prediction tools powered by machine learning.

Dept. of CS&E GEC, KUSHALNAGAR Page 63


Lung cancer detection using machine learning (BCS786) 2025-26

8.1.4 Prediction Normal

Machine learning–based lung cancer detection systems are designed to assist in the early identification
of abnormal lung conditions by analyzing chest images such as X-rays or CT scans. When the system
processes an image that shows no significant abnormalities, it generates a prediction indicating that the
lungs appear normal according to the model’s learned patterns. This type of prediction is crucial
because it allows the system not only to detect potential cancer risks but also to reliably confirm cases
where there are no visible indicators of the disease.A “normal image prediction” means that the
machine learning model has not detected features commonly associated with lung cancer, such as
irregular masses, nodules, abnormal tissue densities, or other suspicious patterns. To achieve this, the
model has been trained on large datasets containing both cancerous and non-cancerous images.
Through this training process, the system learns to differentiate between healthy lung structures and
those that may show signs of [Link] ability to classify an image as normal is just as
important as identifying abnormal findings. It helps reduce unnecessary anxiety, supports clinical
decision-making, and improves workflow efficiency in healthcare settings by quickly filtering out
low-risk cases. Additionally, the model’s performance on normal images demonstrates its robustness
and generalization capability, showing that it can accurately recognize diverse lung structures across
different [Link] the context of the Lung Cancer Detection System, the normal prediction result is
presented clearly and visually, ensuring that users—whether healthcare professionals or individuals
using the tool for awareness—can easily understand the output. While the model assists in preliminary
screening, it is not a standalone diagnostic tool; instead, it acts as a supportive technology to enhance
early detection efforts and streamline medical [Link] displayed image is a CT (Computed
Tomography) scan of the thoracic region, specifically showing a cross-sectional view of the lungs. CT
scans are highly detailed radiological images that allow doctors and AI systems to observe the internal
structure of the lungs, airways, and surrounding tissues clearly. They play a major role in lung disease
screening because they can detect even very small abnormalities. In the image provided, the majority
of the lung area appears dark, which indicates air-filled, healthy lung tissue. The boundaries of the
lungs are smooth and well-shaped, and no noticeable masses, abnormal white patches, or irregular
growths are visible. The white and gray surrounding regions represent bones (such as ribs and
vertebrae), muscles, blood vessels, and connective tissues — all appearing in their
normal anatomical form.

Dept. of CS&E GEC, KUSHALNAGAR Page 64


Lung cancer detection using machine learning (BCS786) 2025-26

Figure 8.5 : Normal Image

In the context of the Lung Cancer Detection System, the normal prediction result is presented
clearly and visually, ensuring that users—whether healthcare professionals or individuals using the
tool for awareness—can easily understand the output. While the model assists in preliminary
screening, it is not a standalone diagnostic tool; instead, it acts as a supportive technology to enhance
early detection efforts and streamline medical evaluations.

8.1.5 Prediction cancer

The cancer prediction output is one of the most critical components of the Lung Cancer Detection
System, as it indicates that the machine learning model has identified patterns associated with a
potential risk of lung cancer. When the system classifies an image or patient data as “Cancer
Detected,” it means the model has recognized features that closely match those found in confirmed
lung cancer cases during the training phase.
This prediction is based on advanced machine learning algorithms that analyze multiple indica-
tors—such as lung tissue patterns, image intensities, and clinical symptoms—to determine whether
abnormalities are present. These abnormalities may include irregular nodules, unusual tissue densities,
or patterns commonly linked to malignant growths. The system evaluates these features based on the
knowledge it has learned from extensive datasets containing both healthy and cancerous examples.
A positive cancer prediction serves as an early warning signal, guiding users or healthcare
profession- als toward further medical evaluation. While the system is not a diagnostic tool, it acts as
an intelligent assistant that helps prioritize high-risk cases, reducing delays in clinical workflows and

Dept. of CS&E GEC, KUSHALNAGAR Page 65


Lung cancer detection using machine learning (BCS786) 2025-26
supporting quicker

Dept. of CS&E GEC, KUSHALNAGAR Page 66


Lung cancer detection using machine learning (BCS786) 2025-26

decision-making. Early detection plays a crucial role in improving treatment outcomes, and the
system’s ability to recognize high-risk patterns contributes significantly to this goal.
The interface presents the cancer prediction result in a clear and visually distinctive manner,
ensuring users can easily understand the outcome. This design helps communicate the model’s
assessment while maintaining the seriousness and sensitivity required for health-related predictions.

Figure 8.6 : Cancer Image

8.1.6 Confusion Matrix

A confusion matrix is a table used to evaluate the performance of a classification model by comparing
the predicted labels with the actual labels. It provides a detailed breakdown of correct and incorrect
predictions for each class.
In a lung cancer detection system, the confusion matrix helps to:
Identify the number of true positives (TP) – correctly predicted malignant cases these results, high-
lighting strengths, weaknesses, Identify true negatives (TN) – correctly predicted benign cases
Detect false positives (FP) – benign cases incorrectly predicted as malignant
Detect false negatives (FN) – malignant cases incorrectly predicted as
benign
This detailed evaluation allows researchers to understand the types of errors the model makes,
which is especially critical in medical applications where false negatives can have serious
consequences.
By analyzing the confusion matrix, developers can measure accuracy, precision, recall, and F1-
score, and make informed decisions to improve model performance for reliable lung cancer detection.
Dept. of CS&E GEC, KUSHALNAGAR Page 67
Lung cancer detection using machine learning (BCS786) 2025-26
1. Detect highly correlated features, which can influence model performance or cause redundancy.

Dept. of CS&E GEC, KUSHALNAGAR Page 68


Lung cancer detection using machine learning (BCS786) 2025-26

2. Guide feature selection, improving model accuracy and reducing overfitting.

Positive correlation values (close to +1) indicate that two features increase together, while negative
values (close to -1) indicate an inverse relationship. Values near 0 imply no linear relationship.

Figure 8.7 : Confusion Matrix for LC

The matrix is arranged in a square format, where rows typically represent the actual classes and
columns represent the predicted classes. Each cell in the matrix shows the number of predictions made
for that combination of actual and predicted values. From this, several key performance metrics can be
derived

Dept. of CS&E GEC, KUSHALNAGAR Page 69


Lung cancer detection using machine learning (BCS786) 2025-26

8.1.7 Performance analysis

Performance analysis is a crucial step in evaluating the effectiveness of any machine learning model.
It provides insights into how well the model has learned from the training data and how accurately it
generalizes to unseen data. To assess this, two primary metrics are commonly monitored during
training: accuracy and loss. These metrics are typically visualized across multiple training epochs to
observe patterns of improvement, convergence, or overfitting.
The accuracy curve shows the proportion of correct predictions made by the model during both
training and validation phases. A steady increase in accuracy indicates that the model is effectively
learning the underlying patterns in the data. Similarly, the loss curve represents the model’s prediction
error. A decreasing loss suggests that the model is optimizing its parameters to minimize errors over
time.
In the presented performance analysis graphs, both accuracy and loss trends are plotted across
several epochs. The accuracy graph compares training accuracy and validation accuracy, helping
determine whether learning is consistent or if the model is overfitting. The loss graph provides a
complementary view, illustrating how the model’s error reduces during training and how well it
generalizes to validation data.
Together, these visualizations offer a comprehensive understanding of model performance,
revealing training progress, potential weaknesses, and overall learning behavior. Such analysis is
essential for refining model architecture, tuning hyperparameters, and ensuring that the final model is
robust and reliable. Key Points from the Performance Graphs

• Accuracy Trends Training accuracy steadily increases from around 0.35 to 1.0 within the first
few [Link] accuracy also increases rapidly, reaching 1.0 accuracy by the 2nd
[Link] training and validation accuracy lines converge at 100%, indicating strong learning
[Link] visible oscillations or drops, suggesting the model learns patterns consistently.

• Loss Trends:Training loss decreases significantly from around 1.45 to nearly 0.0 by later
[Link] loss also drops sharply, following a similar downward pattern as the training
[Link] curves flatten towards zero, showing that the model continues improving with each
[Link] low gap between training and validation loss suggests minimal overfitting.

• Model Behavior:The rapid convergence indicates the model learns very quickly, possibly due
to:A simple datasetWell-selected features Efficient model architecture The close alignment of
training and validation curves shows that the model generalizes well to unseen data.

• Overall Performance Insight:The model achieves high accuracy and extremely low loss for both
training and [Link] curves show a consistent pattern of improvement, demonstrating
effec- tive optimization during training.

The absence of divergence between training and validation metrics confirms that the model is stable
and [Link] accuracy curve shows the proportion of correct predictions made by the model during
both training and validation phases. A steady increase in accuracy indicates that the model is
effectively learning the underlying patterns in the data. Similarly, the loss curve represents the model’s

Dept. of CS&E GEC, KUSHALNAGAR Page 70


Lung cancer detection using machine learning (BCS786) 2025-26
prediction

Dept. of CS&E GEC, KUSHALNAGAR Page 71


Lung cancer detection using machine learning (BCS786) 2025-26

error. A decreasing loss suggests that the model is optimizing its parameters to minimize errors over
time. These metrics are calculated using test data that the model has not seen before, ensuring unbiased

Figure 8.8 : Performance Analysis for LC

performance evaluation. Higher values in accuracy, precision, and recall indicate strong predictive
ability and reliability of the system for clinical support. The results are often shown using graphs,
charts, or comparison tables to clearly demonstrate the model’s [Link] Analysis is
carried out to evaluate how effectively the lung cancer prediction system identifies cancerous and non-
cancerous images. Various quantitative metrics are used to measure the model’s accuracy and
[Link] Analysis plays a vital role in evaluating the overall efficiency, accuracy, and
clinical usefulness of the Lung Cancer Detection System using Machine Learning. Since medical
diagnosis is a highly sensitive field, the performance of the system must be thoroughly analyzed to
ensure that the predictions made by the model are reliable and safe for real-world application. In this
project, the performance of the trained model is measured using a set of standard evaluation metrics
that are widely used in the domain of classification and healthcare predictive systems. These
performance indicators help in understanding how well the model is able to differentiate between
cancerous images and non-cancerous images. They not only help in validating the system but also help
in determining the possibilities for any future improvements.

Dept. of CS&E GEC, KUSHALNAGAR Page 72


Lung cancer detection using machine learning (BCS786) 2025-26

8.1.8 Percentage of Normal vs Cancer Image

This image is a data visualization chart used in cancer image classification systems. The chart shows
the percentage distribution of two classes from the images that were uploaded to the system: Normal
or Cancer

Figure 8.9: Percentage for LC

Dept. of CS&E GEC, KUSHALNAGAR Page 73


Lung cancer detection using machine learning (BCS786) 2025-26

CHAPTER 9

9 CONCLUSION AND FUTURE ENHANCEMENT

9.1 Conclusion
The Lung Cancer detection System using Machine Learning offers an efficient and reliable method for
early identification of Lung cancer disease by analyzing biomedical voice features. Through
systematic preprocessing, noise removal, and normalization, the input data becomes suitable for
accurate analysis. Meaningful features are extracted and utilized to train machine learning models
capable of distinguishing between cancerous and non-cancerous cases with good [Link] system
is deployed through a http web application that supports both normal case and cancer case. This makes
the platform practical and user-friendly for healthcare professionals, researchers, and general users. Its
ability to handle multiple records and generate downloadable results enhances its usability and
scalability, making it fit for real- world [Link] the system is not intended to replace
formal medical diagnosis, it serves as a valuable decision-support tool by providing quick, data-driven
insights. The overall project demonstrates the potential of machine learning in medical prediction tasks
and supports efforts toward early detection and improved patient [Link] Lung cancer detection
System using Machine Learning demonstrates how artificial intelligence can significantly enhance
early detection of neurological disorders. By analyzing biomedical image features, the system
provides a scientific and data-driven approach to identifying lung cancer disease at an early stage. The
use of preprocessing techniques, feature extraction, and normalization ensures that the input data is
clean, consistent, and meaningful, ultimately improving the accuracy of the model. This structured
workflow highlights the importance of ML in handling complex medical datasets and transforming
them into actionable predictions.

9.2 Future Scope of the Project


The future scope of this Lung cancer Disease detection System offers several promising opportunities
for enhancement and real-world application. One major direction is the integration of larger, more di-
verse clinical datasets to improve the model’s reliability and generalization across different
populations. Advanced techniques such as deep learning, ensemble models, and real-time voice
analysis can further boost prediction accuracy and robustness. The system can be expanded by
incorporating additional pa- tient features like cough,wheezing,cold,smoking enabling multi-modal
prediction. Developing a mobile application would allow users to record ct image samples instantly
and receive on-the-spot predictions, making the system more accessible. Additionally, integrating
explainable AI techniques can help doctors understand how the model makes its decisions, increasing
trust in clinical settings,,,,.

Dept. of CS&E GEC, KUSHALNAGAR Page 74


Lung cancer detection using machine learning (BCS786) 2025-26

Bibliography
[1] Emrah aslan and Ishak Pacal, ”Attention Enhanced InceptionNeXt-Based Hybrid Deep Learning
Model for Lung Cancer Detection”Multimedia Applications,volume 13,Feb.2025.

[2] Basam M. Kanber , Ahmad al smadi ”Advancing Oncology Diagnostics: AI-Enabled Early
Detec- tion of Lung Cancer Through Hybrid Histological Image Analysis”Deep learning,volume
15,march 2024.

[3] Abdulrahaman alzahrani,”Early detection of Lung Cancer using predictive Modelling Incorpora-
tion”,Deep learning,volume 16,feb 2025.

[4] [Link],Ashok mondal ,”Early Diagnosis of Lung Cancer Through Deep learning”,Deep
learn- ing,volume 25,october 2025.

[5] Pushkar Sathe,Alka Mahanajan, “End to end Automated lung cancer detection system”,
Multimedia Tools Appl., ,Volume 83, no. 5pp 14305 , Aug 2024.

[6] Sarad ayad,Hamdi “Advanced Lung Cancer detection and Classification based on alexnet CNN”,
[Link].(ICCES),Jul.2021,pp.1390-1397, doi:10.1109/ICCES51350.202 n
proc.6th feb 2025

[7] gilbert , “A transformer based multi scale deep learning for lung cancer ”, International Journal
of Computer Science and Information Technologies,Vol. 6 (1) , april 2025.

[8] Ahmed faozi,leo bey, “A wireless machine learning based lung cancer detection system”,
International Research Journal of Modernization in Engineering Technology and science,
Volume:06/Issue:03/oct-2025.

[9] Andriod and stephen, “An integrated data analysis for lung cancer”, American Journal of Open
Research, 3(3), May,2024

[10] Mohammad ammar and nadeem javid, “A advanced cardiovascular system ”, IEEE, 3(3), nov,2024

Dept. of CS&E GEC, KUSHALNAGAR Page 75

You might also like