Optimizing Neural Network Scale for ECG Classification
We study scaling convolutional neural networks (CNNs), specifically targeting
Residual neural networks (ResNet), for analyzing electrocardiograms (ECGs).
Although ECG signals are time-series data, CNN-based models have been shown to
outperform other neural networks with different architectures in ECG analysis.
However, most previous studies in ECG analysis have overlooked the importance
of network scaling optimization, which significantly improves performance. We
explored and demonstrated an efficient approach to scale ResNet by examining
the effects of crucial parameters, including layer depth, the number of
channels, and the convolution kernel size. Through extensive experiments, we
found that a shallower network, a larger number of channels, and smaller kernel
sizes result in better performance for ECG classifications. The optimal network
scale might differ depending on the target task, but our findings provide
insight into obtaining more efficient and accurate models with fewer computing
resources or less time. In practice, we demonstrate that a narrower search
space based on our findings leads to higher performance.
Byeong Tak Lee, Yong-Yeon Jo, Joon-Myoung Kwon
# Optimizing Neural Network Scale for ECG Classification

###### Abstract

We study scaling convolutional neural networks (CNNs), specifically targeting Residual neural networks (ResNet), for analyzing electrocardiograms (ECGs). Although ECG signals are time-series data, CNN-based models have been shown to outperform other neural networks with different architectures in ECG analysis. However, most previous studies in ECG analysis have overlooked the importance of network scaling optimization, which significantly improves performance. We explored and demonstrated an efficient approach to scale ResNet by examining the effects of crucial parameters, including layer depth, the number of channels, and the convolution kernel size. Through extensive experiments, we found that a shallower network, a larger number of channels, and smaller kernel sizes result in better performance for ECG classifications. The optimal network scale might differ depending on the target task, but our findings provide insight into obtaining more efficient and accurate models with fewer computing resources or less time. In practice, we demonstrate that a narrower search space based on our findings leads to higher performance.

xxx:1-29, 2023

## 1 Introduction

Electrocardiograms (ECGs) are non-invasive diagnostic tests that record the electrical activity of the heart over time. They are used to detect and analyze various heart-related conditions. Over the years, several machine learning models have been developed for ECG analysis, including recurrent neural networks (RNNs) (Sevilmis et al. (2017)), Transformers (Yan et al. (2020)), and convolutional neural networks (CNNs) (Rajpurkar et al. (2017)). Although ECG signals are considered multivariate time-series data (Figure 1), recent studies predominantly employ CNN-based models instead of RNN-based models (Sun et al. (2023); Vaid et al. (2023)) breaking the convention.

By adopting such models, they have achieved higher performance in ECG classifications (Zheng et al. (2020); Elias et al. (2022); Sun et al. (2023)). Despite their success, most previous studies have overlooked the importance of optimization in scaling networks.
by adjusting its scaling parameters. This process is critical for developing efficient and accurate models (Koutini et al. (2021)). In ECG classification, there is a single previous study evaluating the effect of scaling parameters of neural networks. It solely focuses on one aspect (e.g., the depth of the network) of network architecture (Nonaka and Seita (2021)).

To identify the importance of network scaling across various aspects, we examined the hyperparameters affecting network scale in ECG analysis. Before delving into the significance of scaling parameters, we first searched for widely used neural networks for ECG classifications. As a result, the residual neural network (ResNet) (Tai et al. (2017)) was chosen as a fundamental architecture because it is a typical model (Rajpurkar et al. (2017); Nonaka and Seita (2021); Elias et al. (2022)) used in ECG classifications.

It is widely acknowledged that the depth of network layers, the convolution kernel size, and the number of input/output channels are the primary scaling parameters that influence ResNet's scale and complexity. We conducted experiments to see how varying combinations of such parameters impacted the performance of ECG classification models on the Physionet2021 (Reyna et al. (2021)) and Alibaba (2021) datasets.

Our experiments show that models with a shallower network, a larger number of channels, and smaller convolution kernel sizes improve performance. This finding is significant because the performance changes depending on scaling parameters in ECG classification differ from those observed in image classifications (Zagoruyko and Komodakis (2016)). Furthermore, optimizing network scale can be both time-consuming and require considerable computing resources. However, to attain better performance within a given time, configuring a narrow search space for scaling parameters based on our findings helps models approach the best possible outcome more efficiently. Additionally, we examined the performance variation caused by the optimization with respect to the labels of the dataset and investigated the reasons behind our findings.

