Source-linked AI summary
Contrastive Representation-Guided Genetic Minority Oversampling for Imbalanced Time-Series Classification
Wenbin Pei, Yunrong Hao, Zhen Liu, Guan Wang, Bing Xue, Yiu-Ming Cheung, Qiang Zhang
TL;DR
Imbalanced time-series classification is challenged by biased classifiers and oversampling methods with limited generalization and diversity. FreMGP combines frequency-domain contrastive representations with multi-tree genetic programming and representation-guided evolutionary search. It achieves the best average results across tested classifiers and evaluation metrics, with ablations supporting the value of its operators, prototype-guided loss, search stages, and diversity terms.
Problem
Minority samples are scarce, and existing oversampling methods can have limited generalization and poor diversity when generating time-series data.
Method
FreMGP uses a frequency-domain contrastive representation, multi-tree GP individuals, and two-stage fitness evaluation to evolve synthetic minority-class samples.
Results
FreMGP achieves the best average results across LSTM, Transformer, and Mamba classifiers and all three evaluation metrics among the compared sampling methods.
Takeaways & Limitations
The ablations indicate that genetic operators, prototype-guided loss, both search stages, and jointly modeling similarity and diversity contribute to FreMGP's performance.
Abstract
from arXiv · showhide
Real-world time-series classification tasks often exhibit class imbalance, which can be extremely severe in some applications. To avoid training biased classifiers on imbalanced data, sampling is one of the most popular data pre-processing techniques because of its classifier-agnostic nature. However, due to the complex temporal dependencies in original time-series data and the scarcity of minority-class samples, existing sampling methods, including interpolation-based oversampling methods and deep learning-based generative models, usually suffer from limited generalization and poor diversity when generating new time-series samples. This paper proposes a Frequency-domain representation-guided Multi-tree Genetic Programming-based oversampling approach (FreMGP) to imbalanced time-series classification, where each individual represents a set of synthetic samples for the minority class. A frequency-domain class-discriminative representation module based on contrastive learning is also developed, guiding the evolutionary search toward high-quality synthetic time-series samples. Experiments on imbalanced time-series datasets demonstrate that FreMGP outperforms existing oversampling methods and consistently improves the performance of different classifiers, including both general machine learning and deep learning models.
I. INTRODUCTION
Imbalanced time-series data can bias classifiers, while existing oversampling methods struggle to preserve temporal structure, generalization, and diversity. FreMGP addresses these issues with frequency-domain contrastive representations, multi-tree GP, and representation-guided evolutionary fitness.
- Class imbalance can bias time-series classifiers toward majority classes in applications including fault detection, medical diagnosis, and economics.
- Interpolation-based oversampling methods developed for tabular data cannot adequately capture complex temporal patterns in time-series samples.
- Scarce minority-class samples limit the generalization and diversity of newly generated time-series data.
- FreMGP learns a frequency-domain class-discriminative representation with prototype-guided contrastive learning to evaluate synthetic-sample quality.
- Its multi-tree GP structure generates a set of synthetic minority samples within one individual, enabling overall diversity evaluation.
- A two-stage fitness function balances similarity to minority samples with diversity, guiding evolution toward high-quality synthetic data.
B. Multi-Tree and Strongly-Typed Genetic Programming
FreMGP uses strongly typed multi-tree genetic programming to generate frequency-domain time-series samples, addressing limitations of interpolation, generative, and earlier evolutionary oversampling methods. Its encoder-guided two-stage search evaluates similarity first and then similarity plus diversity before reconstructing time-domain samples.
- Multi-Tree and Strongly-Typed Genetic Programming: Standard GP evolves executable programs as trees, while MTGP permits multiple trees in one individual and STGP constrains functions and terminals by data type.
- Existing Oversampling Methods: Random oversampling duplicates minority samples, while SMOTE variants and T-SMOTE generate samples through interpolation that may not fully model temporal characteristics.
- Existing Oversampling Methods: Deep generative methods learn data distributions for time-series augmentation, complementing interpolation-based approaches.
- Existing Oversampling Methods: Evo-TFS uses time- and frequency-domain distances but requires independent runs and may miss class-discriminative information or explicit set-level diversity.
- FreMGP Design: FreMGP transforms training samples into the frequency domain and uses an encoder to guide MTGP oversampling in a learned representation space.
- FreMGP Design: Its two evolutionary stages assess target-sample similarity first, then jointly consider similarity and diversity across generated samples.
- FreMGP Design: Generated frequency-domain samples are converted back with IDFT and combined with original training data to form a rebalanced set for classifiers.
B. Frequency-Domain Representation Space Learning
FreMGP learns a class-discriminative frequency-domain representation with supervised contrastive learning, then uses it to evaluate generated samples during evolutionary search.
- Direct evaluation in the original data space may capture instance similarity without reflecting class-discriminative information.
- FreMGP uses supervised contrastive learning to construct a class-discriminative frequency-domain representation space for subsequent evolutionary evaluation.
- The encoder maps each frequency-domain sample X_i into a hidden representation h_i.
- A projector maps h_i into a normalized metric embedding z_i with unit L2 norm.
- The supervised contrastive loss treats same-class batch samples as positives for each anchor sample.
2) Prototype-Guided Loss
FreMGP adds fixed class prototypes and a prototype gate to supervised contrastive learning, providing stable class-level references while avoiding unnecessary constraints on already-close samples.
- Class imbalance can bias contrastive representations toward majority classes because minority samples have fewer same-class positives within each batch.
- FreMGP introduces fixed class prototypes as class-level anchors that provide stable references beyond sample-to-sample comparisons.
- The prototypes are constructed from an initial metric embedding space and kept fixed during representation training.
- A prototype gate applies the prototype-guided loss only when an embedding is not close enough to its class prototype.
- The final objective uses supervised contrastive loss as its base and selectively adds prototype-guided loss according to the gate.
C. Frequency-domain Contrastive Representation-Guided MTGP Oversampling
FreMGP represents each minority oversampling solution as multiple strongly typed spectral trees and evolves them through two searches: representation proximity followed by local distribution expansion.
- Individual Representation: Each individual contains M_c strongly typed trees, with each tree representing one synthetic frequency-domain sample.M_c = N_max − N_c is the number of synthetic samples required for minority class c.
- Individual Representation: Each tree has layered spectral processing, with terminal inputs, function-based spectral transformations and fusion, and an output synthetic spectrum.
- Terminal and Function Sets: Spectrum terminals come from frequency-band components of training spectra, while ERCs provide amplitude-scaling, phase-shifting, and frequency-warping parameters.
- Terminal and Function Sets: The function set includes amplitude scaling, phase shifting, frequency warping, and spectral fusion, which combines transformed branches into the output spectrum.
- Target Assignment: Target samples are assigned to trees by cyclically reusing minority samples ranked by distance to the class center when M_c > N_c.
- Two-Stage Evolutionary Search: Stage I searches for representation proximity, while Stage II expands the local distribution after the population remains above an adaptive threshold for five consecutive generations.
3) Fitness Functions in the Two-Stage Search
FreMGP evaluates individuals in the learned representation space with a two-stage fitness design: first target proximity, then group-level radial consistency and angular diversity.
- Stage I Fitness: Stage I evaluates each generated sample by its representation proximity to the corresponding target minority-class sample.
- Stage I Fitness: The Gaussian mapping uses an adaptive scale parameter, so proximity scores decrease as generated-target representation distance increases.
- Stage II Fitness: Stage II addresses low diversity by grouping generated samples that share a target sample and evaluating their local distribution.
- Stage II Fitness: Radial consistency rewards groups whose samples remain close to the shared target with stable expansion radii.
- Stage II Fitness: Angular diversity rewards generated samples that move in more diverse directions around the shared target representation.
- Stage II Fitness: Stage-II group scores balance radial consistency and angular diversity, and the overall fitness aggregates scores across groups.
4) Genetic Operators
FreMGP uses stage-specific genetic operators that evolve individual trees in Stage I and groups of trees in Stage II, with lower-quality structures prioritized for refinement.
- Stage I: Stage I performs crossover and mutation at the individual-tree level because each tree has its own representation proximity score.Half of the trees are probabilistically selected, then paired for one-point subtree crossover or uniform subtree mutation.
- Stage I: Lower-scoring trees receive higher participation probabilities, directing genetic operations toward weaker generated samples.The participation probability is based on the maximum tree-level representation proximity score in the current individual.
- Stage II: Stage II performs crossover and mutation at the group level because each group contains samples associated with the same target sample.Only 25% of group positions participate in crossover, with larger quality gaps receiving higher crossover probabilities.
- Stage II: Groups with lower scores receive higher mutation probabilities, while only 25% of groups are allowed to mutate.Within each selected group, leave-one-out priorities favor trees whose removal would most improve group quality.
- Elitism: Elitism preserves high-quality structures at tree level in Stage I and group level in Stage II.Stage I retains high-performing trees by position, while Stage II recombines the best groups and retains top individuals.
A. Datasets
The experiments use 14 UCR time-series datasets spanning multiple real-world domains and create imbalanced training sets through stratified sampling while retaining original test sets.
- Datasets: 14 UCR Archive datasets cover healthcare, food analysis, industrial monitoring, robotics, and other real-world domains.The datasets provide predefined training and test splits.
- Dataset construction: Stratified sampling is applied to the training sets to produce imbalanced datasets across a wider range of IR values.The original test sets are retained for evaluation.
B. Baseline Methods
FreMGP is compared with conventional, time-series-specific, deep-learning-based, and genetic-programming oversampling baselines using multiple classifiers and implementation settings.
- Baseline methods: The conventional baselines include SMOTE, BL-SMOTE, ADASYN, SVM-SMOTE, and KM-SMOTE.These methods represent interpolation- and clustering-based oversampling strategies.
- Baseline methods: Time-series-specific baselines include T-SMOTE, INOS, and OHIT.The comparison also includes methods designed specifically for time-series oversampling.
- Baseline methods: Deep-learning-based baselines include CSMOTE, BFGAN, CFAMG, and ImagenFew, while Evo-TFS represents GP-based evolutionary oversampling.Together, the baselines span a wide range of oversampling strategies.
- Evaluation setup: LSTM, Transformer, and Mamba classifiers are trained on rebalanced data and evaluated on the same original test set.This setup evaluates generated data across both recurrent and modern sequence classifiers.
- Parameter settings: The representation module uses encoder and projection dimensions of 256 and 128, respectively, with temperature τ set to 0.1.The evolutionary module uses a population size of 128, up to 100 generations, and maximum tree depth 10.
V. RESULTS AND ANALYSIS
Across 14 datasets, FreMGP achieves the strongest overall classification performance and ranking across classifiers and metrics, with gains also observed for minority-class recognition and SOTA classifiers.
- Evaluation protocol: The evaluation uses 30 random seeds, three classifiers, three metrics, and Wilcoxon tests with Holm–Bonferroni correction.The same original test sets are used after rebalancing the training data with each method.
- Overall performance: FreMGP achieves the best average results across LSTM, Transformer, and Mamba under F1-Score, G-Mean, and AUC.Compared with no oversampling, most methods improve classification performance, indicating the value of rebalancing.
- Statistical comparison: 172, 176, and 174 of 182 F1-Score comparisons are significantly better or statistically comparable for LSTM, Transformer, and Mamba, respectively.For G-Mean, the corresponding counts are 175, 176, and 176 of 182.
- Ranking analysis: FreMGP obtains the best average ranking across all three classifiers and every reported performance measure.OHIT ranks second under LSTM, while INOS is competitive under Transformer and Mamba.
- Minority-class recognition: On Strawberry, Mamba reaches 0.88 accuracy on Class 1 while maintaining 0.96 on Class 2 after FreMGP rebalancing.FreMGP slightly exceeds INOS on both class accuracies and improves minority recognition without degrading majority recognition.
- SOTA classifiers: For Hydra, FreMGP raises F1-Score from 0.809 to 0.847 and G-Mean from 0.774 to 0.828, while AUC increases from 0.935 to 0.947.For SARC, F1-Score rises from 0.782 to 0.826, G-Mean from 0.739 to 0.811, and AUC from 0.930 to 0.937.
D. Ablation Analysis
Ablation results show that FreMGP’s representation learning, two-stage search, genetic operators, and similarity–diversity fitness design each contribute to performance. Its results remain stable across a broad range of Stage-II trade-off values, while the method improves classifier performance at higher computational cost.
- Overall ablation results: FreMGP achieves the best average results among its variants across LSTM, Transformer, and Mamba classifiers and all three evaluation metrics.The ablation averages results over 14 datasets.
- Genetic operators: Removing the stage-specific genetic operators significantly reduces performance, particularly under LSTM, indicating their importance for guiding evolutionary search.The operators are designed at the tree and group levels.
- Representation learning: Removing prototype-guided loss reduces performance, indicating that the prototype constraint helps produce a more useful representation space for fitness evaluation.The loss belongs to the frequency-domain representation learning module.
- Two-stage search: Both Stage I and Stage II improve performance, with Stage I especially affecting F1-Score and G-Mean and Stage II further expanding the local distribution.Stage II improves generated-sample quality after representation proximity is attained.
- Stage-II fitness: Removing either angular diversity or radial consistency lowers average performance, supporting the joint use of similarity and diversity in Stage-II fitness.These terms encourage generated samples to remain near minority samples while expanding in diverse directions.
- Sensitivity analysis: FreMGP maintains stable performance as α varies from 0.1 to 0.9, indicating that this Stage-II parameter is relatively insensitive.The trend is averaged over six representative datasets under LSTM, Transformer, and Mamba classifiers.