Original Article
Predicting Breast Cancer using Machine Learning Classifiers
and Enhancing the Output by Combining the Predictions to
Generate Optimal F1‑Score
Disha Harshadbhai Parekh, Vishal Dahiya
Department of Computer Science, Indus Institute of Information and Communication Technology, Ahmedabad, Gujarat, India
Abstract
Background: Biomedical field has gained a lot of interest from active researchers today. Treating various diseases prevailing among the
world has believed to bring huge insight in the today’s research world. Second, advancement in technology has eased the work of researchers
to justify their work. Machine learning (ML) is an approach being used by bioengineers today to predict diseases and to even aid them in
drug discovery. Methods: Considering both the points, one of the most serious diseases, that is breast cancer here, is predicted using ML
approaches. Breast cancer is classified as either benign or malignant which is to be predicted with the help of ML classifiers. A very famous
dataset Wisconsin Breast Cancer Dataset is used here and is trained by three classifiers mainly support vector machine, general linear model,
and neural network (NNET) against testing dataset. Testing the breast cancer prediction was carried out keeping in mind the accuracy of each
of the classifiers. Results: This study is involving a generic code in R language. Conclusions: The study intends to show the usage of NNETs
in breast cancer prediction using single‑layered structure.
Keywords: Accuracy, breast cancer, F1‑score, general linear model, machine learning classifiers, neural network, R, receiver operating
characteristic, support vector machine, Wisconsin Dataset
Introduction uncontrollably more than healthier cells and interfere with normal
functioning of the body by drawing nutrients from healthy tissues
Biological system defines cells as the most important part of
of the body. According to the study done by WebMD in 2020,[1]
any living being. These cells, usually defined as “healthy cells,”
there are several types of cancers observed worldwide. On the
split up and regenerate themselves in a very organized and
basis of the study, major types of cancers are five: carcinoma,
controlled manner. Here, the word controlled is utmost important
sarcoma, melanoma, lymphoma and leukemia.[8,9] Understanding
because when a cell divides itself uncontrollably, leading to
the types of cancers, symptoms and their subtypes are out of
over production of cells, resulting in cancer. A tumor, word
scope of this paper, but those interested may find it in a paper.[2]
associated with any cancers, is a mass composed of group of such
abnormally produced cells. Cancers, under health records, have Breast cancer is very commonly observed disease today, among
been considered the most abrupt, yet a very common disease in several women of different age groups. Researchers and scientists
humanity. There are several types of cancers observed across the
world, while still many are surging up and are yet clinically not Address for correspondence: Disha Harshadbhai Parekh,
easily diagnosed. Mostly, any cancers form tumors, but one must Department of Computer Science, Indus University, Ahmedabad,
Gujarat, India.
understand that not all tumors are cancerous. To understand this
E‑mail: disha.hparekh213@[Link]
with more clarity, there are terms such as benign and malignant. ORCID: [Link]
In simple language, benign are noncancerous tumors, while
malignant are cancerous tumors. Hence, benign kind of tumors
This is an open access journal, and articles are distributed under the terms of the Creative
do not spread across any other parts of the body and do not Commons Attribution‑NonCommercial‑ShareAlike 4.0 License, which allows others to remix,
generate any new tumor, while those of malignant type grow tweak, and build upon the work non‑commercially, as long as appropriate credit is given and
the new creations are licensed under the identical terms.
Access this article online For reprints contact: WKHLRPMedknow_reprints@[Link]
Quick Response Code:
Website: How to cite this article: Parekh DH, Dahiya V. Predicting breast cancer
[Link]
using machine learning classifiers and enhancing the output by combining
the predictions to generate optimal F1-score. Biomed Biotechnol Res J
2021;5:331-4.
DOI:
10.4103/bbrj.bbrj_131_21 Submitted: 28‑Jun‑2021; Accepted: 29‑Jul‑2021;
Published: 07-Sep-2021.
© 2021 Biomedical and Biotechnology Research Journal (BBRJ) | Published by Wolters Kluwer - Medknow 331
Parekh and Dahiya: Predicting breast cancer with machine learning
today are majorly working in bringing innovation in detecting Methods
breast cancers and discovering drugs that help overcome breast
This chapter mainly consists of the steps involved in the
cancer during early stages. Observing the passion for this area,
research of analyzing breast cancer dataset aided by ML
we have compared and formulated few machine learning (ML)
models. The steps with code/snippet have also been shown
techniques that help in early detection of breast cancer. Basically,
implementing ML algorithms in healthcare and biomedical field and can be found on: Let us examine the steps involved in
has shown a tremendous increment and interest of the scientists the research.
and researchers around the globe. ML identifies three major This study involves use of R Programming Language, which
types of learning: supervised, un‑supervised, and reinforcement is a statistical tool with more than 10,000 libraries. From
learning. After obtaining certain required knowledge on these the analysis of surveys done, we found the use of Wisconsin
learning paradigms, we learned various algorithms to implement Diagnostic Dataset by several researchers. Hence, for the paper,
on cancer dataset. To show our model and to showcase results on we have used the same dataset for analyzing breast cancer. The
ML algorithms, we have used a very famous Wisconsin Breast dataset contains 11 fields with approximately 700 observations.
Cancer Dataset which is openly available on UCI ML website. This dataset is available online at UCI ML Library.[6]
These data consist of two versions basically, that is, diagnostic
and prognostic. Depending on our research pursuit, we have The study focuses purely on diagnostic dataset, and the result
obtained diagnostic dataset. Algorithm implementation has obtained is on the basis of the data framed as either malignant
been done in R Language using R Studio. R is a programming or benign. M in the dataset stands for Malignant which means
language and free software environment for statistical computing a fair chance of cancer which spreads rapidly, while B stands
and graphics supported by the R Core Team and the R Foundation for Benign which means it is going to be a noncancerous tumor
for Statistical Computing. The R language is widely used among that grows gradually.
statisticians and data miners for developing statistical software This section shows the code of several steps involved in
and data analysis. Hence, manufacturer, company name, city, collecting, cleaning, processing, and analyzing the data. We
etc would not be effective as it is a software tool. Programming have shown the code as well in R so as to aid the researchers
codes can be obtained in Appendix A of this paper. to understand and implement it practically. Let us examine
This paper shows related work in Chapter II, research the steps involved.
methodology in Chapter III, results in Chapter IV, and Step‑1: Data acquisition
conclusion with future work in Chapter V. The dataset we have used is wdbc. To extract it online, the
code written in R is shown in Figure 1. Second, the data can
Related Work be imported also after saving it on your local drive. The dataset
This section shows the work done by researchers and scientists contained columns with generic names, and hence, we have
on the cancer dataset. To gain the insights on other novel changed the names of each column which is also indicated
works carried out across the world, we surfed many articles in the code.
and papers, out of which five papers were distinguished to be Step‑2: Data preparation
of the same interest as ours. The findings and results with its Data preparation is an essential stage while processing raw
implementation on a type of dataset are compared in Table 1.
data. The dataset used here contains few NA or null values,
The papers studied helped analyze the usage of train versus which needs to be processed before we actually start training
test dataset as 70/30 in almost all the papers. The dataset our model. After importing the data online with the code as
mostly observed was Wisconsin Breast Cancer Diagnostic shown in Figure 1, the process of removing null fields was
Dataset (wdbc) available on a UCI ML repository website.[6] carried out, and the code mentioned is as shown n Figure 2.
Table 1: Comparative analysis of few papers with their ML methods and accuracy
Name Dataset used Year ML algorithms used Best ML strategy with accuracy
Omar Ibrahim Obaid, 2018 [3]
Wisconsin breast cancer diagnostic 2018
SVM, decision tree, kNN SVM with accuracy 98.1
Agarap, 2019[1] Wisconsin breast cancer diagnostic 2019
GRU‑SVM, linear regression, L2‑SVM with accuracy 96.09
multilayer perceptron, nearest
neighbor, Softmax regression, SVM
Sara Alghunaim, 2019[4] Wisconsin breast cancer diagnostic 2019 SVM decision tree, random forest, SVM with accuracy 99.68 on
on two platforms SPARK and SPARK
WEKA
Tawseef Ayoub Shaikh, 2019[5] Wisconsin breast cancer diagnostic 2019 Naïve bayes, kNN, J48, SVM SVM with accuracy 95.10
Can Hou et al., 2020[2] Breast cancer data from West 2020 Extreme gradient boosting, random Extreme gradient boosting with
China Hospital of Sichuan forest, deep neural network, logistic accuracy of 67.1
University Regression
SVM: Support vector machine, GRU: Gated recurrent unit, SPARK, WEKA, ML: Machine Learning, kNN: K-Nearest Neighbours
332 Biomedical and Biotechnology Research Journal ¦ Volume 5 ¦ Issue 3 ¦ July-September 2021
Parekh and Dahiya: Predicting breast cancer with machine learning
Figure 1: Importing Wisconsin Diagnostic Breast Cancer Dataset
Figure 2: Data preparation
Figure 3: Preparing train set and test set data
Figure 4: Predictive Model 1 using general linear model
Figure 5: Predictive Model 2 using support vector machine
Figure 6: Predictive Model 3 using single-layered neural network
Figure 7: Combining predictive models to gain better performance
Step‑4: Developing predictive data models using machine
learning algorithms
In this step, we have used the trained set to prepare data
model using three different algorithms. The experiment
involved using three ML algorithms, mainly, support vector
Figure 8: ROC Curves for SVM, GLM and Neural Network machine (SVM), general linear model (GLM), and neural
networks (NNET). The predictive data models developed using
Step‑3: Data training these three algorithms were further used to generate confusion
This step deals with training normalized data to test and train matrix and compare the results of each of these algorithms. The
set data. The data help in preparing the data models according code for each algorithm is shown in Figure 4 for GLM, Figure 5
to the algorithm we intend to use. Here, the training of data for SVM, and Figure 6 for NNET. Here, we are applying the
set was done as 70:30; 70% being train set and 30% being the training and testing of a model on the same dataset which is
test set. The code in R is shown in Figure 3. not considered to be a realistic measure of model performance.
Biomedical and Biotechnology Research Journal ¦ Volume 5 ¦ Issue 3 ¦ July-September 2021 333
Parekh and Dahiya: Predicting breast cancer with machine learning
Table 2: Experimental results of each classifier
Algorithms Confusion matrix Accuracy (%) Sensitivity (%) Specificity (%) Kappa (%) Improved
efficiency (%)
B M
GLM 95.59 97.32 92.31 90.17 96.66
B 145 6
M 4 72
SVM 96.48 95.97 97.44 92.28 97.27
B 143 2
M 6 76
NNET 96.04 96.64 94.87 91.24 96.69
B 144 4
M 5 74
SVM: Support vector machine, GLM: General linear model, NNET: Neural networks
Hence, here, we have used 10‑fold stratified cross‑validation. after studying thoroughly about several classifiers, we took
This has helped to acquire correlations between each algorithm. three ML classifiers, mainly GLM, SVM, and single‑layered
NNET. From the study, we can conclude that upon combining
A basic SVM approach was used decades ago[7] to obtain the
the predictions of each classifier, we could bring a rational
highest accuracy of 97.3%, and then, the variant of SVM was
improvement in the F1‑score of each classifier. Further
used known as least square SVM that uses linear equations for
SVM and had got the accuracy of 98.5%. Hence, at the first improvement on single‑layered NNET can be enhanced by
instance, we have used SVM approach on the trained data. adding/combining it with some other classifiers. In future, we
Linear regression is a technique to model the relationship intend to combine neural network with some other classifiers to
between one dependent and one or more independent variable. enhance the accuracy ratio and thus increase the performance
Thus, as a second algorithm, we have applied logistic regression of model.
using GLM technique on the trained data. Finally, we used an Financial support and sponsorship
NNET of size 5 to calculate the best algorithm out of all three. Nil.
The code for these predictive models is shown in Figure 7.
Conflicts of interest
There are no conflicts of interest.
Result
After executing individual code of each algorithm, the result
obtained for each is listed in Table 2. From the results obtained, References
we could analyze the confusion matrix with better true‑positive 1. Agarap AF. On Breast Cancer Detection: An Application of Machine
Learning Algorithms on the Wisconsin Diagnostic Dataset. ICMLSC
and true‑negative values and the accuracy of SVM was found 2018, February 2–4, 2018; 2019.
to be best. Although the purpose of the experiment was to 2. Can Hou MD, Xiaorong Zhong DM, Ping He DM, Bin Xu M, Sha Diao
analyze single‑layered NNET, the accuracy obtained was less, M. Predicting breast cancer in Chinese women using machine learning
but this further can be implemented with combination of other techniques: Algorithm Development. JMIR Med Inform June, 2020;
Volume – 8, pages:1-11.
classifiers such as LSTM or Bi‑LSTM, and we definitely be 3. Omar Ibrahim Obaid MA. Evaluating the performance of machine
able to improve on the accuracy level. learning techniques in the classification of Wisconsin breast cancer. Int
J Eng Technol 2018; Volume – 7, No. 4.36, Pages: 160-166.
After obtaining the results of each, a graph of an R plot was 4. Sara Alghunaim HH. On the scalability of machine-learning algorithms
generated which included comparative study of each of the for breast cancer prediction in big data context. IEEE Access 2019;
algorithm as shown in Figure 8. It includes the receiver Volume - 7, Pages:91535-46.
operating characteristic curve which demonstrates the 5. Tawseef Ayoub Shaikh RA. Applying Machine Learning Algorithms
for Early Diagnosis and Prediction of Breast Cancer Risk. Springer
association between sensitivity and specificity, in general.
Nature Singapore, Proceedings of 2nd International Conference on
Later to improve the performance and efficiency of each Communication, Computing and Networking; 2019. p. 589-98.
6. Wisconsin Breast Cancer Dataset. (n.d.). Retrieved from UCI Machine
algorithm, the predictions of all three classifiers were combined, Learning Repository: Available from: [Link]
and the result obtained in terms of F1‑score of each was found to datasets/Breast+Cancer+Wisconsin+%28Diagnostic%29 , accessed on
be 96.66% for GLM, 97.27% for SVM, and 96.96% for NNET. 21st March, 2020.
The result is shown in the last column of Table 2. 7. Bennett K, Blue J. A Support Vector Machine Approach to Decision
Trees. In Proceedings of the IEEE International Joint Conference on
Neural Networks; 1998. p. 2396-401.
Conclusion 8. Institute, N. C. (n.d.). Available from: [Link]
disease/categories/[Link] , accessed on: 12th June, 2021.
The study carried out on Wisconsin Breast Cancer Dataset 9. WebMD, G. P; January, 2020. Available from: [Link]
has led to understand various classifiers to predict breast com/cancer/guide/understanding-cancer-basics , accessed on 1st June,
cancer. An extensive research survey was carried out, and 2021.
334 Biomedical and Biotechnology Research Journal ¦ Volume 5 ¦ Issue 3 ¦ July-September 2021