#### Generalizable Insights about Machine Learning in the Context of Healthcare

Determining the appropriate network architecture scale is critical for classification tasks. However, there hasn't been extensive research on evaluating network architecture scaling

Figure 1: Example of 12-lead ECG signal.
for analyzing ECGs. In our paper, we present a comprehensive experimental assessment of the performance of different network architecture scaling options for ECG classifications. Our findings reveal that models with a shallower network, a larger number of channels, and a smaller kernel size improve performance in ECG classifications. Interestingly, this finding differs from the existing knowledge in the computer vision domain. We claim that this could be a new guideline for efficiently tuning network scaling parameters in ECG analysis. Furthermore, we show that applying our findings to the hyperparameter optimization process improves the performance of ECG classifications. These results provide insights into practical architecture scaling in neural networks. We hope that these observations will assist clinical and engineering researchers in utilizing deep learning for ECG classification.

## 2 Problem Definition

Although the optimization of network scaling is crucial due to its significant impact on model performance, existing ECG studies have overlooked this aspect (A). Since ResNet (Tai et al. (2017)) is widely used for ECG analysis as a deep learning model (Rajpurkar et al. (2017); Zheng et al. (2020); Nonaka and Seita (2021); Elias et al. (2022); Sun et al. (2023)), we focused on scaling parameters for ResNet. We investigated scaling parameters to optimize a model for ECG classifications. We first present the fundamental architecture of ResNet in detail1.

Footnote 1: We only consider one-dimensional layers, such as one-dimensional convolution, one-dimensional batch normalization, and so on, because ECG is a type of time-series data.

### Fundamental Architecture

Equation 1 shows the architecture of ResNet.

\[y=(\text{FC}\circ\text{GAP}\circ R_{4}\circ R_{3}\circ R_{2}\circ R_{1}\circ S )(x), \tag{1}\]

where \(S\) is a single stem block and (\(R_{n}\)) is a residual block, _GAP_ is a global average pooling layer, and _FC_ is a fully connected layer.

The stem block \(S\) is composed of a single unit function \(F\) with a max pooling layer, as illustrated in Equation 2.1. The function \(F\) consists of a one-dimensional convolution, batch normalization, and ReLU activation function. Given that there are 12 leads in an ECG, the number of input channels for convolution is set at 12 (i.e., \(w\in\mathbb{R}^{kernel\times 12\times C_{out}}\)).

\[F(x,w)=\sigma(\text{BN}(\text{Conv}(x,w))),\quad w\in\mathbb{R}^ {kernel\times C_{in}\times C_{out}}\] \[S=\text{Pool}(F(x,w))), \tag{2}\]

where \(x\) represents the input and \(w\) denotes convolution weights, which are defined by the product of the kernel size (\(kernel\)), the number of input channels (\(C_{in}\)), and the number of output channels (\(C_{out}\)). _Conv_ consists of a single one-dimensional convolution, _BN_ refers to a batch normalization layer, \(\sigma\) is a ReLU activation function, and _Pool_ is a max pooling layer.
The residual block \(R\) consists of multiple residual layer \(L\) as shown in Equation 3

\[R=(L_{d}\circ\cdots\circ L_{1})(x), \tag{3}\]

where \(d\) is the layer depth.

Equation 4 illustrates the structure of \(L\), which is composed of two sequential function \(F\). In the first residual layer \(L\), except for the initial residual block, the first function \(F\) doubles the number of output channels through a convolution _Conv_ compared to the number of input channels. Subsequent \(F\)s maintain an equal number of input and output channels. The input \(x\) is skip-connected with the output after the second batch normalization layer and then passed through the activation function. Prior to the skip-connection, the initial \(L\) in \(R_{n}\) processes \(x\) using _Pool_ and _Conv_, while the remaining layers perform identity mapping.

\[L=\begin{cases}F(F(x,w)),2w)+\text{Pool}(\text{Conv}(x))&\text{if }n>1,d=1\\ F(F(x,2w)),2w)+x&\text{otherwise}\end{cases} \tag{4}\]

where \(w\) is convolution weights, \(n\) is an index of blocks, and \(d\) is an index of layers in a block, respectively.

