First Author\[1\]<sup>\*</sup>, Second Author<sup>2</sup>  
(Double Blind Review: Please do not type or edit anything here until final-camera ready submissions)

<sup>1</sup>First affiliation, City and Country (Please do not type or edit anything here, our editors will do the work for you)

<sup>2</sup>Second affiliation, City and Country (Please do not type or edit anything here, our editors will do the work for you)

<table>
<tbody>
<tr class="odd">
<td>ARTICLE INFO</td>
<td></td>
<td>ABSTRACT</td>
</tr>
<tr class="even">
<td><p><em>Article history:</em></p>
<p>Received XX Month 2024</p>
<p>Revised XX Month 2024</p>
<p>Accepted XX Month 2024</p>
<p>Online first</p>
<p>Published 1 September 2024</p></td>
<td></td>
<td>Breast cancer is the most prevalent invasive cancer in women and the second leading cause of cancer-related mortality among women. Interest in breast cancer research and prevention has surged recently. With the advent of data mining techniques, researchers can now efficiently extract valuable information from large databases, facilitating prediction, classification, and clustering. In this study, three classification models namely Decision Tree, Random Forest, and Logistic Regression were used to classify datasets related to breast cancer. The goal was to develop an accurate model to predict breast cancer and reduce the risk of death from the disease. The performance of these models was evaluated using three metrics: Precision, Recall, and F1 Score. Prediction accuracy was also measured. Comparative experiments in this study revealed that the Random Forest model outperformed the other two techniques in terms of performance and accuracy. Consequently, the study's model demonstrates significant clinical and referential value in real-world applications.</td>
</tr>
<tr class="odd">
<td><p><em>Keywords:</em></p>
<p>Breast Cancer</p>
<p>Machine Learning</p>
<p>Prediction</p>
<p>Random Forest</p>
<p>Logistic regression</p>
<p>Decision Tree</p>
<p><em>DOI:</em></p>
<p>10.24191/jcrinn.v9i2</p></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

# INTRODUCTION

Breast cancer is one of the most common cancers globally, including in Malaysia, and remains the leading cause of cancer-related death in women. Treatment for breast cancer often involves surgical resection, chemotherapy, radiotherapy, and medication to target microscopic disease that has spread from the primary tumor. In 2020, 2.3 million women were diagnosed with breast cancer, resulting in 685,000 deaths worldwide. As of the end of 2020, 7.8 million women had been diagnosed with breast cancer in the preceding five years, making it the world's most common cancer. Breast cancer causes more disability-adjusted life years loss in women than any other cancer globally. It affects women of all ages after puberty, with incidence rates increasing with age (WHO, 2021).

In Malaysia, breast cancer is the most common cancer among women, with approximately one in every 19 women at risk. The number of cases is steadily rising, particularly with the growing population. Improvements in mammography screening are needed to enhance early detection and efficiency in medical image analysis. Early diagnosis can significantly extend the lives of cancer patients (Ismail & Sovuthy, 2019). The incidence rate in Malaysia is 38.7 per 100,000 women per year, and the total number of breast cancer patients is expected to increase further. Notably, Malaysian breast cancer patients have one of the lowest survival rates in the Asia-Pacific region, with a five-year survival rate of only 49%, compared to up to 90% in the United States (Mujar et al., 2018).

Breast imaging, including ultrasound, is commonly used for screening but has limitations such as operator dependency and potential false negatives. Traditionally, diagnostic accuracy relies heavily on a doctor's experience, which can be fallible. Recent advancements in machine learning (ML) have significantly enhanced breast cancer diagnosis and prognosis by differentiating between benign and malignant tumours and predicting patient outcomes.

The development of computing technology and patient databases has facilitated the analysis of large datasets, improved diagnostic accuracy and aiding in future medical planning. ML techniques can automate manual tasks and improve diagnostic precision. For instance, text and speech analysis can classify patient emotions, which can influence health outcomes. Despite the success of ML models in other regions, factors influencing breast cancer vary by location, necessitating models tailored to the Malaysian context.

