## 3 Overview of the Design Method
### Training an ANN for Predicting the S-Parameters of Hairpin Filters  
In this section, we delve into the specifics of the training phase for the artificial neural network applied to the hairpin filter. Given that the S-parameters of the microstrip filter precisely delineate its passband, stopband, insertion loss, and return loss frequency response characteristics, we designated the S-parameters as our research objective. We established an artificial neural network model to decipher the nonlinear correlation between the geometric design parameters of the hairpin filter and its S-parameters (amplitude). By varying the geometric design parameters of the hairpin filter, we investigated a potential design space, as illustrated in Table 1. We employed the electromagnetic simulation software, HFSS, to acquire the corresponding return loss and insertion loss of the filter. In this phase, we simulated 1759 distinct combinations of geometric parameters. Our goal was to uniformly distribute the sampled design solutions across the design space to ensure our samples effectively encapsulate the frequency characteristics of the hairpin filter within this design space.  
The quality of the dataset significantly influences the performance of the final neural network model. Thus, we initially cleanse the acquired simulation data by eliminating outliers and duplicate entries. Subsequently, each simulation dataset is shuffled to form pairs of design-frequency-S parameter data, amounting to a total of 118,698 data pairs. Ultimately, the acquired dataset is standardized. We have engineered an artificial neural network model to predict the S parameters of the hairpin filter. The model's input layer comprises eight geometric design parameters of the hairpin filter and simulated frequency values. Four hidden layers are constructed, each containing 128 neurons, with the ReLU function serving as their activation function. Furthermore, the amplitude (expressed in dB) of S11 and S21 of the designed filter at the simulated frequency point functions as the output of the artificial neural network, as depicted in Figure 3.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Design Parameters** & **Lower Bound/\(\mu\)m** & **Upper Bound/\(\mu\)m** & **Step Size/\(\mu\)m** \\ \hline \(W\) & 25 & 30 & 0.1 \\ \(Lt\) & 350 & 380 & 1 \\ \(L_{1}\) & 500 & 600 & 1 \\ \(L_{2}\) & 70 & 100 & 0.1 \\ \(d_{1}\) & 10 & 20 & 0.1 \\ \(d_{2}\) & 10 & 25 & 0.1 \\ \(tw\) & 30 & 60 & 0.1 \\ \(scpwg\) & 6 & 20 & 0.1 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Simulation parameter space for the hairpin filter in HFSS.  
During the training phase, we define the accuracy using the coefficient of determination, \(R^{2}\), as illustrated in Formula (1):  
\[R^{2}=1-\frac{\sum_{i=1}^{m}(f(x_{i})-y_{i})^{2}}{\sum_{i=1}^{m}(f(x_{i})-\bar{y_{ i}})^{2}}, \tag{1}\]  
where \(m\) refers to the total number of items in the current training or testing batch, while \(i\) stands for the index of each item. \(f(x_{i})\) is the neural network's predicted value when the input is \(x_{i}\) and \(y_{i}\) is the actual observed value (i.e., the result of the simulation) for \(x_{i}\). \(\bar{y_{i}}\) represents the average of the actual observed values for the current batch. A larger \(R^{2}\) value indicates that the model is more successful at explaining the observed data.  
The loss, on the other hand, is defined using the mean squared error (MSE), as depicted in Formula (2):  
\[Loss=\frac{1}{m}\sum_{m}^{i=1}(f(x_{i})-y_{i})^{2}, \tag{2}\]  
where \(m\) represents the total number of items in the current training or testing batch, while \(i\) represents the index of each item within the batch. \(x_{i}\) refers to the input of the neural network, which is the geometric dimensions of the hairpin filter. The functions \(f(x_{i})\) and \(y_{i}\) correspond to the predicted value associated with \(x_{i}\) and the actual label value, respectively.