### Scaling Parameters on Neural Network

There are three hyperparameters that influence the network scale: the depth of layers (_depth_\(D\)), the number of convolution channels (_channels_\(C\)), and the size of the convolution kernel (_kernel size_\(K\)). To examine the impact of these scaling parameters on optimization performance, we first established their search spaces. For the number of layers (layer depth \(D\)), we considered the minimum \(D\) as two, based on ResNet18 (He et al. (2016)), the smallest variation among the ResNet models. We thus set the search space for the depth of residual layers to \(D\in 2,4,8,16\), where each corresponds to a total of 18, 34, 66, and 130 convolution layers, respectively.

For ECG analysis as well as tasks in the computer vision domain, small odd numbers are typically used as the kernel size \(K\). The smallest kernel size is three, so we set the range to \(K\in 3,5,9,15\).

For the number of channels (\(C\)), most neural networks typically set the final number of output channels to 512 (He et al. (2016); Elias et al. (2022)). We were curious about how adjusting the number of channels would affect the performance on ECG classifications. We considered the search space for the final output channels to be 128, 256, 512, and 1024, which corresponds to \(C\in 16,32,64,128\).

Table 1 summarizes the network scale by layer depth \(D\), kernel size \(K\), and the number of channels \(C\). \(length\) denotes the input ECG length. The number of weights increases as the network becomes deeper. The first output has a quarter of the original length due to the striding of the convolution and a pooling layer at the stem block. As the input passes through the residual blocks, the length is halved while the number of channels is doubled. The number of labels depends on the labels of the ECG datasets.
## 3 Experiment

### Dataset

We employed two ECG datasets in our experiment. The first dataset is Physionet Challenge 2021 (Physionet) dataset (Reyna et al. (2021)). This dataset contains standard 12-lead ECGs with cardiac arrhythmia labels. It is composed of seven databases collected from various institutions with unique demographics. In our experiments, we omitted two of the seven databases that had fewer than several hundred samples and focused on five databases: PTB-XL (Wagner et al. (2020)), CPSC (Liu et al. (2018)), Shaoxing (Zheng et al. (2020)), G12EC (Reyna et al. (2021)), and Ningbo (Zheng et al. (2020)). Each database is collected from the United States (G12EC), Germany (PTB-XL), and China (CPSC, Shaoxing, Ningbo), with the signal length varying between 10 and 60 seconds. The total number of ECGs is approximately 88,000, and each ECG is associated with one or more labels among the 26 diagnostic classes, which cover a wide range of categories. The second one is Alibaba Tianchi competition (Alibaba) dataset (Tianchi (2020)). The ECG signals have a duration of 10 seconds each, and the overall collection consists of approximately 20,000. Each ECG is tagged with one or more labels from 33 classes. Since a few class include extremely small number of class (e.g. only three ECGs are labeled as QRS Low Voltage), we limited our study to labels with more than prevalence of 0.1%, and thus used 17 classes for experiments. More details of datasets are provided in Appendix B.

### Evaluation

We use the macro-average F1 score as the evaluation metrics. The F1 score is a harmonic mean of precision and recall. In multi-label classification, each sample belongs to multiple

\begin{table}
\begin{tabular}{c|c|c} \hline \hline  & Output size & Weights \\ \hline Input & \(length\times 12\) & \\ \(S\) & \(length/4\times C\) & \(K\times 12\times C\) \\ \(R_{1}\) & \(length/8\times C\) & \(\left[\begin{array}{ll}\left\{K\times C\times C&\text{if }d=1\\ K\times C\times C&\text{otherwise}\end{array}+K\times C\times C\;\right\}\right]\)\(\times D\) \\ \(R_{2}\) & \(length/16\times 2C\) & \(\left[\begin{array}{ll}\left\{K\times C\times 2C&\text{if }d=1\\ K\times 2C\times 2C&\text{otherwise}\end{array}+K\times 2C\times 2C\;\right\}\right]\)\(\times D\) \\ \(R_{3}\) & \(length/32\times 4C\) & \(\left[\begin{array}{ll}\left\{K\times 2C\times 4C&\text{if }d=1\\ K\times 4C\times 4C&\text{otherwise}\end{array}+K\times 4C\times 4C\;\right\}\right]\)\(\times D\) \\ \(R_{4}\) & \(length/64\times 8C\) & \(\left[\begin{array}{ll}\left\{K\times 4C\times 8C&\text{if }d=1\\ K\times 8C\times 8C&\text{otherwise}\end{array}+K\times 8C\times 8C\;\right\}\right]\)\(\times D\) \\ GAP & \(8C\) & \\ FC & \# of labels & \(8C\times\text{\# of labels}\) \\ \hline \hline \end{tabular}
\end{table}
Table 1: Network scale of the fundamental architecture. \(K\) denotes kernel size, \(C\) does the number of channels, \(d\) does the depth of residual layers, and \(length\) does a input length of ECGs
classes. The macro-average F1 score calculates the F1 score for each class independently and then averages them. This approach treats all classes equally, regardless of class distribution, making it particularly useful for the imbalanced dataset. We divided the dataset into train, validation, and test sets at a ratio of 0.7, 0.15, and 0.15, respectively.