This study aims to integrate ML techniques to analyze breast cancer data using Python and developing a mathematical model with high prediction accuracy. A dataset from the UCI Machine Learning Repository is utilized to develop a breast cancer prediction model using Python. The dataset contains 699 instances and 11 attributes, including clump thickness, uniformity of cell size, and bare nuclei.

This study could significantly benefit cancer patients by enabling early diagnosis and treatment, thereby reducing breast cancer mortality rates. Early detection is crucial as it often allows for less aggressive and more effective treatment options. Patients diagnosed early have a better chance of successful treatment and increased life expectancy, as they can receive treatment before the disease progresses to an advanced stage. Additionally, early treatment is generally less expensive than treatment for late-stage cancer. In summary, this study aims to facilitate early treatment, improving patient outcomes and reducing healthcare costs associated with late-stage breast cancer diagnosis

# PRELIMINARIES

This section defines and explores the theory behind the machine learning process, focusing on the three algorithms used in this study: Logistic Regression, Decision Trees, and Random Forest.

## Machine Learning

Machine Learning (ML) encompasses a broad range of data analysis algorithms that build models for autonomous predictions by iteratively improving based on training data. Essentially, software program performance improves automatically over time (Jordan & Mitchell, 2015). The primary goal of an ML algorithm is to create a mathematical model that accurately fits the data. There are three types of learning: supervised, semi-supervised, and unsupervised (Loukas, 2020).

Supervised learning algorithms require labeled data for training purposes. These labels, or ground truth, provide the necessary responses to specific questions. Unsupervised learning, on the other hand, clusters data with similar characteristics and generates labels that meaningfully organize the data without prior labeling. This method often requires larger training datasets compared to supervised techniques. Unsupervised learning can identify meaningful clustering labels, which can then be used in supervised training to develop effective ML techniques.

ML algorithms evaluate datasets to extract data-driven models, prediction rules, or decision rules. To ensure that ML systems operate autonomously and effectively without human intervention, they must learn or derive knowledge from input data or experiences, such as rules or patterns. The process involves several steps: initially, the system must obtain data-driven features. Next, it analyzes these features to detect and classify any potential patterns or abnormalities. Finally, an ML algorithm is used to determine the most suitable model to represent the data's behavior or trends (Sahran et al., 2018).

In this study, the output is classified into two categories: benign and malignant. The machine learning algorithms used for this classification are Logistic Regression, Decision Tree, and Random Forest. These algorithms are chosen for their efficiency in making predictions based on specific criteria and comparisons.

## Logistic Regression

Logistic regression is a supervised machine learning model commonly used for classification and predictive analytics. Also known as a logit model, it calculates the likelihood of an event occurring based on a set of independent variables. The model is particularly useful when the outcome is dichotomous, meaning it can take only two possible values.

In logistic regression, a logit transformation is applied to the odds (the probability of success divided by the probability of failure). This transformation, also known as the log odds or the natural logarithm of odds, helps to differentiate between classes (or categories). Unlike generative algorithms such as Naive Bayes, logistic regression does not generate new data about the class it predicts; instead, it focuses on classification.

Logistic regression is widely regarded for its simplicity and interpretability. It can be applied in various fields, such as medicine, to predict the likelihood of a disease or illness within a population. Its ability to provide probability scores for classifications makes it a valuable tool for decision-making processes in diverse applications.

The model applies a logit transformation to convert the linear combination of input features into a probability. The logit function (log-odds) is defined as the natural logarithm of the odds of the event.

\[\text{logit}\left( p \right) = \ln\left( \frac{p}{1 - p} \right)\ \]

where p is the probability of the positive class.

The logistic function, or sigmoid function, is used to map any real-valued number into the range \[0, 1\]

\[\sigma\left( z \right) = \frac{1}{1 + e^{- z}}\]

where z is linear combination of input features and their corresponding coefficients.

The logistic regression model can be expressed as

\[p\left( y = 1 \middle| x \right) = \sigma\left( w^{\top}\mathbf{x} + b \right)\]

