# COMPARISON OF CROSS-ENTROPY, DICE, AND FOCAL LOSS FOR SEA ICE TYPE
SEGMENTATION

Up-to-date sea ice charts are crucial for safer navigation in ice-infested
waters. Recently, Convolutional Neural Network (CNN) models show the potential
to accelerate the generation of ice maps for large regions. However, results
from CNN models still need to undergo scrutiny as higher metrics performance
not always translate to adequate outputs. Sea ice type classes are imbalanced,
requiring special treatment during training. We evaluate how three different
loss functions, some developed for imbalanced class problems, affect the
performance of CNN models trained to predict the dominant ice type in
Sentinel-1 images. Despite the fact that Dice and Focal loss produce higher
metrics, results from cross-entropy seem generally more physically consistent.

Index Terms—  Convolutional Neural Networks, loss function, sea ice, semantic
segmentation, Synthetic Aperture Radar (SAR)

##  1 Introduction

The recent reduction in sea ice volume has led to increased potential for
shipping in the Arctic (e.g., [1, 2]), which requires improved marine
information services to ensure both safe transit and minimal environmental
impact. Several national ice centers periodically produce sea ice charts, used
by navigators to find the best and safest shipping routes. The generation of
ice charts continues heavily dependent on sea ice experts that manually
interpret remotely sensed data in conjunction with other information to create
maps that indicate ocean conditions. Machine learning was identified as a
methodology with significant potential for accelerating the generation of sea
ice charts. Convolutional Neural Networks (CNNs), in particular, showed
promising results for sea ice characterization using remotely sensed data as
input, in both image classification and semantic segmentation frameworks. In
classification, subsampled patches of remotely sensed images are labeled as
water or other sea ice attribute, and then patches are mosaiced into a
classified scene (e.g., [3, 4]). Most studies approaching sea ice mapping as a
semantic segmentation task have used U-Net [5] variations. Ren et al. [6]
added attention components into U-Net that further captured the spatial
correlation of features in individual feature maps and the interrelation of
pixel values between different feature maps. Adding attention components
improved accuracy when compared to the original architecture for a binary
segmentation of open water and sea ice. Wang and Li [7] combined five U-Nets
outputs to perform a binary segmentation of Sentinel-1 scenes into open water
and sea ice. Stokholm et al. [8] explored expanding the number of
convolutional blocks in a U-Net architecture to perform semantic segmentation
of Sentinel-1 images to segment sea ice concentration. In [3, 4, 6, 7, 8], the
models were trained using categorical or binary cross-entropy (CE) loss. Wang
and Li [7] combined binary CE and Dice loss [9] to train their models. Despite
these improvements, automated ice type classification remains unreliable for
operational purposes, which can be attributed to multiple potential reasons,
including the subjectivity of sea ice expert interpretation (labels) or loss
functions used to train models. Sea ice type is generally an imblanaced
problem, and adopting different losses has the potential to improve the
performance of the models without requiring significant changes in model
development and training. Recently, Kucic and Stokholm [10] evaluated the
effect of different losses for sea ice concentration mapping. Here, we use a
semantic segmentation framework and rely on the ExtremeEarth V2 dataset [11]
to perform a set of experiments and evaluate what is the effect in performance
when we train the models using different loss functions for ice type mapping.

Fig. 1: Example of model predictions with highest scores for January. a) Input
to the models, a Sentinel-1 image. b) Rasterized ExtremeEarth V2 labels. c),
d), and e) share the same legend as b) and show predictions with highest
weighted F1 for models trained with CE, Dice, and Focal loss, respectively.
f), g), and h) share the same legend and show errors of losses compared to the
labels in b). Although there is a larger mismatch between Dice results and
ExtremeEarth V2 labels, the First Year Ice shows fewer blobs of other ice
types in comparison to CE and Focal loss results.

##  2 Model architecture and training strategy

We approach sea ice type charting as a semantic segmentation task. To do so,
we design a model architecture that uses the first three blocks of ResNet18
[12] as encoder, and a decoder based on the Atrous Spatial Pyramid Pooling
(ASPP) module [13]. The encoder and decoder sum 4 M trainable parameters. We
initialize the encoder with ImageNet [14] weights that are updated in
training, while the decoder is randomly initialized. Our model takes as input
Horizontal-Horizontal (HH), Horizontal-Vertical (HV), and incidence angle from
Sentinel-1 images, and outputs ice type. We train the models using a batch
size of 24, Adam optimizer [15] with a learning rate starting at 1e-5. The
learning rate is multiplied by 0.1 if the validation loss does not decrease in
five epochs, to a minimum of 1e-8 and training stops if the validation loss
does not decrease in 20 epochs. The weights with smallest validation loss are
used for testing. These hyperparameters are kept the same, and we train models
using three different loss functions with their default parameters: CE, Dice
[9], and Focal [16]. We repeat each experiment three times to account for
stochastic variation.

##  3 Dataset pre-processing

The ExtremeEarth V2 dataset [11] is a collection of labels in the form of
high-resolution ice charts for twelve Sentinel-1 images in Extra Wide (EW)
mode acquired over the East Coast of Greenland. The twelve images are roughly
one month apart, one for each month of 2018, and show several types of sea ice
under different weather conditions. ExtremeEarth V2 labels are polygons
representing sea ice or open water with different characteristics. Each
polygon contains attributes characterizing oldest sea ice, second oldest sea
ice, as well as their respective concentrations. We derive the “dominant ice
type” by computing the sea ice with the highest concentration in a polygon and
use that as the target for our CNN models. We separate two scenes, January and
July for testing. We clip half of February, June, August, and December for
validation. Test and validation outputs are generated on a single pass for
full images. To generate training samples, we extract 100 randomly placed
patches of size 80 km2, which correspond to 1000 x 1000 pixels of Sentinel-1
images that were resampled to 80 x 80 m pixel size.

##  4 Results and Discussion

Fig. 2: Example of model predictions with highest scores for July. a) Input to
the models, a Sentinel-1 image. b) Rasterized ExtremeEarth V2 labels. c), d),
and e) share the same legend as b) and show predictions with highest weighted
F1 for models trained with CE, Dice, and Focal loss, respectively. f), g), and
h) share the same legend and show errors of losses compared to the labels in
b).

Results show similar performance metrics for all losses investigated, with a
marginal improvement for Focal loss. The average test weighted F1 score
(average across January and July for all three experiments) for CE is 0.815
(minimum of 0.805, maximum of 0.825). Dice results are 0.810 (0.80, 0.82), and
Focal results are 0.822 (0.81, 0.83). Although Dice and Focal loss were
developed for imbalanced datasets, our results show comparable performance for
the more common CE loss for the ExtremeEarth V2 dataset. This potentially
hints at other reasons that might have contributed to a relatively low
performance in ice type classification, including lack of sufficient training
samples, subjective labels at the polygon level as interpreted by the sea ice
analyst, and ambiguity of SAR backscatter over different types. However,
evaluating the results solely based on metrics performance can be problematic.
Fig. 1 shows the results for the models with the highest weighted F1 for
January. The model trained with Dice loss misses all old ice and classifies
those regions as first-year ice. Due to the difference in thickness,
incorrectly identifying old ice as first-year ice can have serious
consequences for shipping and other marine operations. Of the three proposed
methods, CE results appear to best capture the old ice areas. All models
struggle to correctly identify the ice edge, which is attributed to a
combination of the model’s architecture resolution and the fact that the new
ice at the edge appears darker in the SAR image. Fig. 2 shows results for the
models with the highest weighted F1 for July, during Summer when ice is
generally melting and there is no ice growth. All models miss the old ice
regions that are classified either as young or first-year ice. The weighted F1
for the model trained with Dice is the highest, however, the model predicts
relatively large new ice regions when compared to CE or Focal, an undesirable
outcome.