### Training Procedure

As ECGs are gathered with varying lengths and sampling rates, we standardize them. For signal preprocessing, we trimmed the ECG length to 10 seconds. If the length of the ECG is longer than 10 seconds, we randomly cropped it to a 10-second duration; otherwise, we extended the ECG to 10 seconds by padding with zeros. Additionally, we resampled all ECGs to a sampling rate of 250Hz. In addition, for the Alibaba dataset, out of the standard 12 leads of an ECG, this dataset does not contain leads III, aVR, aVL, and aVF. Thus, by applying the principles of Einthoven's Triangle and Goldberger's augmented lead (Mirvis and Goldberger (2001)), we filled in the four missing leads using leads I and II.

Hyperparameter tuning is essential for selecting an appropriate model for a given task. Without hyperparameter tuning, the performance and generalizability of a model may be suboptimal, leading to unreliable conclusions (Bergstra and Bengio (2012)). However, computational limitations have prevented previous studies from exploring a wide range of hyperparameters (Strodthoff et al. (2020)). For example, one of the previous studies on ECG classification benchmark only searched 9 sets of learning rate and batch size (Nonaka and Seita (2021)), and the majority of studies do not present the precise procedure of the hyperparameter optimization.

In this study, we explored 50 combinations of hyperparameters for each set of scaling parameters, thereby resolving a limitation of previous studies. Tuned hyperparameters consist of learning rate, weight decay, dropout, and other regularization techniques. The search space used in the experiment is presented in Table 2. In training, we employed the Adam optimizer (Kingma and Ba (2014)) and a one-cycle learning rate scheduler (Smith and Topin (2019)) that peaks at epoch 10. The batch size was fixed at 512. We randomly sampled the learning rate \(\in[10^{-4},10^{-2}]\) and weight decay \(\in[10^{-6},10^{-4}]\) for the optimizer. The dropout rate was randomly chosen from 0 to 0.3 in increments of 0.05. We applied 18 ECG data augmentation methods (Lee et al. (2022)) using the RandAugment policy (Cubuk et al. (2020)). The number of augmentation methods was randomly selected from \(0,1,2\), and their intensity was chosen from 10 levels. Furthermore, we employed Mixup (Zhang et al. (2017)), randomly selecting a beta distribution from \(\beta\in\{0.0,0.1,0.2\}\). During hyperparameter searching, we used the asynchronous successive halving algorithm (ASHA) with a grace period of 10 and a reduction factor of 2 (Li et al. (2018)). Our training procedure is implemented with Ray (Moritz et al. (2018)).

## 4 Result

### Impact of Optimization for Scaling Parameter on ECG classification

Figure 2 shows the F1 score of the ECG classification for ResNet with different layer depths (\(D\)), numbers of channels (\(C\)), and kernel sizes (\(K\)). The selected hyperparameters for each
network are provided in Appendix C. In the box color, the more red it is, the higher the performance, while the more blue it is, the lower the performance.

**Layer depth** (**D**): We observed a general trend in which the performance tends to improve as the depth \(D\) decreases from both Physionet 2021 and Alibaba datasets. The trend is found regardless of kernel size \(K\) and channel \(C\). This findings clearly exhibit a distinct different pattern compared to computer vision domain, where it is known that performance increases as networks become deeper. On the other hand, it is also important to note that a shallower layer depth is not always advantageous. Depending on the combinations of kernel size \(K\) and the number of channels \(C\), the optimal setting of layer depth can be different.

