Source-linked AI summary

LSTM-Autoencoder based Anomaly Detection for Indoor Air Quality Time Series Data

Yuanyuan Wei, Julian Jang-Jaccard, Wen Xu, Fariza Sabrina, Seyit Camtepe, Mikael Boulic

arXiv:2204.06701v1cs.LGcs.CR

TL;DR

IAQ anomaly detection is challenging because traditional statistical and shallow machine-learning approaches may not capture correlations across multiple time-series points. The paper combines LSTM and Autoencoder components to learn long-term dependencies and set anomaly thresholds from reconstruction losses. On a real-world Dunedin CO2 dataset, the model achieved 99.50% detection accuracy and outperformed similar models.

  • Problem

    Traditional statistical and shallow machine-learning approaches could not detect IAQ anomalies involving correlations across several data points, called long-term dependencies.

  • Method

    The proposed hybrid model combines LSTM-based sequence encoding and decoding with Autoencoder reconstruction loss to detect IAQ anomalies.

  • Results

    99.50% detection accuracy was achieved on the Dunedin CO2 time-series dataset, outperforming other similar models.

  • Takeaways & Limitations

    The model effectively detected anomalous CO2 readings in a dataset collected through real-world school deployment.

Abstract

from arXiv · show

Anomaly detection for indoor air quality (IAQ) data has become an important area of research as the quality of air is closely related to human health and well-being. However, traditional statistics and shallow machine learning-based approaches in anomaly detection in the IAQ area could not detect anomalies involving the observation of correlations across several data points (i.e., often referred to as long-term dependences). We propose a hybrid deep learning model that combines LSTM with Autoencoder for anomaly detection tasks in IAQ to address this issue. In our approach, the LSTM network is comprised of multiple LSTM cells that work with each other to learn the long-term dependences of the data in a time-series sequence. Autoencoder identifies the optimal threshold based on the reconstruction loss rates evaluated on every data across all time-series sequences. Our experimental results, based on the Dunedin CO2 time-series dataset obtained through a real-world deployment of the schools in New Zealand, demonstrate a very high and robust accuracy rate (99.50%) that outperforms other similar models.

I. INTRODUCTION

Indoor air quality monitoring is important but difficult because IAQ readings fluctuate, data quality can be compromised, and traditional approaches have limited ability to capture long-term dependencies. The paper proposes combining LSTM and Autoencoder methods for IAQ anomaly detection and evaluates the approach on real-world school data.

  • IAQ monitoring matters for health, productivity, work efficiency, and children’s well-being in schools.
  • Large-scale school monitoring has been costly, motivating low-cost sensor platforms such as SKOMOBO.
  • Fluctuating readings, non-stationary environments, and contamination events make IAQ data quality and anomaly detection challenging.
  • The proposed hybrid model combines LSTM and Autoencoder capabilities to detect anomalous IAQ data using long-term dependencies.
  • The model uses multiple LSTM units to learn time-series correlations and Autoencoder reconstruction errors to identify an anomaly threshold.
  • 99.50% detection accuracy was reported for the proposed model, which outperformed other similar approaches.

III. PRELIMINARIES

LSTM units maintain and regulate information across time by combining cell state, hidden state, input, forget, and output gates. These mechanisms allow the network to preserve relevant long-term information while processing sequential inputs.

  • LSTM extends recurrent neural networks with long-term memory that makes previous information available to the current neural node.
  • An LSTM unit contains a cell plus input, output, and forget gates that regulate information flow.
  • The cell state stores long-term information, while the hidden state represents the previous output and short-term memory.
  • The forget gate uses the previous hidden state and current input to assign values from 0 to 1 to retained cell-state components.
  • The input gate evaluates new information, determines what should be retained, and updates the cell state through two processes.
  • The output gate uses the updated cell state, previous hidden state, and current input to produce a new hidden state.
  • Each new cell and hidden state becomes the corresponding previous state for the next LSTM unit as sequence processing continues.

B. Autoencoder (AE)

An Autoencoder learns compact representations of unlabeled data through encoding, decoding, and reconstruction. In this paper’s anomaly-detection use, reconstruction loss measures deviations between inputs and reconstructions.

  • An Autoencoder is an unsupervised neural network that learns efficient codings of unlabeled data while removing insignificant features.
  • Encoding maps a high-dimensional input x ∈ R^m to a low-dimensional bottleneck representation h.
  • Decoding transforms the bottleneck representation h back into a reconstructed input x̂.
  • Reconstruction loss minimizes the difference between the input and output and is used for anomaly detection.
  • The model computes reconstruction loss across time-series samples for anomaly-detection processing.