##  5 Conclusions

We evaluated how different loss functions affect the semantic segmentation of
CNN models trained to classify the dominant ice type of ExtremeEarth V2
labels. Although Dice and Focal loss sometimes show better performance
metrics, visual inspection indicates that predictions from models trained with
CE loss are generally more physically reasonable. Further research for proper
classification of minority classes might help in the loss function choice.

##  6 Acknowledgments

This material is based upon work supported by the National Science Foundation
under Grant No. 2026962. We thank the Extreme Earth project and MET Norway for
making the ExtremeEarth dataset available to the sea ice community. The code
used for this research is available at https://github.com/geohai/sea-ice-
segment.

## References

  * [1] N. Melia, K. Haines, and E. Hawkins, “Sea ice decline and 21st century trans-Arctic shipping routes,” _Geophysical Research Letters_ , vol. 43, no. 18, pp. 9720–9728, 2016.
  * [2] L. Pizzolato, S. E. L. Howell, J. Dawson, F. Laliberté, and L. Copland, “The influence of declining sea ice on shipping activity in the Canadian Arctic,” _Geophysical Research Letters_ , vol. 43, no. 23, pp. 12,146–12,154, 2016.
  * [3] H. Boulze, A. Korosov, and J. Brajard, “Classification of Sea Ice Types in Sentinel-1 SAR Data Using Convolutional Neural Networks,” _Remote Sensing_ , vol. 12, no. 13, p. 2165, Jan. 2020, number: 13 Publisher: Multidisciplinary Digital Publishing Institute.
  * [4] S. Khaleghian, H. Ullah, T. Kræmer, N. Hughes, T. Eltoft, and A. Marinoni, “Sea Ice Classification of SAR Imagery Based on Convolution Neural Networks,” _Remote Sensing_ , vol. 13, no. 9, p. 1734, Jan. 2021, number: 9 Publisher: Multidisciplinary Digital Publishing Institute.
  * [5] O. Ronneberger, P. Fischer, and T. Brox, “U-Net: Convolutional Networks for Biomedical Image Segmentation,” in _Medical Image Computing and Computer-Assisted Intervention – MICCAI 2015_ , N. Navab, J. Hornegger, W. M. Wells, and A. F. Frangi, Eds. Cham: Springer International Publishing, 2015, pp. 234–241.
  * [6] Y. Ren, X. Li, X. Yang, and H. Xu, “Development of a Dual-Attention U-Net Model for Sea Ice and Open Water Classification on SAR Images,” _IEEE Geoscience and Remote Sensing Letters_ , vol. 19, pp. 1–5, 2021, conference Name: IEEE Geoscience and Remote Sensing Letters.
  * [7] Y.-R. Wang and X.-M. Li, “Arctic sea ice cover data from spaceborne synthetic aperture radar by deep learning,” _Earth System Science Data_ , vol. 13, no. 6, pp. 2723–2742, Jun. 2021, publisher: Copernicus GmbH.
  * [8] A. Stokholm, T. Wulf, A. Kucik, R. Saldo, J. Buus-Hinkler, and S. M. Hvidegaard, “AI4SeaIce: Toward Solving Ambiguous SAR Textures in Convolutional Neural Networks for Automatic Sea Ice Concentration Charting,” _IEEE Transactions on Geoscience and Remote Sensing_ , vol. 60, pp. 1–13, 2022.
  * [9] C. H. Sudre, W. Li, T. Vercauteren, S. Ourselin, and M. Jorge Cardoso, “Generalised Dice Overlap as a Deep Learning Loss Function for Highly Unbalanced Segmentations,” in _Deep Learning in Medical Image Analysis and Multimodal Learning for Clinical Decision Support_ , ser. Lecture Notes in Computer Science, M. J. Cardoso, T. Arbel, G. Carneiro, T. Syeda-Mahmood, J. M. R. Tavares, M. Moradi, A. Bradley, H. Greenspan, J. P. Papa, A. Madabhushi, J. C. Nascimento, J. S. Cardoso, V. Belagiannis, and Z. Lu, Eds. Cham: Springer International Publishing, 2017, pp. 240–248.
  * [10] A. Kucik and A. Stokholm, “AI4seaice: selecting loss functions for automated SAR sea ice concentration charting,” _Scientific Reports_ , vol. 13, no. 1, Apr. 2023. [Online]. Available: https://doi.org/10.1038/s41598-023-32467-x
  * [11] N. Hughes and F. Amdal, “ExtremeEarth Polar Use Case Training Data,” 2021, publisher: Zenodo Version Number: 1.0.0. [Online]. Available: https://doi.org/10.5281/zenodo.4683174
  * [12] K. He, X. Zhang, S. Ren, and J. Sun, “Deep Residual Learning for Image Recognition,” in _2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR)_. IEEE, Jun. 2016, pp. 770–778. [Online]. Available: http://ieeexplore.ieee.org/document/7780459/
  * [13] L.-C. Chen, G. Papandreou, F. Schroff, and H. Adam, “Rethinking Atrous Convolution for Semantic Image Segmentation,” _arXiv e-prints_ , p. arXiv:1706.05587, Jun. 2017, _eprint: 1706.05587.
  * [14] O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, A. C. Berg, and L. Fei-Fei, “ImageNet Large Scale Visual Recognition Challenge,” _International Journal of Computer Vision_ , vol. 115, no. 3, pp. 211–252, Dec. 2015, publisher: Springer US.
  * [15] D. P. Kingma and J. Ba, “Adam: A Method for Stochastic Optimization,” in _ICLR_. San Diego, CA, USA: ICLR, Dec. 2014, p. arXiv:1412.6980.
  * [16] T.-Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollár, “Focal Loss for Dense Object Detection,” in _2017 IEEE International Conference on Computer Vision (ICCV)_ , Venice, Italy, Oct. 2017, pp. 2999–3007, iSSN: 2380-7504.


# Step-like dependence of memory function on pulse width in spintronics
reservoir computing

Terufumi Yamaguchi1, Nozomi Akashi2, Kohei Nakajima2, Hitoshi Kubota1, Sumito
Tsunegi1, and Tomohiro Taniguchi1 1National Institute of Advanced Industrial
Science and Technology (AIST), Spintronics Research Center, Tsukuba, Ibaraki
305-8568, Japan,
2Graduate School of Information Science and Technology, The University of
Tokyo, Bunkyo-ku, 113-8656 Tokyo, Japan

###### Abstract

Physical reservoir computing is a type of recurrent neural network that
applies the dynamical response from physical systems to information
processing. However, the relation between computation performance and physical
parameters/phenomena still remains unclear. This study reports our progress
regarding the role of current-dependent magnetic damping in the computational
performance of reservoir computing. The current-dependent relaxation dynamics
of a magnetic vortex core results in an asymmetric memory function with
respect to binary inputs. A fast relaxation caused by a large input leads to a
fast fading of the input memory, whereas a slow relaxation by a small input
enables the reservoir to keep the input memory for a relatively long time. As
a result, a step-like dependence is found for the short-term memory and
parity-check capacities on the pulse width of input data, where the capacities
remain at 1.5 for a certain range of the pulse width, and drop to 1.0 for a
long pulse-width limit. Both analytical and numerical analyses clarify that
the step-like behavior can be attributed to the current-dependent relaxation
time of the vortex core to a limit-cycle state.

