# Metamaterial Design with Nested-CNN and Prediction Improvement with Imputation
## 3 The Nested-CNN Architecture and Hyperparameter Optimization
### Imputation for Prediction  
Imputation was used before the training process of AI algorithms. For various reasons, many real-world datasets contain missing values, often encoded as blanks, not-a-numbers (NaNs), or other place-holders. For the usage of these datasets in AI and machine learning algorithms, imputation methods are introduced as an iterative imputer or the nearest neighbor imputation (KNN) that can replace missing values with numerical values before the training process.  
The imputation method on prediction has been proposed to improve the nested-CNN's performance. Adapting the Don't Care conditions to the deep learning model in the digital system design or reducing the impact of the non-interested region during the prediction was the main goal [50]. Imputation for prediction was used to the non-interested part of the reflection coefficient to decrease the error of the interested region of the reflection coefficient. The K-nearest neighborhood method was used to impute the non-interested region of the reflection coefficient by finding the most similar signals to the desired part of the reflection coefficient. In Figure 4, the 750 samples have been selected as the non-interested part is shown.  
\begin{table}
\begin{tabular}{c c c} \hline \hline \multicolumn{3}{c}{**Model-1**} \\ \hline
**Layer** & **Specifications** & **Activation Func.** \\ \hline Input & 1\(\times\) 1500 & \\
1D-Convolution & Filters = 384, Size = (1,3), Stride = 1 & Linear \\
1D-Convolution & Filters = 96, Size = (1,3), Stride = 1 & Relu \\
1D-Convolution & Filters = 192, Size = (1,3), Stride = 1 & Relu \\
1D-Convolution & Filters = 256, Size = (1,3), Stride = 1 & Relu \\ Flatten & & \\ Dense & Size = 1 \(\times\) 2500 & Sigmoid \\ \hline \hline \end{tabular}
\end{table}
Table 2: Details and architecture of Model-1.  
\begin{table}
\begin{tabular}{c c c} \hline \hline \multicolumn{3}{c}{**Model-2**} \\ \hline
**Layer** & **Specifications** & **Activation Func.** \\ \hline Input & 50\(\times\) 50 & \\
2D-Convolution & Filters = 800, Size = (3,3), Stride = 1 & Selu \\ Max Pooling & Size = (2,2) & \\
2D-Convolution & Filters = 192, Size = (3,3), Stride = 1 & Relu \\
2D-Convolution & Filters =128, Size = (3,3), Stride = 1 & Relu \\ Flatten & & \\ Dense & Size =1500 & Linear \\ Dense & Size =1500 & Linear \\ Dense & Size =1500 & Linear \\ \hline \hline \end{tabular}
\end{table}
Table 3: Details and architecture of Model-2.  
KNN-imputer chooses the most similar signals to the interested region based on the Euclidian distance [51], then fills the non-interested region by using the average of the most similar neighbors. There were three factors for the KNN-imputer for the prediction side: the first one was how many samples have been used for filling, the second one was how many neighbors have been used for the KNN-imputer, and the third one was the count of the dataset. These three factors highly depend on each other. The answer to the question of how many neighbors should be used gave different results depending on the number of samples to be filled and the count of the data set. In the experiment, for the selection of the number of neighbors, it was decided that the non-interested region was used for 750 samples. The non-interested region was evaluated for the first 750 samples and the last 750 samples of each test data. The first 750 samples and the last 750 samples of each test data were filled by applying the KNN method separately. The data filled in the first part and the last part were used as separate data, thus 5000 data were created using 2500 test data, and the MAE of nested-CNN with imputation with prediction was calculated. MAE, for the first 750 samples, the last 750 samples, and the average of them, are given in the results section. The other key factor was the count of neighbors. For the last and first 750 samples, the optimum number of neighbors was searched between 10 and 200 with a stride of 10.