where \(p\left( y = 1 \middle| \mathbf{x} \right)\) is the probability of the positive class given the input features \(x\), \(
w\) is the vector of coefficients (weights), \(\mathbf{x}\) is the vector of input features and *b* is the bias term. The model parameters \(\left( w\ \text{and}\ b \right)\) are estimated using a method called maximum likelihood estimation (MLE). The goal is to find the parameter values that maximize the likelihood of observing the given training data.\(
\)

## Decision Trees

The Decision Tree algorithm is one of the simplest and most widely used classification algorithms, belonging to the supervised learning algorithm family. Unlike other supervised learning algorithms, Decision Trees can be used to solve both regression and classification problems. The primary objective of using a Decision Tree is to build a training model that can predict the class or value of an attribute by learning simple decision rules from the training data.

The Decision Tree algorithm begins at the root node, which encompasses the entire dataset. It selects the most optimal feature to split the data, using criteria such as Gini impurity or information gain to determine the split that best separates the data into homogeneous subsets. This splitting process continues recursively, with each node creating further branches based on the values of the selected features, thereby forming a decision tree. At each node, the algorithm evaluates potential splits and chooses the one that maximizes homogeneity within the resulting subsets. This process stops when further splitting does not significantly improve the model or when all data points in a node are homogeneous. The final tree, consisting of decision nodes and leaf nodes, represents the decision-making process, which can then be used for classification or regression tasks. The process is shown in Figure 1.

![](6682c9e03010a_media/media/image1.png)

**Figure 1: Decision Tree’s illustration (Source: Chauhan Singh, 2022)**

## Random Forest

A Random Forest is a machine learning technique used for regression and classification problems, leveraging the power of ensemble learning, which combines multiple classifiers to tackle complex issues. The algorithm consists of numerous decision trees, collectively referred to as a 'forest.' The forest is trained using bagging, or bootstrap aggregation, a meta-algorithm that enhances the accuracy of machine learning models through an ensemble approach. In Random Forest, each tree is constructed from a random subset of the data, and the final prediction is determined by aggregating the outputs of all the individual trees, either by averaging (for regression) or majority voting (for classification). The accuracy of the model typically increases with the number of trees, making Random Forest a robust and reliable method for various predictive tasks. The process illustrated in Figure 2.

![](6682c9e03010a_media/media/image2.png)

**Figure 2: Random Forest’s illustration (Source: Mbaabu Onesmu, 2020)**

## Model Evaluation

Model evaluation in machine learning is a critical process that involves assessing the performance of a trained model to ensure it generalizes well to unseen data. This process typically involves splitting the dataset into training and testing subsets, where the training set is used to build the model, and the testing set is used to evaluate its performance. Effective model evaluation ensures that the model not only performs well on the training data but also delivers accurate and reliable predictions on new, unseen data, thereby increasing its practical utility and reliability. In this study, four evaluation metrics are employed to measure the effectiveness of the model, including accuracy, precision, recall and F1 score.

1.  **Accuracy**

The accuracy of a classifier measures how effectively it can predict instances into the correct classification. It is calculated by dividing the number of correct predictions by the total number of instances in the dataset. It's important to note that accuracy is highly dependent on the threshold chosen by the classifier and can vary across different testing sets. Therefore, while accuracy provides a general overview of the classification performance, it may not be the best metric for comparing different classifiers. As a result, accuracy is often calculated using the following equation

\[Accuracy = \frac{\text{Number\ of\ Correct\ Predictions}}{\text{Total\ Number\ of\ Predictions}}\]

2.  **Precision**

Precision in machine learning is a metric that measures the accuracy of positive predictions made by the classifier. It focuses on the proportion of true positive predictions (correctly predicted positives) out of all instances predicted as positive, including both true positives and false positives. Precision is particularly valuable in scenarios where minimizing false positives is crucial. Mathematically, precision is calculated as

\[Precision = \frac{\text{True\ Positives}}{True\ Positives + \ False\ Positives}\]

