# A Novel Convolutional Neural Network Algorithm for Histopathological Lung Cancer Detection
## 2 Materials and Methods
### Training
#### 2.3.1 Neural Networks
Then, there is a global average pooling layer followed by a fully connected layer of 1 unit employing the sigmoid activation function;
* **Version 1:** Introduced a fully connected layer with 512 units and ReLU as an activation function between global average pooling and fully connected layers of Version 0, in order to increase the model's capacity to capture more complex patterns;
* **Version 2:** To reduce the dimensionality of the feature maps and enable the learning of more features, a max pooling layer with a pooling size of 2 \(\times\) 2 pixels was added after the initial convolutional layer. Upon the addition of the new max pooling layer, a new set of convolution and max pooling layers were added, duplicating the identical dimensions and activation functions but with 64 filters rather than 32 in the convolution layer, which allows for learning more complicated features;
* **Version 3:** After the appended layers in Version 2, a new pair of convolution and max pooling layers were added, with the convolution layer having 128 filters. The increase in the number of filters makes the model more capable of acquiring more information about features and patterns;
* **Version 4:** Replicated the addition of Version 3;
* **Version 5:** The max pooling layer positioned before the global average pooling layer was removed to allow keeping more spatial information before the final classification;
* **Version 6:** The number of filters for the final convolution layer was increased to 256 to enhance the model's ability to capture more complex features and patterns;
* **Version 7:** Contrary to the change made in Version 5, the max pooling layer placed before the global average pooling layer was reinserted with a size of 2 \(\times\) 2 pixels, in order to downsample the spatial dimensions of the feature maps;
* **Version 8:** Placed a new set of convolution and max pooling layers before the global average pooling layer, one of which included 128 filters, and modified the first fully connected layer units from 512 to 128. While the reduction of units in the fully connected layer reduces the number of parameters and prevents overfitting, the addition of the convolutional layers increases the model's capacity to learn more features, as described above;
* **Version 9:** Demonstrated a \"U-architecture,\" which means it has pairs of convolution layers and max pooling with only the filters changing in the following order: 32-64-128-256-128-64-32. This version also reduced the number of the first fully connected layer units from 128 to 32. The reasons for the changes remain the same as in the above versions;
* **Version 10:** Reverted the number of units in the first fully connected layer to 512 with the aim of capturing complex patterns;
* **Version 11:** Removed the previously added sets in Version 9 and changed the convolution layer from 256 to 128 filters. As a result, convolutional layers of 32, 64, and 128 filters were retained, culminating in a CNN with one convolution layer of 32 filters, another of 64 filters, and three of 128 filters. These changes simplified the CNN by reducing its parameters;
* **Version 12:** Deleted the last set of convolutional layers with 128 filters and max pooling layers, as well as the fully connected layer with 512 units, which reducesthe number of parameters, helps prevent overfitting, and makes the model more computationally efficient. Since the objective of this study is to perform binary classification by predicting tumor and non-tumor classes, CNNs such as AlexNet, GoogLeNet, and ResNet-50 were adapted for this task. To achieve this, the final layer of these models was modified to have a fully connected layer with one unit and sigmoid as the activation function. Table 4 presents all used CNNs, as well as their number of parameters.