A recurrent neural network (RNN) is categorised as a class of artificial
neural networks having recurrent interactions between a large number of
neurons [1]. The RNN can memorise data inputted into the system through
recurrent interactions. The dynamical response from the network therefore
reflects a time sequence of the input data. In this respect, RNNs have
attracted much attention not only in fundamental sciences but also applied
sciences such as information processing of time-dependent data, for example,
human voices and robotic motions. Physical reservoir computing is a model of
RNNs where many-body systems, called reservoirs, are used as the networks [2,
3, 4, 5, 6, 7, 8, 9], enabling it to bridge the gap between neural science,
information science, biology, and physics. Physical reservoir computing have
been performed in several kinds of physical systems, such as optical lasers,
soft materials and quantum reservoirs [10, 11, 12, 13, 14].

Recent studies have discovered that a fine-structured ferromagnet can also be
applied to physical reservoir computing [15, 16, 17, 18, 19, 20, 21, 22, 23,
24]. By applying an electric current to a magnetic multilayer in nanoscale,
spin transfer [25, 26] from conducting electrons to a local magnetisation
induces nonlinear magnetisation dynamics such as magnetisation switching and
limit-cycle oscillation [27, 28, 29, 30]. Such a dynamical response from the
ferromagnet is divided into several nodes, with each node regarded as a
virtual neuron. The method to construct a virtual many-body system, in this
case, a reservoir, is called a time-multiplexing method [12, 15, 17]. The high
performance of a voice recognition using a vortex-type spin-torque oscillator
[15] has evidently proven that spintronic systems are effective for physical
reservoir computing. While such exciting works for practical applications have
been reported, the fundamental properties of physical reservoir computing have
yet to be fully clarified. For example, the role of the physical parameters,
such as the current magnitude and magnetic damping constant, on the
performance of physical reservoir computing remains unclear. Further
development of physical reservoir computing, or a wide range of brain-inspired
computing in general, relies crucially on the clarification of the relation
between the physical parameters and computation performances.

In this work, a theoretical study is carried out for physical reservoir
computing using a vortex-type ferromagnet. The short-term memory (STM) and
parity-check (PC) capacities are evaluated as a function of the pulse width of
input data given by current pulses. The capacities show a step-like dependence
on the pulse width, where the capacities’ values remain at $1.5$ for a certain
range of the pulse width, and drop to $1.0$ for a long pulse-width limit,
where the range of the pulse width depends on the material parameters and
input-current strength. It is clarified that the step-like behaviour
originates from the current-dependent relaxation time of the vortex core.

## Model

Figure 1:  (a) Schematic diagram of the magnetic multilayer consisting of a
vortex-type free layer and a uniformly-magnetised reference layer. (b) Time
evolution of the normalised centre position of the vortex core in the presence
of a direct current. The inset shows a limit-cycle oscillation of the vortex
core in a steady state.

Figure 1(a) schematically shows a magnetic trilayer consisting of a vortex-
type free layer and a uniformly-magnetised reference layer separated by a thin
nonmagnetic spacer. The $z$ axis is normal to the film-plane. The unit vector
pointing in the magnetisation direction of the reference layer is denoted as
$\mathbf{p}=(p_{x},0,p_{z})$ ($|\mathbf{p}|=1$), where the $x$ axis is chosen
to be parallel to the projection of $\mathbf{p}$ to the $xy$ plane. The
dynamics of the magnetic vortex core are known to be well described by the
Thiele equation [31, 32, 33, 34, 35, 36]. By applying an electric current
density $J$, the spin-transfer torque [25, 26] induces the dynamics of the
vortex core described by the Thiele equation for the core position
$\mathbf{X}=(X,Y,0)$ [31, 32, 33, 34, 35, 36],

$\begin{split}&-G\hat{\mathbf{z}}\times\dot{\mathbf{X}}-|\mathscr{D}|\left(1+\xi
s^{2}\right)\dot{\mathbf{X}}-\frac{\partial
W}{\partial\mathbf{X}}+a_{J}Jp_{z}\hat{\mathbf{z}}\times\mathbf{X}+ca_{J}JR_{0}p_{x}\hat{\mathbf{x}}=\bm{0},\end{split}$
(1)

where $G=2\pi pcML/\gamma$ and $\mathscr{D}=-(2\pi\alpha
ML/\gamma)[1-(1/2)\log(R_{0}/R)]$ consist of the saturation magnetisation $M$,
the gyromagnetic ratio $\gamma$, the Gilbert damping constant $\alpha$, the
thickness $L$, the disc radius $R$ and the core radius $R_{0}$ of the free
layer. The polarity $p$ and the chirality $c$ are assumed to be $+1$ for
convenience. The normalised centre position of the vortex core is
$s=|\mathbf{X}|/R$. The nonlinear parameter of the damping torque is denoted
as $\xi$. The magnetic potential is

$W=\frac{\kappa}{2}|\mathbf{X}|^{2}+\frac{\kappa^{\prime}}{4R^{2}}|\mathbf{X}|^{4},$
(2)

where $\kappa=(10/9)4\pi M^{2}L/R$ and $\zeta=\kappa^{\prime}/\kappa\simeq
1/4$ [32, 36]. The spin-transfer torque strength with the spin polarisation
$P$ is $a_{J}=\pi\hbar P/(2e)$. A positive current corresponds to the current
flowing from the reference layer to the free layer. The values of the
parameters are estimated from experiments and simulations [36, 37, 38, 39] as
$M=1500$ emu/cm3, $\gamma=1.764\times 10^{7}$ rad/(Oe s), $\alpha=0.005$,
$L=4$ nm, $R=150$ nm, $R_{0}=10$ nm, $\xi=1/4$, and $P=0.3$.

The vortex dynamics are described by two dynamical variables, which are
$(X,Y)$ in a Cartesian coordinate or the normalised distance
$s=|\mathbf{X}|/R$ of the core centre from the disc centre and the phase of
the core position in the $xy$ plane. In previous experiments on reservoir
computing in Refs. [15, 17], however, only $s$ is used for the computing.
Therefore, we are also inclined to focus on the dynamics of $s$ in the
following discussion. Simultaneously, we note that recent works have focused
on reservoir computing using the phase of the vortex oscillation [21, 22].

Figure 1(b) shows the time evolution of the vortex core position $s$ in the
presence of a direct current of $I=\pi R^{2}J_{\rm dc}=4.0$ mA. The vortex
core position $s$ is saturated after a time on the order of $1$ $\mu$s, and a
limit-cycle oscillation of the vortex core around the disc centre is excited,
as shown in the inset. The relaxation phenomenon plays a key role on the
memory function of reservoir computing, as discussed below. We also note that
the core position in the limit-cycle state is not constant because the spin-
transfer torque originating from the in-plane component of the magnetisation
$\mathbf{p}$ breaks the rotational symmetry of the vortex core around the $z$
axis. As a result, the distance $s$ of the vortex core from the disc centre
for the circular motion is not constant, as shown in Fig. 1(b). We note that a
small-amplitude oscillation disappears when $p_{x}$ in Eq. (1) is zero. In the
experiments of Refs. [15, 17, 21, 22], however, $p_{x}$ remains finite because
the output signal from the oscillator, generated through the tunnel
magnetoresistance effect, is determined by the number of magnetic moments
having the projection to the $\mathbf{p}$ direction. On the other hand, the
critical current density to excite the vortex motion is determined by $p_{z}$,
as shown below. Therefore, we keep both terms proportional to $p_{x}$ and
$p_{z}$ in Eq. (1) finite. In the experiments, we apply a small external
magnetic field pointing in the $z$ direction to the in-plane magnetised
reference layer and make both $p_{x}$ and $p_{z}$ finite [15, 17, 21, 22].

