<!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>Weather Forecasts Through an LSTM-CBR Twin System</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Kingdom</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Craig Pirie</string-name>
          <email>c.pirie11@rgu.ac.uk</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Malavika Suresh</string-name>
          <email>m.suresh@rgu.ac.uk</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Pedram Salimi</string-name>
          <email>p.salimi@rgu.ac.uk</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Chamath Palihawadana</string-name>
          <email>c.palihawadana1@rgu.ac.uk</email>
          <xref ref-type="aff" rid="aff0">0</xref>
          <xref ref-type="aff" rid="aff1">1</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>LSTM</institution>
          ,
          <addr-line>XCBR, NLG, Integrated Gradients, Forecasting, Visualisation</addr-line>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>School of Computing</institution>
          ,
          <addr-line>The Sir Ian Wood Building, Garthdee Road</addr-line>
          ,
          <institution>Robert Gordon University</institution>
          ,
          <addr-line>Aberdeen, Scotland, United</addr-line>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2022</year>
      </pub-date>
      <abstract>
        <p>In this paper, we explore two methods for explaining LSTM-based temperature forecasts using previous 14 day progressions of humidity and pressure. First, we propose and evaluate an LSTM-CBR twin system that generates nearest-neighbors that can be visualised as explanations. Second, we use feature attributions from Integrated Gradients to generate textual explanations that summarise the key progressions in the past 14 days that led to the predicted value.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>LSTM-CBR</p>
    </sec>
    <sec id="sec-2">
      <title>1. Introduction</title>
      <p>
        Inaccurate weather forecasting can have a serious impact to life, property and businesses. For