IV. METHODOLOGY

The proposed methodology combines LSTM and Autoencoder components to detect anomalies in time-series data through sequence creation, LSTM encoding and decoding, and anomaly detection.

  • The methodology uses four stages: creating input sequences, LSTM encoding, LSTM decoding, and anomaly detection.

A. LSTM-Autoencoder

The proposed LSTM-Autoencoder combines LSTM sequence modeling with autoencoder reconstruction to preserve long-term dependencies and detect anomalous IAQ observations. It encodes time windows into a latent representation, reconstructs them, and uses reconstruction loss to set an anomaly threshold.

  • A. LSTM-Autoencoder: The encoder converts fixed-length, m-feature time windows into lower-dimensional representations while retaining dependencies across timesteps.Input sequences are reshaped into a two-dimensional samples-by-timesteps array before encoding.
  • A. LSTM-Autoencoder: Multiple LSTM units process samples sequentially so the encoder can learn relevant long-term correlations within each time series.The encoder is described as a sequence-folding layer whose LSTM cells pass information across timesteps.
  • A. LSTM-Autoencoder: The decoder unfolds the latent representation and reconstructs the original sequence using LSTM cells and a TimeDistributed layer.The decoder output has the same 10×1 shape as the input in the described architecture.
  • A. LSTM-Autoencoder: The maximum reconstruction error from normal training data is used as the threshold, and observations exceeding it are labeled anomalies.The described example sets the threshold to 0.1 during testing.
  • A. LSTM-Autoencoder: Reconstruction loss is computed for samples appearing across overlapping time-series sequences, allowing errors to be associated with individual data points.The example forms sequences [x1, x2, x3], [x2, x3, x4], and [x3, x4, x5] and reconstructs each sequence.

B. Algorithm

The algorithm sequences training and testing data, trains the LSTM-Autoencoder to minimize reconstruction error, derives a threshold from training errors, and applies it to testing data. Each test point is classified according to whether its reconstruction loss exceeds that threshold.

  • B. Algorithm: During testing, a data point is labeled anomalous when its reconstruction loss exceeds η; otherwise, it is labeled normal.The trained encoder and decoder process test sequences containing all ranges of CO2 values.
  • B. Algorithm: The algorithm reshapes training and testing samples into overlapping time-series sequences using a fixed timestep window.The stated training configuration uses sequences containing 10 CO2 samples across 10 timesteps.
  • B. Algorithm: The LSTM-Autoencoder is trained on each sequence to minimize reconstruction error between the input and reconstructed sequence.Training updates model parameters using the reconstruction loss, with MAE used as the reconstruction error function.
  • B. Algorithm: The reconstruction loss for each sample is aggregated across the time-series sequences in which that sample appears.The algorithm averages nonzero reconstruction errors associated with each data point.
  • B. Algorithm: The threshold η is set to the maximum reconstruction loss obtained from the training sequences.This threshold is computed after the training-set reconstruction errors are calculated.

V. DATA AND DATA PROCESSING

This section introduces the study’s dataset and preprocessing discussion. It states that the paper describes the data and the preprocessing strategies used.

  • V. DATA AND DATA PROCESSING: The paper discusses the dataset used in the study.The passage introduces the dataset description as part of the study materials.
  • V. DATA AND DATA PROCESSING: The paper discusses the data preprocessing strategies adopted for the study.The passage explicitly mentions preprocessing alongside the dataset description.
  • V. DATA AND DATA PROCESSING: The section covers both data details and preprocessing strategies.The passage groups these two topics together for discussion.

A. Dunedin CO2 Dataset

The Dunedin CO2 dataset was collected through a real-world school deployment using SKOMOBO units over four months at one-minute intervals. It contains 247,263 CO2 readings with fluctuations associated with classroom occupancy and school breaks.

  • A. Dunedin CO2 Dataset: 74 SKOMOBO units were deployed across primary and secondary schools in Dunedin, New Zealand.The deployment took place in South Island, New Zealand.
  • A. Dunedin CO2 Dataset: CO2 readings were collected at one-minute intervals from 01/01/2018 through 04/30/2018.The collection period covered four months.
  • A. Dunedin CO2 Dataset: 247,263 CO2 readings were included in the dataset.The passage reports this as the total number of CO2 readings.
  • A. Dunedin CO2 Dataset: CO2 levels remained unchanged during school breaks and fluctuated substantially when students occupied classrooms.Some of the observed fluctuations were considered potentially anomalous.