Reservoir computing in the system used in this study is performed by applying
random binary pulse inputs to the magnetic trilayer. For example, the input
data was encoded in the amplitude of the direct current [15, 17] or microwave
magnetic field [22] in previous works. The input data in this work is encoded
in the amplitude of the direct current as

$J=J_{\rm dc}\left[1+\nu{\rm bi}(t)\right],$ (3)

where $J_{\rm dc}$ is the magnitude of the direct current density and $\nu$ is
the ratio of the binary pulse with respect to the bias current density $J_{\rm
dc}$. In this work, we use $\nu=0.2$, except the results shown in Fig. 5 where
$\nu=0.05$. The random binary data is ${\rm bi}(t)=0\ {\rm or}\ 1$, which is
constant during a pulse width $t_{\rm p}$.

## Results

### Dynamical response to random input

Figures 2(a) and 2(b) show the dynamics of the centre position of the vortex
core $s(t)$ from the random binary input with pulse widths of $0.5$ $\mu$s and
$3.0$ $\mu$s, respectively. Six pulses, divided by dotted lines, represent the
binary data ”001100” as shown by the black line for example. The core position
saturates to the value shown in Fig. 1(b) when the binary pulse of ${\rm
bi}=0$ is inputted, whereas it saturates to a large value when a binary pulse
of ${\rm bi}=1$ is inputted because the spin-transfer torque due to the
additional current, $\nu J_{\rm dc}$, pushes the vortex core away from the
disc centre. As a result, the relaxation dynamics between the two states is
observed when the value of the binary pulse changes. When the pulse width is
shorter than the time to saturate the vortex core position, a gradual change
in the vortex-core position can be observed, as shown in Fig. 2(a). On the
other hand, the vortex core remains almost constant during a pulse when the
pulse width is longer than the time to saturate the vortex core position, as
shown in Fig. 2(b).

Figure 2:  Time evolutions of the vortex-core position (red) and binary pulses
(black) with pulse widths of (a) $0.5$ $\mu$s and (b) $3.0$ $\mu$s. The six
binary pulses denote the input ”001100”. The dotted line represents unit pulse
width $t_{\rm p}$. (c) Target output (red, solid) and system output (blue,
dashed) of the STM task. The delay varies as $D=1,2$, and $3$ from left to
right. The pulse width is $3.0$ $\mu$s.

### Evaluation of short-term memory and parity-check capacities

As a figure of merit for reservoir computing, we evaluate the STM and PC
capacities. The memory capacity characterises the number of data points the
reservoir can store and is a dimensionless quantity. The STM capacity is the
memory capacity for a linear combination of the input data as defined in Eq.
(5) below. The PC capacity is the memory capacity for nonlinear data, where a
nonlinear transformation is applied to the input data, as shown in Eq. (6)
below. In general, the memory capacity depends on the sequence of the input
data, therefore, it is defined as an average of the number of stored data with
respect to random input.

The time-multiplexing method is applied to construct a virtual many-body
system from the dynamical response of a single ferromagnet. The dynamical
response $s(t)$ during a pulse is divided into $N_{\rm node}$, and $s_{k,i}$
corresponding to $s(t)$ at the $i$th node in the presence of the $k$th pulse
is regarded as the $i$th neuron at a discrete time $k$ [12, 15, 17]. By
applying $N=1000$ pulses and dividing the output $s(t)$ into $N_{\rm
node}=250$ nodes, we determined the weight $w_{D,i}$ minimising the error
between the system output and the target data given by

$\sum_{k=1}^{N}\left(\sum_{i=1}^{N_{\rm
node}+1}w_{D,i}s_{k,i}-v_{k,D}\right)^{2},$ (4)

where the bias term is $s_{k,N_{\rm node}+1}=1$ [12]. The integer
$D(=0,1,2,\cdots)$ represents the delay [12, 16, 17, 22]. Since reservoir
computing calculates the time sequence of input data, the capability of a
reservoir is characterised by the number of past input data stored in it. The
delay $D$ characterises such past input data; for example, it shows whether
the $(k-D)$th input data can be reproduced from the $k$th output. Accordingly,
the delay $D$ is a quantity related to the order of the input data, and thus,
is an integer. It does not relate to any time scale of physical systems, such
as physical delay time. In this paper, the symbol $D$ appeared in quantities
related to reservoir computing and is used as an integer represents the delay,
whereas the symbol $\mathscr{D}$ that appeared in the Thiele equation
represents the damping strength. The data the reservoir should reproduce is
called target data or output, and is constructed from the input data. The
target outputs for the STM and PC tasks are, respectively, given by

$v_{k,D}^{\rm STM}={\rm bi}_{k-D},$ (5) $v_{k,D}^{\rm PC}=\sum_{j=0}^{D}{\rm
bi}_{k-D}\ \ ({\rm mod}\ 2),$ (6)

where ${\rm bi}_{k}$ is the $k$th random binary input data.

After determining the weight, we apply different $N^{\prime}=1000$ random
binary pulses as a test set and evaluate the reproducibility of the target
output $v_{n,D}^{\prime}$ ($n=1,2,\cdots,N^{\prime}$) from the system output
defined as

$v_{{\rm R},n,D}^{\prime}=\sum_{i=1}^{N_{\rm node}+1}w_{D,i}s_{n,i}^{\prime},$
(7)

where $s_{n,i}^{\prime}$ is the vortex-core position in the presence of
$N^{\prime}$ random pulses. Figure 2(c) shows the target output (red) and the
system output (blue) for the STM task with a pulse width of $3.0$ $\mu$s,
where the delay varies as $D=1$, $2$ and $3$ from left to right. The system
output well reproduces the target output when the delay is small, whereas the
reproducibility becomes low as the delay increases. The reproducibility is
quantitatively characterised by the correlation coefficient ${\rm Cor}(D)$
between the target output and system output defined as

$\begin{split}&{\rm
Cor}(D)\equiv\frac{\sum_{n=1}^{N^{\prime}}\left(v_{n,D}^{\prime}-\langle
v_{n,D}^{\prime}\rangle\right)\left(v_{R,n,D}^{\prime}-\langle v_{{\rm
R},n,D}^{\prime}\rangle\right)}{\sqrt{\sum_{n=1}^{N^{\prime}}\left(v_{n,D}^{\prime}-\langle
v_{n,D}^{\prime}\rangle\right)^{2}\sum_{n=1}^{N^{\prime}}\left(v_{{\rm
R},n,D}^{\prime}-\langle v_{{\rm
R},n,D}^{\prime}\rangle\right)^{2}}},\end{split}$ (8)

where $\langle\cdots\rangle$ is the averaged value. Figures 3(a) and 3(b) show
the square of the correlation coefficients for the STM and PC tasks,
respectively, at pulse widths of $t_{\rm p}=0.5$, $3.0$ and $5.0$ $\mu$s. The
correlation coefficient becomes small as the delay $D$ increases and becomes
nearly zero as shown in Fig. 3. This is also indicated in Fig. 2(c) where the
reproducibility of the input data decreases as the delay increases.

Figure 3:  Squares of the correlation coefficients, for (a) the STM and (b) PC
tasks at pulse widths of 0.5 (red), 3.0 (green) and 5.0 (blue) $\mu$s. (c)
Dependences of the STM (red) and PC (blue) capacities on pulse width, where
$\nu=0.2$.

The STM and PC capacities, denoted as $C_{\rm STM}$ and $C_{\rm PC}$,
respectively, are defined as