Where True Positives (TP) are instances correctly predicted as positive and False Positives (FP) are instances incorrectly predicted as positive. A high precision score indicates that the classifier is making accurate positive predictions, minimizing false positives. It is a critical metric in applications where the cost of false positives is high, such as medical diagnostics or fraud detection.

3.  **Recall**

Recall, which is also commonly known as sensitivity or true positive rate, is a fundamental metric in machine learning that measures the proportion of actual positive instances that are correctly identified by the classifier. It focuses on how well the classifier identifies all positive instances, including those that are missed (false negatives). Mathematically, recall is calculated as

\[Recall = \frac{\text{True\ Positives}}{True\ Positives + False\ Negatives}\]

True Positives (TP) are instances correctly predicted as positive and False Negatives (FN) are instances incorrectly predicted as negative. A high recall score indicates that the classifier is effectively capturing a large portion of positive instances from the dataset. It is particularly important in applications where it's crucial to avoid false negatives, such as medical diagnostics (where missing a positive diagnosis can be critical) or search and rescue operations.

4.  **F1 Score**

The F1 score is a metric in machine learning that combines both precision and recall into a single measure. It provides a balance between these two metrics, making it useful when both precision and recall are equally important. It is calculated as follows.

\[F1\ Score\  = \ 2 \times \frac{Precision \times Recall}{Precision + Recall}\]

The F1 score reaches its best value at 1 (perfect precision and recall) and worst at 0. It is particularly useful in binary classification settings where there is an imbalance between the classes, and both false positives and false negatives need to be minimized. By considering both precision and recall, the F1 score provides a comprehensive assessment of a classifier's performance

# Methodology

Figure 3 depicts the general process of developing the machine learning model and describes the steps of the machine learning process used in this study.

> ![](6682c9e03010a_media/media/image3.png)
> 
> **Figure 3: Research Framework**

The sample dataset for this study was obtained from the Kaggle website and is classified as secondary data. There are 699 breast cancer patient records with 10 attributes. The independent variables in this study consist of Clump\_Thickness, Uniformity\_of\_Cell\_Size, Uniformity\_of\_Cell\_Shape, Marginal\_Adhesion, Single\_Epithelial\_Cell\_Size, Bare\_Nuclei, Bland\_Chromatin, Normal\_Nucleoi, Mitoses and the dependent variable is Class. The following Python coding shows the process of data analysis step by step.

![](6682c9e03010a_media/media/image11.emf)

**Figure 4: Importing Data**

![](6682c9e03010a_media/media/image12.png)

**Figure 5: Replace Missing value and Data Profiling**

![A screenshot of a computer program Description automatically generated](6682c9e03010a_media/media/image14.jpeg)

**Figure 6: Spliting dataset into Training and Testing Set**

![](6682c9e03010a_media/media/image15.jpeg)

**Figure 7: Modelling Process of Logistic Regression**

![](6682c9e03010a_media/media/image21.jpeg)**Figure 8: Modelling Process of Decision Trees**

> ![](6682c9e03010a_media/media/image25.jpeg)

**Figure 8: Modelling Process of Random Forest**

# RESULT AND DISCUSSION

# ![](6682c9e03010a_media/media/image27.jpeg)The experimental results conclusively demonstrated that the Random Forest model outperformed other models as a forecasting tool, boasting the highest accuracy score. Specifically, the Random Forest achieved an accuracy score of 97.81%, surpassing both the Decision Tree model (96.35%) and the Logistic Regression model (97.08%). This suggests that the predictions made by the Random Forest model are the most accurate among the evaluated models.

This result has proved that Random Forest is a powerful and flexible machine learning algorithm that improves predictive accuracy by combining multiple decision trees. It is particularly effective in handling large datasets with higher dimensions and provides reliable predictions while mitigating the risk of overfitting. Its ability to estimate feature importance also makes it a valuable tool for understanding complex datasets.

# Acknowledgements/Funding

(DOUBLE-BLIND reviewing. Leave the section as is. Only include Acknowledgements text in the final submission paper)

This section is compulsory. The following is an example of an acknowledgement statement:

The authors would like to acknowledge the support of Universiti Teknologi Mara (UiTM), Cawangan Perlis, Kampus Arau and College of Computing Informatics and Mathematics (KPPIM), Universiti Teknologi MARA, Malaysia for providing the facilities and motivational support on this research.

# Conflict of interest statement

(DOUBLE-BLIND reviewing. Leave the section as is. Only include CONFLICT OF INTERESTS text in the final submission paper)

# 

This section is compulsory. The following is an example of a conflict-of-interest statement:

The authors agree that this research was conducted in the absence of any self-benefits, commercial or financial conflicts and declare the absence of conflicting interests with the funders.

# Authors’ contributions

Each author contribution must be stated clearly reflecting each contribution to the body of the work and manuscript. Authors can refer to [<span class="underline">CRediT</span>](http://credit.niso.org/) (Contribution Roles Taxonomy) for the detailed information about individual contributions to the work. For example ***(Double Blind Review: Leave this section blank until final camera-ready submission)*:**

**Anis Muneerah Shaiful Bahari**: Conceptualisation, methodology, formal analysis, investigation and writing-original draft; **Nurhaswani Alias**: Conceptualisation, methodology, and formal analysis; **Zainovia Lockman**: Conceptualisation, formal analysis, and validation; **Haslina Misran**: Conceptualisation, supervision, writing- review and editing, and validation.

# References

Chaurasia, V., Pal, S., & Tiwari, B. B. (2018). Prediction of benign and malignant breast cancer using data mining techniques. *Journal of Algorithms and Computational Technology*, 12(2), 119–126. <https://doi.org/10.1177/1748301818756225>

Ismail, N. S., & Sovuthy, C. (2019). Breast Cancer Detection Based on Deep Learning Technique. *2019 International UNIMAS STEM 12th Engineering Conference (EnCon)*, 89–92. <https://doi.org/10.1109/EnCon.2019.8861256>

Jain, D., & Singh, V. (2018). Feature selection and classification systems for chronic disease prediction: A review. *In Egyptian Informatics Journal* (Vol. 19, Issue 3, pp. 179–189). Elsevier B.V. <https://doi.org/10.1016/j.eij.2018.03.002>

Jordan, M. I., & Mitchell, T. M. (2015). Machine learning: Trends, perspectives, and prospects. Science, 349(6245), 255–260. <https://doi.org/10.1126/science.aaa8415>

Kumari, M., & Singh, V. (2018). Breast Cancer Prediction system. *Procedia Computer Science*, 132, 371–376. <https://doi.org/10.1016/j.procs.2018.05.197>

Mujar, N. M. M., Dahlui, M., & Taib, N. A. (2018). Presentation, Diagnosis, and Treatment Among Patients With Breast Cancer in Malaysia. *Journal of Global Oncology*, 4(Supplement 3), 25s–25s. <https://doi.org/10.1200/jgo.18.10280>

Sahran, S., Qasem, A., Omar, K., Albashih, D., Adam, A., Norul Huda Sheikh Abdullah, S., Abdullah, A., Iqbal Hussain, R., Ismail, F., Abdullah, N., Hayati Md Pauzi, S., & Abd Shukor, N. (2018). Machine Learning Methods for Breast Cancer Diagnostic. *In Breast Cancer and Surgery. IntechOpen*. https://doi.org/10.5772/intechopen.79446

The American Cancer Society. (2021, November 19). What is Breast Cancer? WHO. (2021, March 26). Breast Cancer. World Health Organization.

<table>
<tbody>
<tr class="odd">
<td><blockquote>
<p><img src="6682c9e03010a_media/media/image29.png" style="width:1.01042in;height:0.36111in" alt="A picture containing text, clipart Description automatically generated" /></p>
</blockquote></td>
<td>© 2024 by the authors. Submitted for possible open access publication under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).</td>
</tr>
</tbody>
</table>

1.  <sup>\*</sup> Corresponding author. *E-mail address*: <donottypehere@email.com> (Add the e-mail in the final camera-ready submission)
