<!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>
      <issn pub-type="ppub">1613-0073</issn>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Heterogeneous Contextual Data for Enhanced Time Series Analysis</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Saifullah Burero</string-name>
          <email>saifullah.burero@student.unibz.it</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>Figure 1: Importance of Context</institution>
        </aff>
        <aff id="aff1">
          <label>1</label>
          <institution>Free University of Bozen-Bolzano</institution>
          ,
          <country country="IT">Italy</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2025</year>
      </pub-date>
      <fpage>25</fpage>
      <lpage>28</lpage>
      <abstract>
        <p>In the rapidly evolving industrial landscape, sensors are integral to automation applications. Capturing and analyzing the vast amount of time series data is crucial for optimizing processes. However, analyzing this sensor data in isolation presents challenges, particularly in time series analysis, due to the influence of various external contextual factors that are not always apparent. Integrating these contextual factors with time series data is essential for time series analysis. However, these contextual factors are often heterogeneous in the time dimension due to the diverse nature of the data, makes integration challenging. Therefor, as a part of this PhD research that is currently at the beginning of the second year, we aim to introduce a systematic approach for integrating contextual factors with heterogeneous time dimensions. This integration enables the transformation of data with heterogeneous time dimensions into a format that can be efectively processed by machine learning and deep learning models for time series analysis. We use Water Distribution Systems (WDSs) as a representative use case and aim to demonstrate how this integration enhances the accuracy and reliability of time series analysis. time series analysis, heterogeneous time dimensions, time series forecasting, anomaly detection Workshop Proceedings</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Introduction</title>
      <p>
        In this work, we use Water Distribution Systems (WDSs)
