# Optimizing Cervical Cancer Diagnosis with Feature Selection and Deep Learning
## 2 Materials and Methods
### Image Segmentation  
This paper investigates the morphometric characteristics of a cell and its nucleus. For this purpose, binary representations of both objects are required and, therefore, input color image segmentation is required. As segmentation of medical images is not easy, it has also become an increasingly active research field [31; 32]. To reduce the noise in the images, median filtering was applied as a pre-processing step. This technique is well known to effectively remove noise while preserving important structural features such as the nucleus boundary. Subsequently, a K-means clustering algorithm was used to segment the images, isolating the nucleus and cell regions and minimizing the influence of irrelevant background data. These pre-processing steps mitigate noise and enhance the reliability of subsequent feature extraction. K-means clustering is one of the simplest unsupervised learning algorithms to solve a clustering problem [33]. It has a single input parameter that represents a \(k\) input cluster. Therefore, prior to the beginning of the clustering process, knowledge of the number of clusters is required. The main idea behind this algorithm is to determine a \(k\) center of each cluster. This heuristic algorithm may not be able to converge to the global optimum, therefore the centroids should be placed in a cunning manner. When a centroid is assigned, the next step is to take each data point and associate it with the closest center. When this step is completed, the first step of the algorithm is completed, and the initial grouping is finished. The following procedure is to recalculate the new centroids defined as the centers of the groups initially calculated. This results in a new \(k\) centroids and the association procedure of all data must be repeated [33]. The consecutive steps of the generated loop change the location of the k centroids until convergence is achieved. The aim of the algorithm is to minimize the objective square error function (see Equation (1)). \[J=\sum_{j=1}^{k}\sum_{i=1}^{n}||x_{i}^{j}-c_{j}||^{2}, \tag{1}\]  
where \(||x_{i}^{j}-c_{j}||^{2}\) is a chosen distance measure between a data point \(x_{i}^{j}\) and the cluster center, \(c_{j}\) is an indicator of the distance of the \(n\) data points from their respective cluster centers. Our research uses the RGB color distance between a pixel and a mean RGB color cluster as a measure of distance. The initial centroids are randomly selected, and the cluster with the highest mean RGB value is identified as the result of segmentation. In this study, the optimal number of clusters was empirically determined to be three. Selecting a larger k-value led to the loss of significant data, occasionally forming gaps within nuclei or uneven clusters. However, using two clusters introduced too much meaningless data, leading to unsatisfactory image segmentation. Given this context, opting for three clusters represents a balance between analyzing irrelevant data and ignoring valuable information. For complete segmentation of a cell and its nucleus, a space partition was required to obtain separate binary images for both cell and nucleus (see Figure 3). These images were produced by thresholding the segmented image (\(img_{seg}\)) as described in Equations (2) and (3). The thresholds were determined based on the values obtained from the k-means segmentation, which served as a representation of the identified regions. This representation allows for further determination of the morphological features of the cell and nucleus in Section 2.4 and will be treated as an entry point for the feature extraction subsystem. \[cell(x,y)= \begin{cases}0&\text{if }img_{seg}(x,y)>t_{c}\\ 1&\text{otherwise}\end{cases} , \tag{2}\]  
\[nucleus(x,y)= \begin{cases}0&\text{if }img_{seg}(x,y)>t_{n}\\ 1&\text{otherwise}\end{cases}