$C=\sum_{D=1}^{D_{\rm max}}\left[{\rm Cor}(D)\right]^{2}.$ (9)

The maximum delay $D_{\rm max}$ in this work is set to $20$, which is
sufficient to evaluate the saturated values of the capacities. We also note
that the number of the training data, $N=1000$, is also sufficient to saturate
the values of the capacities; see Supplemental Information. Figure 3(c) shows
the dependences of $C_{\rm STM}$ (red) and $C_{\rm PC}$ (blue) on the pulse
width. It should be emphasised that both $C_{\rm STM}$ and $C_{\rm PC}$ show
step-like behaviour with respect to the pulse width. When the pulse width is
relatively short ($\lesssim 2.0$ $\mu$s), the capacities remain at large
values over $2.0$. In a middle range of the pulse width ($2.0\lesssim t_{\rm
p}\lesssim 4.5$ $\mu$s), on the other hand, the capacities suddenly drop to
$1.5$. The capacities again drop to $1.0$ when the pulse width becomes longer
($t_{\rm p}\gtrsim 4.5$ $\mu$s).

### Role of current-dependent relaxation on memory function

The step-like behavior of the capacities in Fig. 3(c) can be attributed to the
current-dependent relaxation phenomenon of the vortex core. To explain this
point, we first focus on an analytical solution of the Thiele equation.
Neglecting the small spin-transfer torque due to the in-plane component of the
reference layer’s magnetisation and higher order terms of $s$ ($|s|\leq 1$)
and $\alpha$ ($\alpha\ll 1$), the Thiele equation for the vortex centre
position $s$ becomes

$\dot{s}=as-bs^{3},$ (10)

where $a$ and $b$ are defined as

$\displaystyle
a=\frac{|\mathscr{D}|\kappa}{G^{2}}\left(\frac{Ga_{J}Jp_{z}}{|\mathscr{D}|\kappa}-1\right),$
$\displaystyle b=\frac{|\mathscr{D}|\kappa}{G^{2}}\left(\xi+\zeta\right).$
(11)

Equation (10) is the Stuart-Landau equation [40, 41] for the real variable
$s$. The vortex core is stabilised at the disc centre when $a<0$, whereas a
limit-cycle oscillation appears when $a>0$. The solution of Eq. (10) for $a>0$
with the initial condition $s(t=0)=s(0)$ is given by

$s(t)=\frac{s(0)e^{at}}{\sqrt{1+s(0)^{2}(b/a)(e^{2at}-1)}}.$ (12)

The solution saturates to $\lim_{t\to\infty}s(t)=\sqrt{a/b}$. The normalised
core position should satisfy $0\leq s\leq 1$. Therefore, the condition to
excite the limit cycle oscillation is $J_{\rm c1}<J<J_{\rm c2}$, where $J_{\rm
c1}=(|\mathscr{D}|\kappa)/(Ga_{J}p_{z})$ and $J_{\rm c2}=J_{\rm
c1}(1+\xi+\zeta)$ are determined by the conditions of $a>0$ and $a/b<1$,
respectively. We note that the saturated core position depends on the disc
radius $R$ through the parameter $\kappa\propto 1/R$. The parameter $\kappa$
determines the magnetic potential energy of the vortex core, as shown in Eq.
(2), and becomes small as the disc radius $R$ increases because, in a large
disc, a tiny displacement of the vortex core does not change the magnetic
energy significantly. Since the spin-transfer torque should overcome the
damping torque, which helps keep the vortex core close to the disc centre to
minimise the magnetic energy, in driving the vortex-core dynamics, the
critical current density $J_{\rm c1}$ is proportional to the parameter
$\kappa$. Accordingly, the saturated core position $\sqrt{a/b}$ at a given
current density $J$ depends on the disc radius $R$ through the parameter
$\kappa$ in the critical current density. Roughly speaking, the saturated core
position becomes large as the disc radius $R$ increases because the critical
current density becomes small for a large $R$.

Equation (10) indicates that the time scale for the exponential evolution of
the vortex core, given by $1/a$, depends on the input data through the current
density; a large current density results in a fast relaxation. For example,
$1/a$ for the current density $J$ with ${\rm bi}=0$ is $0.36$ $\mu$s for the
present parameters, whereas it becomes $0.14$ $\mu$s when ${\rm bi}=1$.

Before proceeding to the discussion, we give a brief comment on the relation
between the parameter $1/a$ and the time scale for reservoir computing.
Reservoir computing estimates the information of the past input from the
temporal response of the reservoir. Therefore, the relaxation phenomenon is
key to performing physical reservoir computing. The parameter $1/a(\simeq
0.36\ {\rm or}\ 0.14\ \mu{\rm s})$ characterises the exponential relaxation of
the vortex core. We, however, note that nearly $e^{-1}\simeq 0.37$, i.e.,
$37\%$ of the relaxation process to the saturated value $\sqrt{a/b}$ is not
completed even after a time scale of $1/a$ has passed. The vortex dynamics,
such as those at the last part of the relaxation process, can also be used in
reservoir computing. As a result, the time scale of the relaxation dynamics of
the vortex core applicable to reservoir computing is longer than $1/a$. For
example, the pulse width ($\sim 4.5$ $\mu$s) at which the capacities drop from
$1.5$ to $1.0$ shown in Fig. 3(c) is not exactly the same with the parameter
$1/a$, although such a drop of the capacities is related to the relaxation
phenomenon of the vortex core, as explained below. Therefore, we use the word
”relaxation time” in the following as a time scale to determine the
performance of reservoir computing. However, defining the relaxation time
quantitatively is difficult because it depends on the number of significant
figures in the calculations. We also note that the relaxation time depends on
the current magnitude, as in the case of the parameter $1/a$, because of the
current-dependent relaxation dynamics. If the relaxation time is faster than
the pulse width, the system rapidly relaxes to a steady state and loses the
history of the time-series data. In other words, the pulse width should be
shorter than the relaxation time of the reservoir. An excessively short pulse
width is, however, also not preferable to reservoir computing because the
change in dynamical response with respect to a pulse input becomes small for a
short pulse width.

Figure 4:  (a), (b)Schematic pictures of the vortex dynamics (red) in the
presence of two ($(k-1)$th and $k$th) pulses (black), where the $k$th and
$(k-1)$th pulses are the same in (a) and different in (b). The blue circles
represent the nodes. (c), (d), Schematic views of similar dynamics with three
pulses, where the solid and dotted lines show the cases when the values of the
$(k-2)$th and $(k-1)$th binary pulses are different and the same.

Regarding these points, the identification of the data inputted one sequence
before the present pulse can be explained as follows. As an example, let us
assume that the vortex core remains in a steady state under a binary pulse of
${\rm bi}=0$. For convenience, we name this pulse as the $(k-1)$th pulse. If
the next ($k$th) pulse is ${\rm bi}=0$, the vortex state is unchanged, as
shown in Fig. 4(a). On the other hand, the vortex core changes the position if
the next pulse is ${\rm bi}=1$, as shown in Fig. 4(b). In other words, the
response with respect to the $k$th pulse is affected by the $(k-1)$th pulse.
Therefore, the value of the $(k-1)$th pulse can be estimated from the response
under the $k$th pulse, corresponding to $[{\rm Cor}(D=1)]^{2}=1$. This fact
results in capacities of $1.0$ in a long pulse-width limit shown in Fig. 3(c).