**Number of channels** (**C**): We found a positive correlation between the number of channels \(C\) and performance in both Physionet 2021 and Alibaba datasets. In the majority of cases, as we varied kernel size \(K\) and layer depth \(D\), the performance improved when the number of channels \(C\) increased. In fact, for both Physionet and Alibaba datasets, all the best performances were observed in models with the largest number of channels irrespective to combinations of kernel size \(K\) and layer depth \(D\). This result is consistent with the established knowledge in the computer vision domain, indicating that wider networks are particularly well-suited for ECG classification tasks.

**Kernel size** (**K**): The panels on the left side of Figure 2 show a more reddish hue than those on the right side in both Physionet 2021 and Alibaba datasets. This indicates that performance tends to decrease as the kernel size \(K\) increases. Although recent studies in the computer vision domain have reported a positive impact of larger kernels on model performance [Ding et al. (2022)], our experiments for ECG classification show a contrasting trend, with larger kernels leading to reduced performance.

In Physionet 2021 dataset, the best combination for ECG classification performance is a layer depth \(D\) of 4, a number of channels \(C\) of 128, and a kernel size \(K\) of 3. In contrast, a combination with a layer depth \(D\) of 8, a number of channels \(C\) of 16, and a kernel size \(K\) of 15 results in the worst performance. Although the size of dataset and label distribution in Alibaba differ from those of Physionet, the best and worst combination in Alibaba dataset were remarkably similar to that of Physionet 2021 one. The optimal configuration for Alibaba dataset and Physionet 2021 are identical. The worst performance model is generated when a layer depth \(D\) of 4, a number of channels \(C\) of 16, and a kernel size \(K\) of 15. Overall, our findings provide the following scaling parameter setting guide

\begin{table}
\begin{tabular}{l|l} \hline \hline Hyperparameter & Search Space \\ \hline Learning rate & \([10^{-4},10^{-2}]\) \\ Weight decay & \([10^{-6},10^{-4}]\) \\ Dropout rate & \{0, 0.05, 0.1, 0.15, 0.2, 0.25, 0.3\} \\ Number of augmentation & \{0, 1, 2\} \\ Magnitude of augmentation & \{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10\} \\ Beta distribution of Mixup & \{0, 0.1, 0.2\} \\ \hline \hline \end{tabular}
\end{table}
Table 2: Hyperparameter Search Space
to improve performance in ECG classification tasks, regardless of datasets: a shallower network, a larger number of channels, and a smaller kernel size.

### Infusing our insight into hyperparameter optimization

In practice, hyperparameter optimization is essential for achieving satisfactory performance in a given task (Jaderberg et al. (2017)). The efficiency of hyperparameter optimization is heavily influenced by the predefined search space. A vast search space might not guarantee the best performance and could lead to increased time and resource consumption. Thus, it is essential to establish a well-designed range for the search space, which ensures efficient hyperparameter optimization and ultimately results in improved model performance.

Incorporating insights from our experiments can help researchers increase their chances of achieving optimal performance. To demonstrate this, we conducted additional experiments, modifying the range of scaling hyperparameters, specifically layer depth \(D\), the number of channels \(C\), and kernel size \(K\). Table 3 shows the best performance depending on the size of search spaces, defining three distinct ranges: Large, Medium, and Optimal. The _Large_ range represents a wide hyperparameter search space, while the _Medium_ range is half of the _Large_ range, reflecting our findings of a shallower network, smaller kernel size,

Figure 2: The performance of residual networks with different layer depth (\(D\)), number of channels (\(C\)), and kernel size (\(K\)) for the ECG classification. The first row is the result of Physionet 2021 challenge dataset (Reyna et al. (2021)) and the second row is the result from Alibaba Tianchi competition dataset (Tianchi (2020)). The scores in boxes are the average of F-1 scores on the multi-label classification. The more red, the higher performance, while the more blue, the lower performance.
and larger number of channels. The _Optimal_ range includes settings that yield the best performance, as shown in Section 4. All other hyperparameters are configured as mentioned in Section 3.3.

