<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Data Preprocessing for Machine Learning in Seismology</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Vladimir Chernykh</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Andrey Stepnov</string-name>
          <email>a.stepnov@geophystech.ru</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff2">2</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Olga Lukyanova</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>680000</institution>
          ,
          <country country="RU">Russia</country>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Computing Center of Far-Eastern Branch, Russian Academy of Sciences</institution>
          ,
          <addr-line>65 Kim Yo Cheng st., Khabarovsk</addr-line>
        </aff>
        <aff id="aff2">
          <label>2</label>
          <institution>Geophystech LLC</institution>
          ,
          <addr-line>1b Nauki, Yuzhno-Sakhalinsk, 693022</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <fpage>119</fpage>
      <lpage>123</lpage>
      <abstract>
        <p>The problem of preliminary data processing on P, S arrivals of seismic waves has been formulated. Data preprocessing was carried out for further classification using machine learning models. A comparative analysis of the following neural networks has been carried out: GPD, EQTransformer, and PhaseNet. Demonstrated the automation process for machine learning methods of seismic waves detection.</p>
      </abstract>
      <kwd-group>
        <kwd>Machine learning</kwd>
        <kwd>earthquake</kwd>
        <kwd>time series</kwd>
        <kwd>waveform data</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>networks.</p>
      <p>Current day earthquake detection and analysis require the necessity of staff involvement, trained in
visual detection of different seismic waves in a continuous stream of data from local seismic</p>
      <p>Local earthquakes generate different types of seismic waves, which travel away from the source.
The fastest among these are P-waves and S-waves (primary and secondary). Accurate detection of P
and S waves is used in earthquake source location by computing source parameters: coordinates,
hypocenter depth, and origin time.</p>
      <p>The continuous growth of seismic networks causes an increase in trained human staff demand.</p>
      <p>
        Threshold methods [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ] are very popular as an incomplete approach to seismic events detection
automation. However, these methods have proven ineffective in low-magnitude earthquake detection,
especially in noisy environments.
      </p>
      <p>
        The machine learning approach has shown an ability to achieve detection accuracy compared to
(or even surpassing) which of trained staff [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ].
      </p>
      <p>Preprocessing of seismic data is a first and critical step in full automation of classification of
seismic wave arrival times. The present paper demonstrates seismic data preprocessing for subsequent
use in machine learning methods of earthquake detection and describes the method employed to
automate machine learning methods of seismic waves detection.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Data description</title>
      <p>For neural-networks training and evaluation purposes, we used a dataset of hand-picked local
earthquake data from the Sakhalin island seismic network. Dataset consists of 3045 P-arrivals, 3737</p>
      <sec id="sec-2-1">
        <title>S-arrivals, and 3045 noise fragments collected from 2014 to 2021. Each seismic record is a 3-component (North, East, and vertical components) 4 seconds slice of ground movement information with a sampling rate of 100 Hz. Continuous seismic data streams are usually stored as day-length entries with gaps for station offline times. Data gathered from stations</title>
        <p>2021 Copyright for this paper by its authors.
with sampling rates different from 100 Hz were resampled to 100 Hz using the Fourie method.
Accelerometer data were integrated by time to convert it to seismograms.</p>
        <p>Seismic events were filtered by a minimal magnitude of 1 and maximum distance to an earthquake
source of 300 km. The data first were detrended and high-pass filtered above 2 Hz and then
normalized by the absolute maximum amplitude on any of the three components. Figure 1 illustrates
preprocessing on an actual earthquake from 01.04.2021.</p>
        <p>
          Also, we used a larger dataset of southern California seismic network records [
          <xref ref-type="bibr" rid="ref2">2</xref>
          ], composed of
4 773 750 3-component records with an equal number of P-wave arrivals, S-wave arrivals, and noise
patches. Data preprocessing is similar to formerly described methods used on the Sakhalin data.
        </p>
        <p>We used day-long continuous data from 3-component seismographs to evaluate the program