B. Data Preprocessing

The preprocessing pipeline cleans CO2 records, separates training and testing periods, labels readings using a sigma-based normal range, and normalizes values before modeling.

  • Data cleaning: 171,067 records remained after duplicate removal, invalid timestamp filtering, and replacement of empty or NaN CO2 readings with 0.Records with legitimate timestamps but missing CO2 values were retained and assigned numeric zero.
  • Training dataset: The training data retained CO2 readings within the normal range identified using the 2-sigma rule.Three months of data were screened, and readings beyond the calculated 2-sigma range were removed.
  • Test dataset: The test set used April 2018 data containing all CO2 ranges, with 0 assigned to normal readings and 1 to readings outside the 2-sigma range.These labels were used only to evaluate anomaly-detection performance.
  • Data normalization: Standard scalar normalization transformed CO2 values to the [0-1] range using each value’s mean and standard deviation.The normalization was intended to reduce scale impacts, execution time, and training complexity.

VI. EVALUATIONS

The evaluation uses classification metrics and confusion-matrix terms to assess anomaly-detection performance, alongside the reported experimental setup and training parameters.

  • Evaluation metrics: The model was evaluated using accuracy, precision, recall, and F1 score.The confusion matrix provides the basis for these classification measures.
  • Confusion matrix: True positives and true negatives denote correctly classified anomalous and normal points, respectively.These counts distinguish correct anomaly detections from correct normal classifications.
  • Confusion matrix: False positives are normal points classified as anomalous, whereas false negatives are anomalous points classified as normal.These error types capture the two directions of misclassification.
  • Evaluation metrics: Accuracy is calculated as (TP + TN) divided by (TP + TN + FP + FN).The reported formula combines correct and incorrect classifications across the confusion matrix.
  • Evaluation metrics: AUC measures the area under the ROC curve across thresholds, using true-positive rate against false-positive rate.The ROC representation summarizes the trade-off between these rates.

C. Results

The experiments examine training behavior and model architecture sensitivity. Training and validation losses converge after approximately eight epochs, while the one-hidden-layer architecture achieves the highest reported F1-score.

  • Training: Approximately 0.07% average validation loss matched the training loss after 8 epochs.The authors interpret this convergence as indicating neither overfitting nor underfitting.
  • Impact of Model Architecture: The 1-hidden-layer architecture achieved an F1-score above 94.55%, compared with 93.48% for 2 layers and 93.31% for 3 layers.The evaluated architectures varied hidden-layer counts while keeping the number of LSTM units the same.

3) Impact of The Size of Time Sliding Window:

The evaluation studies sliding-window size, confusion-matrix performance, AUC-ROC behavior, detection thresholds, and comparisons with related LSTM-Autoencoder models on the Dunedin dataset.

  • Impact of The Size of Time Sliding Window: A time sliding window of 10 performed best among tested sizes from 10 through 40.The window length changes how reconstruction error is computed.
  • Model Performance: 99.50% accuracy, 100% precision, 89.90% recall, and 94.68% F1-score were obtained on 42,787 test samples.The confusion matrix contained 40,697 normal and 2,100 abnormal samples, with no false positives and 212 false negatives.
  • Model Performance: 94.8% AUC-ROC was achieved, with the best performance at a time-window length of 10.The AUC-ROC score decreased slightly as the window increased beyond 25.
  • Model Performance: A reconstruction-error threshold of 1.742 classified test observations as anomalous.CO2 readings greater than 1,000 usually had reconstruction errors above this threshold.
  • Comparison to Other Similar Models: On the Dunedin CO2 dataset, the proposed approach achieved the best comparison accuracy at 99.50% and precision at 100%.Nguyen et al.’s model had a higher F1-score of 96.98% but lower accuracy, using One-Class SVM to reduce false positives.
  • Model overview: The model combines LSTM-based long-term-dependence learning with Autoencoder reconstruction loss for anomaly detection.An observation is classified as anomalous when its reconstruction loss exceeds the threshold.
Loading 2204.06701v1…