For the experiments, we first sampled 50 combinations in a search space. Then, we selected the best model by training and evaluating them. As a result, for both Physionet 2021 and Alibaba datasets, the performance improvement are observed by reducing the space to 1/8 (_Medium_) and 1/64 (_Optimal_) compared with _Large_, respectively. Larger search spaces make it more challenging to find the optimal hyperparameters within the given combinations, potentially leading to suboptimal model performance. These results demonstrate that models acquired through more precise hyperparameters outperform those obtained using a wider search space.

## 5 Discussion

### Sub-group Analysis

As described in Table A.2 and Table A.3, both Physionet 2021 and Alibaba datasets present highly imbalances in their distribution. To determine if our experimental findings remain consistent across the study population, we conducted a sub-group analysis. The Physionet 2021 dataset is composted of various classes and databases, where each of them has its own distict distribution. For example, the ratio between the NSR and Brady classes is approximately 100:1, and 65% of NSR labels are from the Ningbo database, while 67% of SB labels are from the G12EC database. Additionally, the distribution of labels across the database sources is uneven, with no database containing all 26 classes, and some databases contain fewer classes than others. Similartly, the Alibaba dataset also exhibits substantial imbalances. Althought it is collected from a single source, the skewness of class distribution is comparable to the multi-sourced Physionet 2021 dataset. For example, the prevalence of NSR approaches nearly 50%, while the prevalence of NSTAb is only 0.03%.

\begin{table}
\begin{tabular}{c|c c c|c|c} \hline \hline Physionet & Depth (\(D\)) & Channel (\(C\)) & Kernel (\(K\)) & \# Avail. comb. & F1 \\ \hline Large & \{2,4,6,8\} & \{16,32,64,128\} & \{3,5,9,16\} & 64 & 0.612 \\ Medium & \{2,4\} & \{64,128\} & \{3,5\} & 8 & 0.644 \\ Optimal & \{4\} & \{128\} & \{3\} & 1 & 0.669 \\ \hline \hline Alibaba & Depth (\(D\)) & Channel (\(C\)) & Kernel (\(K\)) & \# Avail. comb. & F1 \\ \hline Large & \{2,4,6,8\} & \{16,32,64,128\} & \{3,5,9,16\} & 64 & 0.000 \\ Medium & \{2,4\} & \{64,128\} & \{3,5\} & 8 & 0.000 \\ Optimal & \{4\} & \{128\} & \{3\} & 1 & 0.000 \\ \hline \hline \end{tabular}
\end{table}
Table 3: Performance depending on the search space of hyperparameter optimization. _# Avail. comb._ denotes the number of available combinations. _F1_ represents the best F1 score in the sampled 50 combinations. The selected hyperparameters for each experiment are provided in Appendix D.
#### 5.1.1 Performance Depending on Labels

Figure 3 and Figure 4 demonstrate the performance of the model across label categories in Physionet 2021 and Alibaba datasets. In the case of Physionet 2021 dataset, the performance changes in each category are similar to the performance changes in entire classes. The optimal combination (\(D4\)-\(C128\)-\(K3\)) derived from the experiment in Section 4 may not belong to the best performance, but it remains among the top-performing models across all categories. This consistency suggests that the proposed scaling method is effective across all categories.

However, in the Alibaba dataset, while the overall trend of performance regarding to depth, width, and kernel size remains consistent across all categories, the degree of similarity is substantially lower than in the Physionet 2021 dataset. Specifically, there are numerous outliers that contradict the general trend, such as \(C4\), \(D2\), \(K5\) and \(C64\), \(D4\), \(K9\). One possible explanation for this could be attributed to the number of labels. Unlike the Physionet 2021 dataset, the prevalence of labels within the Alibaba dataset is relatively low; only three out of the seventeen classes exhibit a prevalence of 10% or higher. This significant class imbalance could potentially lead to unstable results. Appendix B provides a more comprehensive analysis of the model performance on specific labels. All performances depending on each label among all available combinations are described in detail in Appendix E.

#### 5.1.2 Performance Depending on Database Sources

Figure 5 shows the model performance according to the database sources in Physionet 2021 dataset. It appears that results in the Ningbo, PTBXL, G12EC, and Shaoxing databases are consistent with the entire dataset. On the other hand, we observe the different performance trend in CPSC database. One possible reason is that the CPSC database has some rare labels such as NSIVCB, PR, SA, Brady, TAb, and TInv, where a small number of samples for these classes can significantly impact the F1 scores since we used the macro-averaged F1 score as a metric.

