## 3 CNN Architecture and Parameter Optimizer
### Parameter Optimization  
Selecting an optimal network parameter combination is a time-consuming task. In this study, the objective is to investigate the performance of CNNs using parameter optimization. The Taguchi method is a low-cost, high-efficiency quality engineering method that emphasizes improving product quality through design experiments. Therefore, the Taguchi method was applied for the parameter optimization of CNNs.  
First, the objective function is defined. Then, the factors and levels that affect the objective function are selected. The orthogonal array and the signal-to-noise ratio (S/N ratio) are the two main indicators in the Taguchi method. The orthogonal array is used to determine the number of times the experiment needs and allocate experimental factors into an orthogonal array. Additionally, the S/N ratio is used to verify whether the CNN parameters are the optimal parameter combination. Finally, according to the experimental results the optimal key factors and levels are decided. Although the cost-effectiveness of the experiment is an issue, the optimal combination of factors and levels can be found. Figure 8 displays the flowchart of the Taguchi method.  
Figure 8: Flowchart of the Taguchi method.  
Figure 7: AlexNet architecture.  
* **First step:** Understand the task to be completed. Here, the CNN parameters, including kernel size (KS), stride (S), and padding (P), were tasks that needed to be optimized in order to achieve higher accuracy in fewer experiments.
* **Second step:** Select factors and levels. In AlexNet, the first convolutional layer involves global feature extraction, and the fifth convolutional layer involves local feature extraction of the input image. Therefore, KS, S, and P of the first and fifth convolutional layers were adjusted by Taguchi method. The factors are: kernel size (C1-KS), stride (C1-S), and padding (C1-P) of the first convolutional layer, kernel size (C5-KS), stride (C5-S), and padding (C5-P) of the fifth convolutional layer. The levels are assigned according to the parameters commonly used in the state-of-art CNNs as shown in Table 4.
* **Third step:** Choose an appropriate orthogonal array. The orthogonal array provides statistical information with fewer experiments. After the factors and levels selection, the appropriate orthogonal array should be chosen based on the factors and the levels. In this study, C1-P had two levels, and C1-KS, C1-S, C5-KS, C5-S, and C5-P had three levels. The total degree of freedom in the experiment is 11, therefore, the \(L_{18}\) orthogonal array is selected. Initially, the selected factors and levels required 486 (3 \(\times\) 3 \(\times\) 2 \(\times\) 3 \(\times\) 3) experiments, while using the orthogonal array the scope of experiments was reduced to only 18 experiments.
* **Fourth step:** Fill in the \(L_{18}\) orthogonal array with the factors and levels designed in Table 4. The complete \(L_{18}\) orthogonal array is presented in Table 5.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline  & **Factor** & **Level 1** & **Level 2** & **Level 3** \\ \hline \multirow{3}{*}{C1} & KS & 13 & 11 & 9 \\  & S & 4 & 3 & 2 \\  & P & 2 & 1 & - \\ \hline \multirow{3}{*}{C5} & KS & 7 & 5 & 3 \\  & S & 3 & 2 & 1 \\ \cline{1-1}  & P & 2 & 1 & 0 \\ \hline \hline  
* **Fifth step:** Perform 18 experiments based on the \(L_{18}\) orthogonal array. In this study, each experiment was tested five times to get an overall accuracy.
* **Sixth step:** Calculate the S/N ratio and analyze the experimental data.
* **Seventh step:** Accurate classification of lung tumor images is the purpose of this study. Hence, a higher S/N ratio indicates that the parameter combination is optimal and is able to provide superior performance.
* **Eighth step:** Finally, use the acquired optimal parameter combination to train AlexNet again to verify that the optimal parameter combination is able to improve the accuracy of this network.