Another saturated value, $1.5$, of the capacities in the middle pulse-width
range is explained in a similar way, by taking into account the current-
dependent relaxation time. Let us consider the injection of three pulses,
named as the $(k-2)$th, $(k-1)$th and $k$th pulses, as shown in Figs. 4(c) and
4(d). The solid and dotted lines in the figures show the vortex dynamics when
the $(k-2)$th and $(k-1)$th binary pulses are different and the same,
respectively. In Fig. 4(c), the $(k-1)$th pulse is ${\rm bi}=1$. In this case,
the vortex core saturates rapidly, and thus, the vortex core is in a steady
state at the end of the $(k-1)$th pulse, independent of the $(k-2)$th pulse.
This fact indicates that the $(k-2)$th input data cannot be identified from
the vortex dynamics under the presence of the $k$th input. On the other hand,
when the $(k-1)$ th pulse is ${\rm bi}=0$, the vortex dynamics under the
presence of the $k$th pulse depends on the $(k-2)$th pulse. This is because
the relaxation time is slow, and thus, the vortex state at the end of the
$(k-1)$th pulse reflects the state under the $(k-2)$th pulse, as shown in Fig.
4(d). As a result, the $(k-2)$th input can be identified when the $(k-1)$th
pulse is ${\rm bi}=0$. Therefore, the reproducibility of the $(k-2)$th data is
$50\%$, resulting in $[{\rm Cor}(D=2)]^{2}=0.5$ and the capacity value of
$1.5$. As can be seen in this explanation, the step-like behaviour of the
memory function in Fig. 3(c) can be attributed to the current-dependent
relaxation mechanism of the vortex dynamics.

### Memory capacity for different input strength

The role of the relaxation time of the vortex core on the memory function for
reservoir computing can be discussed from a different viewpoint. Figure 5(a)
shows the dynamics of the centre position of the vortex core in the presence
of six pulses with widths of $0.5$ $\mu$s. The situation is the same with that
shown in Fig. 3(a), but here, we use a relatively weak input pulse
characterised by $\nu=0.05$. Because of the small input-pulse strength $\nu$,
the change of $s(t)$ with respect to the input current is small compared with
that shown in Fig. 2(a).

Figure 5:  (a) Time evolutions of the vortex-core position (red) and the
binary pulses (black) with widths of $0.5$ $\mu$s and (b) dependences of the
STM (red) and PC (blue) capacities on pulse width, where the dimensionless
parameter $\nu$ that determinines the difference in magnitudes of the binary
inputs is $0.05$.

Figure 5(b) shows the dependences of the STM and PC capacities on the pulse
width for $\nu=0.05$. Note that we argue above that the value of $1.5$ in the
memory capacity reflects the difference in the relaxation times between two
states. Due to the small parameter $\nu$, the relaxation time from the ${\rm
bi}=0$ to ${\rm bi}=1$ state becomes close to that of the opposite case,
compared with the system studied in the previous sections. As a result, the
reservoir can distinguish both signals in a relatively large pulse-width
range. Therefore, the range corresponding to the value of $C=2$ for the memory
capacities is enlarged, compared with that found in Fig. 3(c) in the main
text, and the step-like behavior is observed even in a short pulse-width
range. In addition, the pulse width at which the jump from $C=2$ to $C=1.5$
occurs is shifted to a long pulse-width region. The results also indicate that
the step-like behaviour originates from the current-dependent vortex relation,
which is controlled by the parameter $\nu$. In Supplemental Information, we
also provide the data showing the STM and PC capacities for various values of
$\nu$, which also support the argument here.

## Discussion

In summary, physical reservoir computing using magnetic vortex-core dynamics
in a fine-structured ferromagnet was performed by solving the Thiele equation
numerically. The step-like dependence of the STM and PC capacities on the
pulse width was found, where the capacities remain at a value of $1.5$ for a
certain range of the pulse width, and drop to $1.0$ for a long pulse-width
limit. Such a half-integer memory capacity originated from the current-
dependent relaxation mechanism of the vortex core, where a fast relaxation
caused by a large input led to a fast fading of the input memory, whereas a
slow relaxation by a small input enabled the reservoir to keep the input
memory for a relatively long time. Using a small input-pulse made the
difference of the relaxation times between the two states small and suppressed
such a fast fading memory. Accordingly, the input-pulse range corresponding to
a relatively large capacity, $2.0$, was enlarged.

In practical applications, the input data for reservoir computing is converted
to electrical inputs by the data conversion, and a preprocessing method is
applied to the data [17]. The present work indicates that an appropriate
choice of pulse width is necessary in the data conversion to achieve high
performance of physical reservoir computing. The value of the appropriate
pulse width relates to the relaxation time of the reservoir. Spintronics
technology provides various kinds of structures, such as macrospin, domain
wall, spin-wave and/or skyrmions, by arranging the materials, designs and
topologies. The process of the data conversion will depend on the devices
because the relaxation time depends on the structures. This study therefore
provides a crucial guideline for such device design.

## Methods

The Thiele equation is solved by the fourth-order Runge-Kutta method. The
minimisation of the error between the system output and the target data is
performed using the Moore-Penrose pseudo inverse matrix determined by the
singular value decomposition.

## Acknowledgements

The authors acknowledge Shinji Miwa and Takehiko Yorozu for their valuable
discussions. This paper was based on the results obtained from a project
(Innovative AI Chips and Next-Generation Computing Technology Development/(2)
Development of next-generation computing technologies/Exploration of
Neuromorphic Dynamics towards Future Symbiotic Society) commissioned by NEDO.

## Author contributions statement

K.N., S.T., T.T., and H.K. designed the project. T.Y., N.A., K.N., and T.T.
directed the investigation. T.Y. and T.T. developed the program codes,
performed the simulations, prepared the figures, and wrote the manuscript. All
authors contributed to discussing the results.

## Competing interests

The authors declare no competing interests.

## Additional information

Correspondence and requests for materials should be addressed to T.T.
Supplementary information accompanies this paper.

