# Deep Convolutional Neural Network Model for Automated Diagnosis of Schizophrenia Using EEG Signals
## 3 Deep Learning
### Proposed CNN Architecture  
Figures 2 and 3 highlight the architectures proposed in this study. Subject-based testing and non-subject based testing involve different approaches. CNN architecture of subject-based testing uses average pooling layer to obtain smoother features and global average pooling layer at the end to provide more generalized predictions, while the non-subject based testing is a classical CNN architecture that consists of convolution, max pooling and fully connected layers. These structural differences help to enable the model to generalize better during the training phase, depending on the partitioned training and testing data. The non-subject based testing model tends to perform well as we may be using the same subject data for training as well as testing. However, when data are separated based on subject, the classification model needs to learn well the generalized features, in order to classify the new subject data correctly. Hence different architectures of CNN were used.  
To improve generalization for subject based testing, dropout is applied to layers 4 and 6 during training, with a dropout rate of 0.5 (meaning that there is 0.5 probability that a neuron will be dropped out during training) but in non-subject based testing, dropout is applied to layers 9 and 10 with a dropout rate of 0.5. Table 1 details the layers used. In subject based testing, Adam optimization [39] parameters, with a learning rate of 0.001, are employed with the Leaky Rectifier Linear Unit (LeakyRelu) and their function is used as the activation functions for layers 1, 3, 5, 7, 9 and 11, respectively. Max pooling is employed after convolution to extract the most crucial features. The average pooling layer is applied after max pooling, to better smooth the features. Subsequently, the global average pooling layer is used instead of the dense layer, in order to obtain a more generalized model. Global average pooling has the upper hand over the dense layer as it does not contain any trainable parameters, thus reducing the likelihood of overfitting. All of the factors are fine-tuned based on the training set that provides the optimal training accuracy. The number of filters and kernel size were determined via the brute force technique. Classification was then done with the help of the fully-connected layer.  
In non-subject based testing, Adam optimization parameters with a learning rate of 0.0001 are used with LeakyRelu and Softmax functions for layers 1, 3, 5, 7, 9, 10 and 11, respectively. Max pooling is applied after convolution at each stage to extract the most important features. Table 2 highlights the details of all layers used. The model with the best validation accuracy was considered during training and testing. Classification was then done with the help of the fully-connected layer.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Layers** & **Type of Layer** & **No. of Neurons (Output Layer)** & **Kernel Size** & **Stride** \\ \hline
1 & Convolution & \(6248\times 5\) & 3 & 1 \\
2 & Max pooling & \(3124\times 5\) & 2 & 2 \\
3 & Convolution & \(3122\times 5\) & 3 & 1 \\
4 & Max pooling & \(1561\times 5\) & 2 & 2 \\
5 & Convolution & \(1559\times 5\) & 3 & 1 \\
6 & Average pooling & \(779\times 5\) & 2 & 2 \\
7 & Convolution & \(777\times 5\) & 3 & 1 \\
8 & Average pooling & \(388\times 5\) & 2 & 2 \\
9 & Convolution & \(386\times 5\) & 3 & 1 \\
10 & Global Average pooling & 5 & - & - \\
11 & Fully connected & 2 & - & - \\ \hline \hline \end{tabular}
\end{table}
Table 1: Parameter details of each layer of the developed CNN model in subject base testing.