as a representative application use case, where sensors are
employed for monitoring the consumption of water. These
observations serve as crucial inputs for, e.g., detecting water
losses or estimating the water demand. WDSs are equipped
with networks of sensors and control units, such as flow
and pressure sensors, to ensure eficient resource
management [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. These patterns can be analyzed and used to
forecast the water consumption, helping to fulfill water demand,
and to detect possible losses. However analyzing these
patterns solely on sensor measurements can be complex, as
various contextual factors influence consumption patterns
and/or measurements, such as maintenance, sensor
calibration, weather, yearly seasons, tourist trends, temperature
etc. These factors pose challenges for machine learning
and deep learning models for time series analysis, as they
may not be apparent in the data. Figure 1 highlights the
importance of contextual information when analyzing time
series data, where water consumption data from water
distribution system based in Trentino, Italy is reported. The
data is segmented and color coded to highlight diferent
consumption patterns. Green segments illustrate
“regular” consumption, i.e., low consumption during night with
peaks in the morning, afternoon, and evening. Red
segments indicate the impact of weekends, pattern that are
also observed during bank holidays, reflecting altered
consumption behavior during these periods as compared to
regular days. Yellow segments highlight deviations likely
caused by scheduled maintenance, which occurs monthly
from the 7th to the 10th. Additionally, in the lower part
of the figure, highlighted in orange, an extended period
where the consumption behavior diverges from the normal
behavior is highlighted, potentially due to external factors
like school vacations, tourist trends, and/or seasonal
temperature changes. Although these external factors are not
directly visible, their influences can be inferred, making it
Published in the Proceedings of the Workshops of the EDBT/ICDT 2025
tends to increase the longer the drought persists. In WDSs
and in many industrial domains such contextual factors are
characterized by heterogeneity in the time dimension. We
have identified four distinct types: static contextual data that
is not changing with time, such as sensor location, sensor
sensitivity and other specifications etc., interval contextual
data that occurs over a period of time, such as drought,
periods of hight tourism, vacations etc., event contextual data
that happens at possibly irregular time points, such as bank
holidays, sensor replacements, calibration, cleaning etc., and
secondary time series contextual data, that are recorded at a
regular frequency, such as temperature, humidity, pressure
CEUR
      </p>
      <p>ceur-ws.org
etc. These external contextual factors play a crucial role
in shaping how resources are utilized and can significantly
impact the accuracy of forecasting and anomaly detection
in systems like WDSs. An efective integration of this
diverse mixture of data enhances the decision making process
by providing a comprehensive understanding of processes.
The main objective of this PhD will be on the systematic
integration of contextual information with heterogeneous
time dimensions (static, interval, event, and secondary time
series) for the efective analysis of time series, i.e., missing
values imputation, anomaly detection and forecasting.</p>
    </sec>
    <sec id="sec-2">
      <title>2. Related Work</title>
      <p>
        According to a recent survey on anomaly detection in the
IoT and IIoT domain by Rodríguez et al. [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ] that reviewed
99 articles only 8% consider context aware information.
Recent studies [
        <xref ref-type="bibr" rid="ref4 ref5 ref6 ref7">4, 5, 6, 7</xref>
        ] in contextual anomaly detection
application explore combining contextual and behavioral
features for improved contextual anomaly detection. These
approaches categorize features into contextual and
behavioral depending upon domain knowledge, with clustering
used to establish context and separate models built for each
group.
      </p>
      <p>
        Daniel et al. [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ] developed a three-stage model
incorporating temporal features and a sliding window technique
for feature representation. Rozhin Yasaei et al. [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ]
proposed an RNN-based model for clustering sensor
behaviors, using a consensus algorithm for anomaly localization.
Kosek et al. [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ] focused on detecting malicious voltage
control actions in the power grid with a deep neural network
approach.
      </p>
      <p>Most of the existing works consider internal contexts
while analyzing sensory data, such as day, time, yearly
seasons, months, and years etc., that are typically uniform and
consistent and easily handled, as it is derived from the time
dimension of the time series data. On the other hand,
integrating external context is more challenging and requires
a transformation because the information might be
represented using a diferent time dimension and often lacks
uniformity.</p>
    </sec>
    <sec id="sec-3">
      <title>3. Objective and Research Questions</title>
      <p>The main objective of this thesis is to enhance the
performance of machine learning and deep learning models for
time series analysis by integrating contextual information
with heterogeneous time dimensions together with sensory
readings. By acknowledging the crucial role of context
in time series analysis, this research endeavors to develop
novel methodologies that leverage contextual information to
significantly enhance the accuracy and robustness of these
models. Through rigorous experimentation and analysis,
this study aims to establish a deeper understanding of how
contextual information can be efectively integrated into
existing frameworks, thereby advancing the state-of-the-art
in time series analysis within diverse domains. The main
research questions for the PhD are as follows.</p>
      <p>RQ1 How to combine relevant contextual information with
heterogeneous time dimensions and time series data
to build data driven models for time series analysis,
such as anomaly detection and forecasting?
RQ2 How to detect patterns in time series data that deviate
in specific contexts using data driven approaches?
RQ3 How to build a data driven model that efectively
handles heterogeneity and adapts to time series
dynamics?</p>
    </sec>
    <sec id="sec-4">
      <title>4. Methodology</title>
      <p>Machine learning and deep learning techniques for time
series analysis, such as Random Forest, Support Vector
Machine (SVM), Long Short Term Memory (LSTM) etc., require
input data with a uniform or homogeneous format, i.e,
numerical values (vectors) recorded over regular time steps.
However, contextual information with heterogeneous time
dimensions lacks this uniformity. The efective integration
of data with heterogeneous time dimensions involves
distinct strategies for each type, and we illustrate it on the
example of WDSs.</p>
      <sec id="sec-4-1">
        <title>4.1.1. Time Series Data</title>
        <p>WDSs utilize networks of sensors such as flow sensor to
monitoring the consumption of water, that generate time
series data recorded either regularly or irregularly, with
varying sampling frequencies. Along with consumption
patterns (primary time series) to be analyzed, secondary
time series may also be considered, such as temperature
or rainfall. For example, water consumption is highly
correlated with temperature, which is also time series data.
Tables 1 and 2 exemplify time series data collected from a
information is valid. In the domain of WDSs, interval data
represents periods, such as tourism seasons that may or
may not occurring annually over some period of time. It is
crucial to consider tourism related information as it
significantly influences water consumption. During the peak of a
tourism season, water consumption increases substantially
compared to of-season periods. and therefore,
incorporating tourism seasonality into the analysis is essential for
accurately understanding the water consumption patterns.
water flow sensor and a temperature sensor. This data can
be aligned with specific timestamps to ensure consistency,
typically achieved through interpolation or resampling to
establish regular time steps.
Static data, as illustrated in Table 3, remains constant over
time and may be associated with every time point,
maintaining its validity throughout the period of interest. In WDSs,
static data, such as sensor location and characteristics play
a crucial role for cross sensor analysis. For instance the
location of sensors can provide valuable insights into the
population distribution of diferent regions, which can
directly influence factors such as water consumption. Areas
with higher population density are likely to exhibit
diferent consumption patterns compared to sparsely populated
regions. By considering sensor locations, models can better
capture and interpret variations in water consumption data,
leading to more accurate and informed analyses in decision
making.
Event data as illustrated in Table 4, captures specific time
points of an event occurrence. Such data may be integrated
by marking relevant time points with event indicators,
offering a comprehensive view of discrete events over time.
In WDSs, event data captures irregular occurrences such as
sensor calibration, cleaning, replacement or bank holidays.
Some of this events can directly influence sensor readings,
potentially leading to inaccuracies in interpreting water
consumption data. Therefore, it is crucial to include such type
of information for accurate analysis of water consumption.</p>
      </sec>
      <sec id="sec-4-2">
        <title>4.1.4. Interval Data</title>
        <p>Interval data as illustrated in Table 5, are characterized by
start and end time points for which a particular contextual</p>
      </sec>
      <sec id="sec-4-3">
        <title>Period</title>
        <p>01-06-2023—30-10-2023
01-07-2023—30-10-2023</p>
      </sec>
      <sec id="sec-4-4">
        <title>Tourist Trend</title>
        <p>high
high</p>
        <sec id="sec-4-4-1">
          <title>4.2. Homogeneous Data</title>
          <p>During the data representation stage, data with
heterogeneous time dimensions is transformed into a uniform or
homogeneous format suitable for machine learning models
that require numerical vectors over regular time steps. This
stage following the sampling rate of the main time series or
user parametrization extracts diferent values from the data
with heterogeneous time dimensions using simple value
extraction, diferent aggregation functions, or one-hot
encoding (similar to resampling). For instance at each time
step, for constant data it may just extract a value or a one-hot
encoding, for event data it may extract a one-hot encoding
and/or count of events, for interval data it may extract a
count and/or an indicator if a period just started or ended,
and for secondary time series it may apply a resampling
based on the new frequency. This initial transformation
ensures that data has the same homogeneous
representation, such as for instance in Table 6 (do not consider the last
two columns for now). Each row in the table indicates to
a specific time step, while each column represents values
extracted from the heterogeneous data. Figure 3 illustrates
this transformation process to homogeneous data
graphically, making it compatible with machine learning models.
This step can be achieved through a combination of
densification and aggregation, and some of these values extracted
at each time step will be used later to extract features that
are related to previous (cross) time steps.</p>
          <p>Tohhhullloooiiirgggwwwihhhsm Mrcceaaapcillllneiiabbtanncrreneooaanmittnaiiooegnnnncte Las3t003000Cal. Dur. high020201 tourism</p>
        </sec>
        <sec id="sec-4-4-2">
          <title>4.3. Feature Extraction</title>
          <p>After data representation, the subsequent step involves
feature extraction, where features from the generated values
and primary time series are extracted. Similarly to data
representation this stage is sensitive to the type of
homogeneous time dimension from which the values were extracted.
For instance, for event data, the number of events in the
past or elapsed time since a specific event last occurred may
be generated, e.g., see “Last Cal.” in Table 6 that records the
number of hours since the last calibration event. For
interval data the time since a period last ended or the duration
so far may be generated, e.g., see “Dur. high tourism” in
Table 6 that records the duration of high tourism in days.
These additional features provide information across time
to the model and help setting a given time step into context,
ultimately improving model performance. For instance,
sensor readings with very high values for the last calibration
may be subject to higher variability or outliers, or water
consumptions deep in the tourism season may be generally
very high. While the previous stage was achieved through a
combination of densification and aggregation, this step can
generated through window functions aggregating over
previously generated values. The key challenge is to identify
the required sequence of dependencies.</p>
        </sec>
        <sec id="sec-4-4-3">
          <title>4.4. Feature Selection</title>
          <p>Feature extraction may yield hundreds of features and at
this stage it becomes imperative to select features with high
importance. Feature selection is indeed crucial for several
reasons, including reducing computational complexity and
mitigating the risk of overfitting models. Features are
chosen based on the model’s performance, and depending on
the model’s output, features are iteratively selected,
continuing this process recursively during feature selection. This
iterative approach enhance the algorithm’s explainability,
identifying which features are indeed valuable for decision
making.</p>
        </sec>
        <sec id="sec-4-4-4">
          <title>4.5. Anomaly Detection Model</title>
          <p>After feature extraction and selection, the final step involves
the development of machine learning and deep learning
models for multivariate time series analysis using the
example of anomaly detection. To validate the impact of the
integrated contextual information in the previous steps, the
performance evaluation is twofold. Firstly, model training
without incorporating contextual data to establish a baseline
performance solely based on available features or signals.
Secondly, contextual features are integrated to observe their
impact on the model’s predictive capabilities. Comparing
the model’s performance in both settings facilitates
understanding of how contextual information enhances predictive
accuracy and robustness.</p>
        </sec>
      </sec>
    </sec>
    <sec id="sec-5">
      <title>5. Conclusion</title>
      <p>Sensor readings often display complex properties influenced
by numerous contextual factors. Integrating contextual
factors in time series analysis is crucial for accurately
interpreting data pattern and identifying factors behind variations.
By incorporating contextual factors, we aim to improve
performance of machine learning and deep learning models for
time series analysis. In this PhD research, currently at the
beginning of the second year, we have identified four
categories of contextual information with heterogeneous time
dimensions. Based on these, we will develop a systematic
data management approach for the efective and eficient
integration of contextual features for time series analysis.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>M.</given-names>
            <surname>Mutchek</surname>
          </string-name>
          ,
          <string-name>
            <given-names>E.</given-names>
            <surname>Williams</surname>
          </string-name>
          ,
          <article-title>Moving towards sustainable and resilient smart water grids</article-title>
          ,
          <source>Challenges</source>
          <volume>5</volume>
          (
          <year>2014</year>
          )
          <fpage>123</fpage>
          -
          <lpage>137</lpage>
          . doi:
          <volume>10</volume>
          .3390/challe5010123.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <given-names>A.</given-names>
            <surname>Zanfei</surname>
          </string-name>
          ,
          <string-name>
            <given-names>B. M.</given-names>
            <surname>Brentan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A.</given-names>
            <surname>Menapace</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Righetti</surname>
          </string-name>
          ,
          <article-title>A short-term water demand forecasting model using multivariate long short-term memory with meteorological data</article-title>
          ,
          <source>Journal of Hydroinformatics</source>
          <volume>24</volume>
          (
          <year>2022</year>
          )
          <fpage>1053</fpage>
          -
          <lpage>1065</lpage>
          . doi:
          <volume>10</volume>
          .2166/hydro.
          <year>2022</year>
          .
          <volume>055</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>M.</given-names>
            <surname>Rodríguez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D. P.</given-names>
            <surname>Tobón</surname>
          </string-name>
          ,
          <string-name>
            <given-names>D.</given-names>
            <surname>Múnera</surname>
          </string-name>
          ,
          <article-title>Anomaly classification in industrial internet of things: A review</article-title>
          ,
          <source>Intell. Syst. Appl</source>
          .
          <volume>18</volume>
          (
          <year>2023</year>
          )
          <article-title>200232</article-title>
          . doi:
          <volume>10</volume>
          .1016/J. ISWA.
          <year>2023</year>
          .
          <volume>200232</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <given-names>E.</given-names>
            <surname>Calikus</surname>
          </string-name>
          ,
          <string-name>
            <given-names>S.</given-names>
            <surname>Nowaczyk</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M.</given-names>
            <surname>Bouguelia</surname>
          </string-name>
          ,
          <string-name>
            <given-names>O.</given-names>
            <surname>Dikmen</surname>
          </string-name>
          ,
          <article-title>Wisdom of the contexts: active ensemble learning for contextual anomaly detection</article-title>
          ,
          <source>Data Min. Knowl. Discov</source>
          .
          <volume>36</volume>
          (
          <year>2022</year>
          )
          <fpage>2410</fpage>
          -
          <lpage>2458</lpage>
          . doi:
          <volume>10</volume>
          .1007/ S10618- 022- 00868- 7.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>M. A.</given-names>
            <surname>Hayes</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. A. M.</given-names>
            <surname>Capretz</surname>
          </string-name>
          ,
          <article-title>Contextual anomaly detection framework for big sensor data</article-title>
          ,
          <source>J. Big Data</source>
          <volume>2</volume>
          (
          <year>2015</year>
          )
          <article-title>2</article-title>
          . doi:
          <volume>10</volume>
          .1186/S40537- 014- 0011- Y.
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>Z.</given-names>
            <surname>Li</surname>
          </string-name>
          ,
          <string-name>
            <surname>M. van Leeuwen</surname>
          </string-name>
          ,
          <article-title>Explainable contextual anomaly detection using quantile regression forests</article-title>
          ,
          <source>Data Min. Knowl. Discov</source>
          .
          <volume>37</volume>
          (
          <year>2023</year>
          )
          <fpage>2517</fpage>
          -
          <lpage>2563</lpage>
          . doi:
          <volume>10</volume>
          . 1007/S10618- 023- 00967- Z.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <given-names>Y.</given-names>
            <surname>Shulman</surname>
          </string-name>
          ,
          <article-title>Unsupervised contextual anomaly detection using joint deep variational generative models</article-title>
          , CoRR abs/
          <year>1904</year>
          .00548 (
          <year>2019</year>
          ). arXiv:
          <year>1904</year>
          .00548.
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <given-names>D. B.</given-names>
            <surname>Araya</surname>
          </string-name>
          ,
          <string-name>
            <given-names>K.</given-names>
            <surname>Grolinger</surname>
          </string-name>
          ,
          <string-name>
            <given-names>H. F.</given-names>
            <surname>ElYamany</surname>
          </string-name>
          ,
          <string-name>
            <surname>M. A. M. Capretz</surname>
          </string-name>
          , G. T. Bitsuamlak,
          <article-title>Collective contextual anomaly detection framework for smart buildings</article-title>
          , in: IJCNN, IEEE,
          <year>2016</year>
          , pp.
          <fpage>511</fpage>
          -
          <lpage>518</lpage>
          . doi:
          <volume>10</volume>
          .1109/IJCNN.
          <year>2016</year>
          .
          <volume>7727242</volume>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <given-names>R.</given-names>
            <surname>Yasaei</surname>
          </string-name>
          ,
          <string-name>
            <given-names>F.</given-names>
            <surname>Hernandez</surname>
          </string-name>
          ,
          <string-name>
            <given-names>M. A. A.</given-names>
            <surname>Faruque</surname>
          </string-name>
          , Iot-cad:
          <article-title>Context-aware adaptive anomaly detection in iot systems through sensor association</article-title>
          , in: IEEE/ACM ICCAD, IEEE,
          <year>2020</year>
          , pp.
          <volume>9</volume>
          :
          <fpage>1</fpage>
          -
          <issue>9</issue>
          :9. doi:
          <volume>10</volume>
          .1145/3400302. 3415672.
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <surname>A. M. Kosek</surname>
          </string-name>
          ,
          <article-title>Contextual anomaly detection for cyberphysical security in smart grids based on an artificial neural network model, in: CPSR-</article-title>
          <string-name>
            <surname>SG</surname>
          </string-name>
          ,
          <year>2016</year>
          , pp.
          <fpage>1</fpage>
          -
          <lpage>6</lpage>
          . doi:
          <volume>10</volume>
          .1109/CPSRSG.
          <year>2016</year>
          .
          <volume>7684103</volume>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>