instance, farmers rely on weather forecasting to plan activities such as ploughing, harvesting
and cultivation [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. In 2018, the inability of weather forecasts to detect an early monsoon
indirectly trapped 12 Thai children and their football coach in a cave for 18 days — and caused
the death of two of their rescuers 1. Eficiently predicting weather can help to minimise these
losses in the future [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Howbeit, weather is stochastic and its patterns are non-linear, making
it a challenge to obtain precise predictions. The problem lends itself well to neural networks for
their ability to model non-linearity. Particularly, weather forecasting suits sequential methods
such as the Long Short-Term Memory (LSTM) [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ], to allow for the utilisation of time-series data
in the prediction process [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. By making use of the recurrent nature of the LSTM, information
can be fed back through diferent steps along a time-series, capturing trends, seasonality and
more, which all help increase predictive power.
      </p>
      <p>ICCBR XCBR’22: 4th Workshop on XCBR: Case-based Reasoning for the Explanation of Intelligent Systems at ICCBR-2022,
CEUR
Workshop
Proceedings</p>
      <p>
        Although weather forecasts are common in everyday life, we seldom seek for deeper insights
to explain how a prediction was made. On the contrary — if we did ask for further explanation
— we could pass better judgement on the validity of predictions. Explainable AI (XAI) has
become increasingly prevalent in recent times. This is because despite deep learning methods
now excelling in performance in a variety of domains, they often remain as black-boxes;
we are unable to ‘look inside’ to understand why a prediction was made. Methods such as
Integrated Gradients [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] have been useful for producing saliency maps in images to highlight
the important pixels that weigh heavily on the outcome of a classification. They have also been
applied in a time-series setting but are often unsophisticated and can be dificult to interpret —
presenting a need for dedicated time-series solutions [
        <xref ref-type="bibr" rid="ref5 ref6">5, 6</xref>
        ]. Literature shows that some (albeit
few) attempts have been made to explain weather forecasts in a time-series setting such as by
score-maximisation and occlusion analysis visualisations [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ], or applying LIME [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]. However,
none of these methods propose the use of case-based reasoning (CBR) to provide explanations.
Using an approach grounded in similarity, such as CBR, a posteriori knowledge can be drawn
upon to help both prediction and explanation. Past experiences can be drawn upon to make
arguments for why a decision was made. We propose an approach that takes the learned
LSTM embeddings from the prediction stage and uses these to build a case-base to provide
explanations that can be visualised. We will also use Integrated Gradients and NLG to provide
further explanation by means of a report.
      </p>
    </sec>
    <sec id="sec-3">
      <title>2. Methodology</title>
      <sec id="sec-3-1">
        <title>2.1. Predicting Temperature with LSTM</title>
        <p>We use the default prediction model provided for the challenge which consists of two
bidirectional LSTM layers.</p>
      </sec>
      <sec id="sec-3-2">
        <title>2.2. Building the Twin LSTM-CBR System</title>
        <p>
          We use the Clood CBR 2 system as the twin. Clood CBR is a distributed CBR system which
supports high scalability. The system has a micro-service architecture which splits an application
into a set of smaller and interconnected services that scale to meet varying demands [
          <xref ref-type="bibr" rid="ref9">9</xref>
          ]. The
output embeddings from the final LSTM layer are extracted for each input row and are fed into
the Clood CBR system to form the case base. For a given row and LSTM prediction that we
want to explain, we query the Clood system using the nearest-neighbors approach. This gives
us the top three similar rows based on the embedding similarity. To establish the quality of the
twin, we compare our approach to a baseline twin system that uses the raw features instead of
the embeddings.
        </p>
        <p>We use Mean Absolute Error (MAE) as the evaluation metric to compare the two twin systems
as it is one of the common measures of forecasting error in time-series analysis. MAE measures
the absolute diference |  −   | between a prediction   and an actual observation   where the
individual diferences share the equal weight. The 3 nearest neighbours for a prediction are
retrieved from the case-base and the mean MAE is calculated between their predicted values.
Comparing the mean gives an indication of whether the cases are better aligned through the
use of embeddings — or not.</p>
        <p>=</p>
        <p>∑=1 |  −   |

(1)</p>
      </sec>
      <sec id="sec-3-3">
        <title>2.3. Generating Explanations</title>
        <p>A template-based Natural Language Generation approach to generate explanations was taken.
Based on Integrated Gradients, we extracted feature importance attributions for each day over
three diferent time frames. These were as follows: the entire two-week period; the final week;
and the final three days. The prediction, feature attributions and general information from
the dataset were then slotted into the template to produce a weather forecast report (as seen
in Figure 1). Furthermore, to aid interpretability, we add visualisations (emojis, graphics and
colour) to our textual explanation to indicate the weather prediction.</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>3. Results</title>
      <sec id="sec-4-1">
        <title>3.1. LSTM-CBR Twin Evaluation</title>
        <p>The results in Table 1 prove that the twin LSTM-CBR system based on embeddings performs
better than a twin modelled around raw features. The embedded approach achieved an MAE of
0.066 degrees whereas the raw features approach achieved an MAE of 0.133 degrees. This means
that using embeddings, the twin system is able to find better nearest-neighbours, therefore can
produce better explanations.</p>
      </sec>
      <sec id="sec-4-2">
        <title>3.2. Nearest Neighbors Explanations Using LSTM-CBR Twin</title>
        <p>In Figures 2 and 3, we visualize the progression of the average humidity and pressure,
respectively, over the previous 14 days for a sample query row, top 3 nearest neighbors and 3 randomly
selected rows. As can be seen, the query and the nearest neighbors have a similar progression
of the predictor variables as well as close predictions for the subsequent day temperature.</p>
        <sec id="sec-4-2-1">
          <title>Embedded Features</title>
          <p>0.066</p>
        </sec>
        <sec id="sec-4-2-2">
          <title>Raw Features</title>
          <p>0.133</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>4. Conclusion</title>
      <p>In this paper we explore two methods for explaining LSTM predictions of weather forecast. We
ifrst propose an LSTM-CBR twin system that explains a prediction using nearest-neighbors
and then visualises the explanations through parallel coordinate plots. We show that using
the LSTM embeddings can result in better twinning compared to raw features. As a second
explanation method, we make use of feature attributions from Integrated Gradients in text
templates to generate text explanations. We note that a current limitation of the twin system is
that it considers all days as equally important when retrieving the nearest-neighbors. Therefore,
future work could explore diferent weighting strategies (such as weights derived from feature
attributions) for strengthening the twin system. A second limitation lies with the need to provide
a template for the NLG-based explanation, which would difer between domains. Further work
could explore the application of more advanced NLG techniques that allow the inference of
templates in a new domain.</p>
    </sec>
    <sec id="sec-6">
      <title>Acknowledgments</title>
      <p>We would like to thank Professor Nirmalie Wiratunga for motivating us to take part in this
challenge and for her advise throughout the competition.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>P.</given-names>
            <surname>Hewage</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Behera</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Trovati</surname>
          </string-name>
          , E. Pereira,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ghahremani</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Palmieri</surname>
          </string-name>
          , Y. Liu,
          <article-title>Temporal convolutional neural (tcn) network for an efective weather forecasting using time-series data from the local weather station</article-title>
          ,
          <source>Soft Computing</source>
          <volume>24</volume>
          (
          <year>2020</year>
          )
          <fpage>16453</fpage>
          -
          <lpage>16482</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>D. N.</given-names>
            <surname>Fente</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. Kumar</given-names>
            <surname>Singh</surname>
          </string-name>
          ,
          <article-title>Weather forecasting using artificial neural network</article-title>
          , in: 2018
          <source>Second International Conference on Inventive Communication and Computational Technologies (ICICCT)</source>
          ,
          <year>2018</year>
          , pp.
          <fpage>1757</fpage>
          -
          <lpage>1761</lpage>
          . doi:
          <volume>10</volume>
          .1109/ICICCT.
          <year>2018</year>
          .
          <volume>8473167</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>S.</given-names>
            <surname>Hochreiter</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J.</given-names>
            <surname>Schmidhuber</surname>
          </string-name>
          ,
          <article-title>Long short-term memory</article-title>
          ,
          <source>Neural computation 9</source>
          (
          <year>1997</year>
          )
          <fpage>1735</fpage>
          -
          <lpage>1780</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>M.</given-names>
            <surname>Sundararajan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Taly</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Q.</given-names>
            <surname>Yan</surname>
          </string-name>
          ,
          <article-title>Axiomatic attribution for deep networks</article-title>
          ,
          <source>CoRR abs/1703</source>
          .01365 (
          <year>2017</year>
          ). URL: http://arxiv.org/abs/1703.01365. arXiv:
          <volume>1703</volume>
          .
          <fpage>01365</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>T.</given-names>
            <surname>Rojat</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Puget</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Filliat</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. Del</given-names>
            <surname>Ser</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Gelin</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Díaz-Rodríguez</surname>
          </string-name>
          ,
          <article-title>Explainable artificial intelligence (xai) on timeseries data: A survey</article-title>
          ,
          <source>arXiv preprint arXiv:2104.00950</source>
          (
          <year>2021</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>U.</given-names>
            <surname>Schlegel</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H.</given-names>
            <surname>Arnout</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>El-Assady</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Oelke</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. A.</given-names>
            <surname>Keim</surname>
          </string-name>
          ,
          <article-title>Towards a rigorous evaluation of xai methods on time series</article-title>
          , in: 2019 IEEE/CVF International Conference on Computer Vision Workshop (ICCVW),
          <year>2019</year>
          , pp.
          <fpage>4197</fpage>
          -
          <lpage>4201</lpage>
          . doi:
          <volume>10</volume>
          .1109/ICCVW.
          <year>2019</year>
          .
          <volume>00516</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>I. A.</given-names>
            <surname>Abdellaoui</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Mehrkanoon</surname>
          </string-name>
          ,
          <article-title>Deep multi-stations weather forecasting: explainable recurrent convolutional neural networks</article-title>
          ,
          <year>2020</year>
          . URL: https://arxiv.org/abs/
          <year>2009</year>
          .11239. doi:
          <volume>10</volume>
          .48550/ARXIV.
          <year>2009</year>
          .
          <volume>11239</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>M.</given-names>
            <surname>Zdravković</surname>
          </string-name>
          , I. Ćirić,
          <string-name>
            <given-names>M.</given-names>
            <surname>Ignjatović</surname>
          </string-name>
          ,
          <article-title>Explainable heat demand forecasting for the novel control strategies of district heating systems</article-title>
          , Annual Reviews in Control (
          <year>2022</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>I.</given-names>
            <surname>Nkisi-Orji</surname>
          </string-name>
          ,
          <string-name>
            <given-names>N.</given-names>
            <surname>Wiratunga</surname>
          </string-name>
          ,
          <string-name>
            <given-names>C.</given-names>
            <surname>Palihawadana</surname>
          </string-name>
          ,
          <string-name>
            <given-names>J. A.</given-names>
            <surname>Recio-García</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Corsar</surname>
          </string-name>
          ,
          <article-title>Clood cbr: Towards microservices oriented case-based reasoning</article-title>
          , in: I. Watson, R. Weber (Eds.),
          <source>CaseBased Reasoning Research and Development</source>
          , Springer International Publishing, Cham,
          <year>2020</year>
          , pp.
          <fpage>129</fpage>
          -
          <lpage>143</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>