integration of machine learning methods.</p>
      </sec>
    </sec>
    <sec id="sec-3">
      <title>3. Models</title>
      <p>The integration is designed for classification neural networks and supports output classes number,
labels, and positive characteristic (seismic event vs. noise) customization.</p>
      <p>
        In this study, following models was evaluated: GPD [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], EQTransformer [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], and PhaseNet [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>GPD input is a 3-component 4 seconds long record (with a sampling rate of 100 Hz), in other
words, an array of data with a shape 400x3. Model output is a set of three probabilities corresponding
to the likelihood of each respective class: P-wave, S-wave, and noise. EQTransformer and PhaseNet
input is a 3-component record of 60 and 90 seconds length, respectively.</p>
      <p>For PhaseNet and EQTransformer evaluation, we reconstructed datasets to meet new input data
shape requirements. New datasets composed of the same P and S waves arrivals and employed the
same preprocessing methods as described in section 2. Data description.</p>
      <p>All models were trained on southern California data and evaluated on 20% of Sakhalin data (table
1, pre-trained), followed by fine-tuning on 80% of Sakhalin data with evaluation on 20% of Sakhalin
data (table 1, fine-tuned). GPD displayed the best results and thus was chosen as a target model for
the automation process of seismic events detection.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Automation of seismic waves detection</title>
      <p>
        Program integration is designed to work with seismogram databases generated by SEISAN [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]
software.
      </p>
      <p>SEISAN software is a software package for analyzing earthquakes. The system provides the means
to maintain the database containing the configuration of the seismic station network, earthquake
records, data stream archives from the seismic station network.</p>
      <sec id="sec-4-1">
        <title>SEISAN database includes the following directories:</title>
        <p>• REA – earthquake readings and full epicenter solutions in a database
• WOR – the users work directory
• DAT – default and parameter files, system configuration files
• WAV – digital waveform data files
• archives – database of continuous seismic data from stations split into day-long files
The product of the automation development is a program that analyzes SEISAN database files and
searches for earthquakes on the data stream from specified stations. The program analyzes the
network configuration, including information on active stations from the DAT directory, and searches
daily archives of the continuous stream from seismic stations.</p>
        <p>Currently, the automation is not used in real-time, rather daily analysis of the new seismic data
from the specified monitoring stations is performed. The workflow of the earthquake detection
automation is displayed in figure 2.</p>
        <p>The automation employs the following workflow: program scans SEISAN database structure and
then picks correct seismogram archive for analysis. Next, preliminary data processing is performed:
detrend and high-pass filtering above 2 Hz. The seismic data stream is then split by a sliding window
with a length of 4 seconds and a step of 0.1 seconds; each window is normalized and used as an input
for the target neural network prediction.</p>
        <p>Class predictions were then restored to input data frequency (from 10 Hz to 100 Hz) using linear
interpolation, resulting in three probability curves: P-wave curve, S-wave curve, and noise probability
curve. Probability curves example displayed in figure 3,b alongside with raw input data (figure 3,a).
Positive wave arrivals predictions are marked as red “stars” on P and S probability curves.</p>
        <p>For each positive class (P and S waves), probability curve peaks are found with the minimal
allowed distance between adjacent peaks in 10 seconds and the threshold probability value is 0.95.</p>
        <p>Then, the mean value in a 1-second span (a quarter of the window length) around the peak position
is calculated for every class probability curve. Finally, the values are compared, and if the mean value
belonging to the peak is highest, then the peak position is assumed as a positive prediction.</p>
        <p>Positives are then outputted in a text file in order of occurrence with corresponding information
about positives time, probability, type (P-arrival, S-arrival), and seismic station.</p>
        <p>In addition, the program supports data and predictions visualization in the form of graphs,
including scores visualization (figure 3), preprocessed data plotting, and raw data plotting (figure 3).</p>
        <p>Also, launch options for performance evaluation of entire automation and only neural network
computation times were implemented to provide means for future models comparative analysis.</p>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusion</title>
      <p>The development of the present study yielded the application for the automation of seismic waves
detection using machine learning methods.</p>
      <p>Also, during the automation evaluation, new classification neural network training flaws were
revealed, which may lead to further studies and improvements.</p>
      <p>Extensive effort was put into data gathering and processing for model training and evaluation,
which may be used for future projects and new classification neural networks. Also, a program
package was developed for data (P and S waves and noise records) gathering from SEISAN
databases. The package also includes the ability to filter out events by magnitude, source depth and
distance, and seismic monitoring station properties (such as the number of components, instrument
types).</p>
    </sec>
    <sec id="sec-6">
      <title>6. Acknowledgements</title>
      <p>
        The work was done with partial support by the Russian Foundation for Basic Research, project No.
18-29-03196. The studies were carried out using the resources of the Center for Shared Use of
Scientific Equipment "Center for Processing and Storage of Scientific Data of the Far Eastern Branch
of the Russian Academy of Sciences" [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], funded by the Russian Federation represented by the
Ministry of Science and Higher Education of the Russian Federation under project No.
075-15-2021663.
      </p>
    </sec>
    <sec id="sec-7">
      <title>7. References</title>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <surname>Withers</surname>
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Aster</surname>
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Young</surname>
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Beiriger</surname>
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Harris</surname>
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Moore</surname>
            <given-names>S.</given-names>
          </string-name>
          and
          <string-name>
            <surname>Trujillo</surname>
          </string-name>
          , J..
          <source>A Comparison of Select Trigger Algorithms for Automated Global Seismic Phase and Event Detection. Bulletin of the Seismological Society of America</source>
          , Vol.
          <volume>88</volume>
          , No.
          <issue>1</issue>
          , pp.
          <fpage>95</fpage>
          -
          <lpage>106</lpage>
          ,
          <year>February 1998</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Ross</surname>
            <given-names>Z.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Meier</surname>
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hauksson</surname>
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Heaton</surname>
            <given-names>T</given-names>
          </string-name>
          ..
          <article-title>Generalized Seismic Phase Detection with Deep Learning</article-title>
          .
          <source>Bulletin of the Seismological Society of America</source>
          , Vol.
          <volume>108</volume>
          , pp.
          <fpage>2894</fpage>
          -
          <lpage>2091</lpage>
          ,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Mousavi</surname>
            ,
            <given-names>S.M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ellsworth</surname>
            ,
            <given-names>W.L.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Zhu</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          et al.
          <article-title>Earthquake transformer-an attentive deeplearning model for simultaneous earthquake detection and phase picking</article-title>
          .
          <source>Nat Commun</source>
          <volume>11</volume>
          ,
          <issue>3952</issue>
          (
          <year>2020</year>
          ). https://doi.org/10.1038/s41467-020-17591-w.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>Zhu</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          , &amp;
          <string-name>
            <surname>Beroza</surname>
            ,
            <given-names>G. C.</given-names>
          </string-name>
          (
          <year>2018</year>
          ).
          <article-title>PhaseNet: A Deep-Neural-Network-Based Seismic Arrival Time Picking Method</article-title>
          . arXiv preprint arXiv:
          <year>1803</year>
          .03211.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <article-title>[5] SEISAN - earthquake analysis software</article-title>
          . URL: http://seisan.info.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>A. A.</given-names>
            <surname>Sorokin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. V.</given-names>
            <surname>Makogonov</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S. P.</given-names>
            <surname>Korolev</surname>
          </string-name>
          ,
          <article-title>The information infrastructure for collective scientific work in the Far East of Russia, Scientific</article-title>
          and
          <source>Technical Information Processing</source>
          <volume>44</volume>
          (
          <issue>4</issue>
          ) (
          <year>2017</year>
          )
          <fpage>302</fpage>
          -
          <lpage>304</lpage>
          , doi:10.3103/S0147688217040153.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>