## References

  * Mandic and Chambers [2001] D. P. Mandic and J. A. Chambers,  _Recurrent neural networks for prediction: learning algorithms, architectures and stability_ (Wiley, 2001).
  * Maas  _et al._ [2002] W. Maas, T. Natschläger, and H. Markram, Real-Time Computing Without Stable States: A New Framework for Neural Computation Based on Perturbations, Neural Comput. 14, 2531 (2002).
  * Jaeger and Haas [2004] H. Jaeger and H. Haas, Harnessing Nonlinearity: Predicting Chaotic Systems and Saving Energy in Wireless Communication, Science 304, 78 (2004).
  * Verstraeten  _et al._ [2007] D. Verstraeten, B. Schrauwen, M. D’Haene, and D. Stroobandt, An experimental unification of reservoir computing methods, Neural Netw. 20, 391 (2007).
  * Hermans and Schrauwen [2010] M. Hermans and B. Schrauwen, Memory in linear recurrent neural networks in continuous time, Neural Netw. 23, 341 (2010).
  * Appeltant  _et al._ [2011] L. Appeltant, M. C. Soriano, G. V. der Sande, J. Danckaert, S. Massar, J. Dambre, B. Schrauwen, C. R. Mirasso, and I. Fischer, Information processing using a single dynamical node as complex system, Nat. Commun. 2, 468 (2011).
  * Grigoryeva and Ortega [2018] L. Grigoryeva and J.-P. Ortega, Echo state networks are universal, Neural Netw. 108, 495 (2018).
  * Röhm and Lüdge [2018] A. Röhm and K. Lüdge, Multiplexed networks: reservoir computing with virtual and real nodes, J. Phys. Commun. 2, 085007 (2018).
  * Nakajima [2020] K. Nakajima, Physical reservoir computing - an introductory perspective, Jpn. J. Appl. Phys. 59, 060501 (2020).
  * Brunner  _et al._ [2013] D. Brunner, M. C. Soriano, C. R. Mirasso, and I. Fischer, Parallel photonic information processing at gigabyte per second data rates using trasient states, Nat. Commun. 4, 1364 (2013).
  * Nakajima  _et al._ [2015] K. Nakajima, H. Hauser, T. Li, and R. Pfeifer, Information processing via physical soft body, Sci. Rep. 5, 10487 (2015).
  * Fujii and Nakajima [2017] K. Fujii and K. Nakajima, Harnessing Disordered-Ensemble Quantum Dynamics for Machine Learning, Phys. Rev. Applied 8, 024030 (2017).
  * Dion  _et al._ [2018] G. Dion, S. Mejaouri, and J. Sylvestre, Reservoir computing with a single delay-coupled non-linear mechanical oscillator, J. Appl. Phys. 124, 152132 (2018).
  * Nakajima  _et al._ [2019] K. Nakajima, K. Fujii, M. Negoro, K. Mitarai, and M. Kitagawa, Boosting Computational Power through Spatial Multiplexing in Quantum Reservoir Computing, Phys. Rev. Applied 11, 034021 (2019).
  * Torrejon  _et al._ [2017] J. Torrejon, M. Riou, F. A. Araujo, S. Tsunegi, G. Khalsa, D. Querlioz, P. Bortolotti, V. Cros, K. Yakushiji, A. Fukushima, H. Kubota, S. Yuasa, M. D. Stiles, and J. Grollier, Neuromorphic computing with nanoscale spintronic oscillators, Nature 547, 428 (2017).
  * Furuta  _et al._ [2018] T. Furuta, K. Fujii, K. Nakajima, S. Tsunegi, H. Kubota, Y. Suzuki, and S. Miwa, Macromagnetic Simulation for Reservoir Computing Utilizing Spin Dynamics in Magnetic Tunnel Junctions, Phys. Rev. Applied 10, 034063 (2018).
  * Tsunegi  _et al._ [2018] S. Tsunegi, T. Taniguchi, S. Miwa, K. Nakajima, K. Yakusjiji, A. Fukushima, S. Yuasa, and H. Kubota, Evaluation of memory capacity of spin torque oscillator for recurrent neural networks, Jpn. J. Appl. Phys. 57, 120307 (2018).
  * Bourianoff  _et al._ [2018] G. Bourianoff, D. Pinna, M. Sitte, and K. Everschor-Sitte, Potential implementation of reservoir computing models based on magnetic skyrmions, AIP Adv. 8, 055602 (2018).
  * Nakane  _et al._ [2018] R. Nakane, G. Tanaka, and A. Hirose, Reservoir Computing With Spin Waves Excited in a Garnet Film, IEEE Access 6, 4462 (2018).
  * Nomura  _et al._ [2019] H. Nomura, T. Furuta, K. Tsujimoto, Y. Kuwabiraki, F. Peper, E. Tamura, S. Miwa, M. Goto, R. Nakatani, and Y. Suzuki, Reservoir computing with dipole-coupled nanomagnets, Jpn. J. Appl. Phys. 58, 070901 (2019).
  * Marković  _et al._ [2019] D. Marković, N. Leroux, M. Riou, F. A. Araujo, J. Torrejon, D. Querlioz, A. Fukushima, S. Yuasa, J. Trastoy, P. Bortolotti, and J. Grollier, Reservoir computing with the frequency, phase, and amplitude of spin-torque nano-oscillators, Appl. Phys. Lett. 114, 012409 (2019).
  * Tsunegi  _et al._ [2019] S. Tsunegi, T. Taniguchi, K. Nakajima, S. Miwa, K. Yakushiji, A. Fukushima, S. Yuasa, and H. Kubota, Physical reservoir computing based on spin torque oscillator with forced synchronization, Appl. Phys. Lett. 114, 164101 (2019).
  * Riou  _et al._ [2019] M. Riou, J. Torrejon, B. Garitaine, F. A. Araujo, P. Bortolotti, V. Cros, S. Tsunegi, K. Yakushiji, A. Fukushima, H. Kubota, S. Yuasa, D. Querlioz, M. D. Stiles, and J. Grollier, Temporal Patter Recognition with Delayed-Feedback Spin-Torque Nano-Oscillators, Phys. Rev. Applied 12, 024049 (2019).
  * Yamaguchi  _et al._ [2020] T. Yamaguchi, N. Akashi, S. Tsunegi, H. Kubota, K. Nakajima, and T. Taniguchi, Periodic structure of memory function in spintronics reservoir with feedback current, Phys. Rev. Research 2, 023389 (2020).
  * Slonczewski [1996] J. C. Slonczewski, Current-driven excitation of magnetic multilayers, J. Magn. Magn. Mater. 159, L1 (1996).
  * Berger [1996] L. Berger, Emission of spin waves by a magnetic multilayer traversed by a current, Phys. Rev. B 54, 9353 (1996).
  * Katine  _et al._ [2000] J. A. Katine, F. J. Albert, R. A. Buhrman, E. B. Myers, and D. C. Ralph, Current-Driven Magnetization Reversal and Spin-Wave Excitations in Co/ Cu/Co Pillars, Phys. Rev. Lett. 84, 3149 (2000).
  * Kiselev  _et al._ [2003] S. I. Kiselev, J. C. Sankey, I. N. Krivorotov, N. C. Emley, R. J. Schoelkopf, R. A. Buhrman, and D. C. Ralph, Microwave oscillations of a nanomagnet driven by a spin-polarized current, Nature 425, 380 (2003).
  * Rippard  _et al._ [2004] W. H. Rippard, M. R. Pufall, S. Kaka, S. E. Russek, and T. J. Silva, Direct-Current Induced Dynamics in Co90Fe10/Ni80Fe20 Point Contacts, Phys. Rev. Lett. 92, 027201 (2004).
  * Kubota  _et al._ [2013] H. Kubota, K. Yakushiji, A. Fukushima, S. Tamaru, M. Konoto, T. Nozaki, S. Ishibashi, T. Saruya, S. Yuasa, T. Taniguchi, H. Arai, and H. Imamura, Spin-Torque Oscillator Based on Magnetic Tunnel Junction with a Perpendicularly Magnetized Free Layer and In-plane Magnetized Polarizer, Appl. Phys. Express 6, 103003 (2013).
  * Thiele [1973] A. A. Thiele, Steady-State Motion of Magnetic Domains, Phys. Rev. Lett. 30, 230 (1973).
  * Guslienko  _et al._ [2006] K. Y. Guslienko, X. F. Han, D. J. Keavney, R. Divan, and S. D. Bader, Magnetic Vortex Core Dynamics in Cylindrical Ferromagnetic Dots, Phys. Rev. Lett. 96, 067205 (2006).
  * Guslienko [2006] K. Y. Guslienko, Low-frequency vortex dynamic susceptibility and relaxation in mesoscopic ferromagnetic dots, Appl. Phys. Lett. 89, 022510 (2006).
  * Khvalkovskiy  _et al._ [2009] A. V. Khvalkovskiy, J. Grollier, A. Dussaux, K. A. Zvezdin, and V. Cros, Vortex oscillations induced by spin-polarized current in a magnetic nanopillar: Analytical versus micromagnetic calculations, Phys. Rev. B 80, 140401(R) (2009).
  * Guslienko  _et al._ [2011] K. Y. Guslienko, G. R. Aranda, and J. Gonzalez, Spin torque and critical currents for magnetic vortex nano-oscillator in nanopillars, J. Phys. Conf. Ser. 292, 012006 (2011).
  * Dussaux  _et al._ [2012] A. Dussaux, A. V. Khvalkovskiy, P. Bortolotti, J. Grollier, V. Cros, and A. Fert, Field dependence of spin-transfer-induced vortex dynamics in the nonlinear regime, Phys. Rev. B 86, 014402 (2012).
  * Grimaldi  _et al._ [2014] E. Grimaldi, A. Dussaux, P. Bortolotti, J. Grollier, G. Pillet, A. Fukushima, H. Kubota, K. Yakushiji, S. Yuasa, and V. Cros, Response to noise of a vortex based spin transfer nano-oscillator, Phys. Rev. B 89, 104404 (2014).
  * Tsunegi  _et al._ [2014] S. Tsunegi, H. Kubota, K. Yakushiji, M. Konoto, S. Tamaru, A. Fukushima, H. Arai, H. Imamura, E. Grimaldi, R. Lebrun, J. Grollier, V. Cros, and S. Yuasa, High emission power and Q factor in spin torque vortex oscillator consisting of FeB free layer, Appl. Phys. Express 7, 063009 (2014).
  * Tsunegi  _et al._ [2016] S. Tsunegi, K. Yakushiji, A. Fukushima, S. Yuasa, and H. Kubota, Microwave emission power exceeding 10 $\mu$W in spin torque vortex oscillator, Appl. Phys. Lett. 109, 252402 (2016).
  * Strogatz [2001] S. H. Strogatz,  _Nonlinear Dynamics and Chaos: With Applications to Physics, Biology, Chemistry, and Engineering_ , 1st ed. (Westview Press, 2001).
  * Pikovsky  _et al._ [2003] A. Pikovsky, M. Rosenblum, and J. Kurths,  _Synchronization: A universal concept in nonlinear sciences_ , 1st ed. (Cambridge University Press, 2003).


