Learning from Imbalanced Multiclass Sequential Data Streams Using Dynamically Weighted Conditional Random Fields

Roberto Luis Shinmoto Torres, Damith Chinthana Ranasinghe, Qinfeng Shi, Anton van den HengelarXiv 2016

Abstract

In human activity recognition (HAR), sensor data streams are frequently characterized by extreme class imbalance, where critical events occur far less frequently than routine background activities. Traditional classification models, such as standard Conditional Random Fields (CRFs), often optimize for overall accuracy, leading to poor performance on these vital minority classes. This paper introduces Dynamically Weighted Conditional Random Fields (dWCRF), a novel framework that integrates class-specific weights directly into the CRF objective function. By maximizing the expected F-score rather than minimizing 0-1 loss, and calculating weights autonomously during training, dWCRF achieves superior performance on imbalanced sequential datasets without the need for computationally expensive manual parameter tuning.

Introduction

Human activity recognition (HAR) using wearable sensors is a cornerstone of modern healthcare monitoring. However, real-world data in this domain is inherently imbalanced. For instance, a hospitalized patient may spend the vast majority of their day resting, while critical activities like ambulation or falling occupy only a fraction of the data stream.

Standard machine learning models typically prioritize accuracy, a metric that can be highly misleading in imbalanced contexts. A model that predicts "resting" 100% of the time might achieve 99% accuracy while failing entirely to detect the 1% of the time the patient is moving. Furthermore, human activities are sequential; current actions are highly dependent on previous states. While CRFs are designed to capture these temporal dependencies, they lack inherent mechanisms to handle class imbalance effectively. Existing solutions, such as data re-sampling or manual cost-sensitive learning, either disrupt the sequential nature of the data or require exhaustive, time-consuming hyperparameter searches.

Methodology: The dWCRF Approach

The proposed Dynamically Weighted Conditional Random Field (dWCRF) addresses these challenges by embedding weight calculation directly into the model's optimization process.

Optimization Metric

Instead of optimizing for simple classification error, dWCRF is designed to maximize the expected overall F-score. The F-score, which harmonic mean of precision and recall, provides a more robust measure of performance for imbalanced data by ensuring that minority classes are neither ignored nor overwhelmed by false positives.

Dynamic Weighting and Pareto Optimality

Traditional cost-sensitive models require a "grid search" to identify the optimal weights for each class. In contrast, dWCRF calculates these weights autonomously during training. The authors utilize the concept of Pareto optimality to demonstrate that there exists a specific set of weights where the parameters optimizing the weighted log-likelihood also optimize the expected F-score. By deriving a closed-form approximation, the model can estimate these weights based on current predictions and adjust them via the gradients during the training process. This allows the model to "see" which classes are being under-represented and increase their relative importance dynamically.

Real-Time Inference

To support practical healthcare applications, the system employs a belief propagation method. This allows the model to provide marginal probabilities for the most recent sensor observations, facilitating real-time activity labeling as data streams in.

Experimental Setup

The researchers evaluated dWCRF against two distinct types of sensor data:

  1. Batteryless Body Worn (BLBW): Data was collected using the Wearable Wireless Identification and Sensing Platform (W²ISP). These sensors are powered by RFID waves, offering a maintenance-free solution but resulting in irregular and sparse data streams. The evaluation included three case studies involving healthy older volunteers and hospitalized patients.
  2. Battery Powered Body Worn (BPBW): The authors utilized the Opportunity activity recognition dataset from the UCI repository. This dataset was specifically modified to simulate varying levels of class imbalance to test the algorithm's robustness.

Results and Discussion

The experimental results consistently favored the dWCRF framework over standard and fixed-weight CRFs.

  • Performance Gains: dWCRF outperformed baseline models across all case studies, particularly in the identification of minority classes such as "Ambulating." In the most challenging clinical dataset (Room3), dWCRF achieved a mean F-score of 59.0%, the highest among all tested classifiers.
  • Data Efficiency: In scenarios with limited training data—a common constraint in clinical settings—dWCRF proved more robust than Support Vector Machines (SVMs). While SVMs performed well with large datasets, their performance degraded significantly faster than dWCRF as the amount of available data decreased.
  • Computational Efficiency: By eliminating the need for external weight tuning (such as grid search or evolutionary algorithms like CMA-ES), dWCRF trains significantly faster than weighted SVMs. This efficiency advantage grows exponentially as the number of classes increases.

Limitations and Future Directions

While dWCRF showed strong performance, it encountered difficulties with the "Null" class in the Opportunity dataset, where undefined background noise is categorized as a class. This suggests that the model is most effective when classes are well-defined.

Future work will explore higher-order Markov assumptions to capture longer-term temporal dependencies beyond the immediate previous state. Additionally, the authors suggest that the dWCRF framework is not limited to HAR and could be applied to other structured prediction tasks, such as bioinformatics or text classification, where class imbalance is a prevalent hurdle.

Conclusion

Dynamically Weighted Conditional Random Fields offer a powerful solution for sequential data classification in the presence of class imbalance. By automating the weighting process and focusing on F-score optimization, dWCRF provides a scalable, efficient, and highly accurate tool for real-world monitoring applications where the rarest events are often the most important to detect.

Summary updated

Abstract

The present study introduces a method for improving the classification performance of imbalanced multiclass data streams from wireless body worn sensors. Data imbalance is an inherent problem in activity recognition caused by the irregular time distribution of activities, which are sequential and dependent on previous movements. We use conditional random fields (CRF), a graphical model for structured classification, to take advantage of dependencies between activities in a sequence. However, CRFs do not consider the negative effects of class imbalance during training. We propose a class-wise dynamically weighted CRF (dWCRF) where weights are automatically determined during training by maximizing the expected overall F-score. Our results based on three case studies from a healthcare application using a batteryless body worn sensor, demonstrate that our method, in general, improves overall and minority class F-score when compared to other CRF based classifiers and achieves similar or better overall and class-wise performance when compared to SVM based classifiers under conditions of limited training data. We also confirm the performance of our approach using an additional battery powered body worn sensor dataset, achieving similar results in cases of high class imbalance.
BibTeX
@misc{torres2016learning,
  author = {Roberto Luis Shinmoto Torres and Damith Chinthana Ranasinghe and Qinfeng Shi and Anton van den Hengel},
  title = {{Learning from Imbalanced Multiclass Sequential Data Streams Using Dynamically Weighted Conditional Random Fields}},
  year = {2016},
  eprint = {1603.03627},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1603.03627},
}
Figure