### Correlation between Scaling Parameters and Performance

Previous research in the computer vision domain has shown that there is a positive correlation between model performance and all scaling parameters (Peng et al. (2017); Tan and Le (2019); Ding et al. (2022)). Specifically, deeper residual layers, larger kernel sizes, and many channels can contribute to better performance.

However, our findings from ECG analysis provide a different result on the correlation between model performance and scaling parameters compared to the computer vision domain. Table 4 shows the correlation between neural networks with different scales and their performance in both ECG analysis and computer vision. Contrary to the expectations, we observed a negative correlation between performance and both layer depth \(D\) and kernel size \(K\). Only the number of channels \(C\) showed a positive correlation with performance, consistent with the observatoins in the computer vision.

We conjecture that observed discrepancy is attributed to the periodic nature of ECG signals and their effect on the receptive field and global average pooling(GAP). As illustrated in Figure 1, the patterns in each ECG cycle show consistent and repeat over the time.
Figure 3: Classification performance of networks with different layer depth (\(D\)), the number of channels (\(C\)), and kernel size (\(K\)) on six label categories in Physionet2021 dataset.
Figure 4: Classification performance of networks with different layer depth (\(D\)), the number of channels (\(C\)), and kernel size (\(K\)) on six label categories in Alibaba dataset.
Figure 5: Classification performance of networks with different layer depth (\(D\)), the number of channels (\(C\)), and kernel size (\(K\)) depending on database sources.
Because of this periodicity, a receptive field that spans only a few second of ECG (i.e. one or two cycle of ECG) is sufficient for extracting the essential information from the signal. Thus, in contrast to computer vision, where the large receptive field is preferred for capturing global feature, the advantage of large receptive field is relatively insignificant in ECG classification. Further, the GAP following small receptive field functions as an ensemble of different view of signal, providing generalized and robust representation. On the other hand, a large receptive field that covers the entire signal does not benefit as much from GAP as a small receptive field. (See Appendix F for further discussion).

To investigate whether the influence of periodicity persists when it is removed, we cropped ECG signals into 2-second and 1-second segments to eliminate the effect of varying heart rates in Physionet 2021 dataset. This resulted in approximately two cycles present in a 2-second signal and one cycle in a 1-second signal, respectively. The correlation between network scaling and performance for the cropped signals is shown in the 2s and 1s at ECG columns in Table 4, respectively. Specifically, we found that the depth of layers led to a near-complete loss of correlation, while the kernel size was less affected. In contrast, the correlation remained high for the number of channels. While our experimental results cannot fully explain our conjecture, they support the idea that the periodicity of ECG signals has some influence on network scaling decisions.

## 6 Conclusion

In recent studies, CNN-based models, particularly ResNet, have been widely used to achieve higher performance in ECG classifications. However, the optimization of network scaling, which is a vital process for creating efficient and precise models, has often been overlooked. To address this, we examined the effects of different combinations of primary scaling parameters, such as network depth, convolution kernel size, and the number of channels, on the Physionet2021 dataset and Alibaba dataset.

Our results show that performance enhancement can be achieved by employing models with shallower networks, a greater number of channels, and smaller convolution kernel sizes. This finding is crucial because optimizing network scaling can be both time-consuming and computationally demanding. By refining the search space for scaling parameters based on our results, researchers can more effectively reach optimal outcomes within a given time.

Moreover, we investigated the performance variations by network scaling in relation to the dataset's labels and inferred the rationale behind our findings. This research provides

\begin{table}
\begin{tabular}{c|c|c c c} \hline \hline  & Computer & \multicolumn{3}{c}{ECG} \\  & Vision & 10s & 2s & 1s \\ \hline Layer depth (D) & Positive (+) & -0.83 & -0.62 & -0.2 \\ Kernel size (K) & Positive (+) & -0.92 & -0.84 & -0.68 \\ Number of channels (C) & Positive (+) & 0.93 & 0.92 & 0.87 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Correlation between the neural network’s scaling parameters and its performance based on ECG length.
a better understanding of network scaling optimization in ECG analysis and empowers researchers to develop more efficient and effective models for ECG classification.