11institutetext: Pattern Recognition Lab, Department of Computer Science,
Friedrich-Alexander-Universität Erlangen-Nürnberg, Erlangen, Germany

# The Effect of Various Strengths of Noises and Data Augmentations on
Classification of Short Single-Lead ECG Signals Using Deep Neural Networks

Faezeh Nejati Hatamian  AmirAbbas Davari  Andreas Maier

###### Keywords:

ECG Signal, Data Augmentation, Depthwise separable 1D convolution, Deep
Convolutional Neural Network, Noise types/strengths

## Background

Due to the multiple imperfections during the signal acquisition,
Electrocardiogram (ECG) datasets are typically contaminated with numerous
types of noise, like salt and pepper and baseline drift. These datasets may
contain different recordings with various types of noise [1] and thus,
denoising may not be the easiest task. Furthermore, usually, the number of
labeled bio-signals is very limited for a proper classification task.

## Methods

In this work, we investigate the performance of deep convolutional neural
networks and their separable alternatives (i.e., separable CNN) that are
trained using noisy training data, tested on a clean test set. It is
interesting to see if variants of CNNs and different schemes of data
augmentation can help the classifier in the presence of noise contamination.
To this end, we add different types and strengths of noise to the training
data and train the network. We would like to see how noise in the training
data impacts the inference performance and which noise is more destructive.
For the purpose of simulation, we use additive white Gaussian noise (AWGN) in
one variant and linear noise $\left(y=ax\right)$ in the other variant. In the
case of the AWGN, we use 20, 40, 60, 80 values as the standard deviation to
generate various strengths of this noise. Analogously, we use 0.2, 0.4, 0.6
and 0.8 as different slopes for the linear noise. Figure 1 shows a sample
signal from the training set being contaminated by different types and
strengths of noise.

Figure 1:  Noisy ECG signal. Left: linear noise; right: AWGN.

Moreover, we use oversampling and Gaussian Mixture Model (GMM) [3, 4] for data
augmentation and compare the results with the variant without data
augmentation. The metric that we adopt to measure the performance of the
classifier is the F1-score. We use the same dataset [2] in a similar fashion
as in our previous work [5] (Fig. 3). Finally, Fig. 3 depicts the CNN
architecture and its separable variant.

Figure 2: dataset division policy.

Figure 3: CNN architecture.

## Results

Figure 4 visualizes the F1-score vs. the corresponding noise strength for
different data augmentation algorithms, types of noise and classifiers. Table
1 shows the detailed quantitative results.

Figure 4: F1-scores vs. noise strengths for different noise (Linear and AWGN),
data augmentation algorithms and classifiers. Table 1: F1-score for different
classifiers and different noises (Linear, AWGN) with various strengths.

|  | Slope in Linear Noise (a in y=ax) | Standard Deviation in AWGN ($\sigma$ in $\mathcal{N}(0,\sigma))$
---|---|---|---
Classifier | aug | 0 | 0.2 | 0.4 | 0.6 | 0.8 | 0 | 20 | 40 | 60 | 80
CNN | None | 80.76 | 72.02 | 64.89 | 60.08 | 60.81 | 80.76 | 79.50 | 78.63 | 82.71 | 82.63
GMM | 79.91 | 77.29 | 78.74 | 02.06 | 02.08 | 79.91 | 81.45 | 75.38 | 84.53 | 84.07
Separable CNN | None | 79.69 | 75.54 | 82.72 | 81.15 | 81.79 | 79.69 | 85.73 | 77.62 | 82.37 | 75.89
GMM | 82.33 | 82.76 | 81.22 | 81.24 | 81.75 | 82.33 | 83.95 | 81.65 | 81.56 | 80.55

## Conclusion

It can be observed that in the presence of various types and strengths of the
noise, the separable CNN is more stable and robust than the normal CNN. In the
majority of the experiments, linear noise is more destructive than the AWGN.
In fact, both CNN and separable CNN perform equally well in the presence of
the AWGN. However, CNN simply falls apart in the presence of the linear noise.
In this case, the separable CNN brings robustness to the classification
pipeline. Finally, except in the case of linear noise and normal CNN, the
highest classification performance is almost consistently being achieved when
the GMM data augmentation is in use.

## References

  * Abdelazez et al. [2018] Abdelazez, M., Rajan, S., Chan, A.D.: Detection of noise type in electrocardiogram.  In: 2018 IEEE International Symposium on Medical Measurements and Applications (MeMeA). pp. 1–6. IEEE (2018)
  * Clifford et al. [2017] Clifford, G.D., Liu, C., Moody, B., Li-wei, H.L., Silva, I., Li, Q., Johnson, A., Mark, R.G.: Af classification from a short single lead ecg recording: the physionet/computing in cardiology challenge 2017.  In: 2017 Computing in Cardiology (CinC). pp. 1–4. IEEE (2017)
  * Davari et al. [2018] Davari, A., Aptoula, E., Yanikoglu, B., Maier, A., Riess, C.: Gmm-based synthetic samples for classification of hyperspectral images with limited training data.  IEEE Geoscience and Remote Sensing Letters 15(6), 942–946 (2018)
  * Davari et al. [2019] Davari, A., Özkan, H.C., Maier, A., Riess, C.: Fast and efficient limited data hyperspectral remote sensing image classification via gmm-based synthetic samples.  IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing 12(7), 2107–2120 (2019)
  * Hatamian et al. [2020] Hatamian, F.N., Ravikumar, N., Vesal, S., Kemeth, F.P., Struck, M., Maier, A.: The effect of data augmentation on classification of atrial fibrillation in short single-lead ecg signals using deep neural networks.  In: ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). pp. 1264–1268. IEEE (2020)