Please wait a minute...
浙江大学学报(工学版)  2027, Vol. 61 Issue (1): 165-176    DOI: 10.3785/j.issn.1008-973X.2027.01.016
计算机技术     
基于相似性自监督表示学习的时间序列分类方法
张晗()
东北财经大学 数据科学与人工智能学院,辽宁 大连 116025
Similarity-based self-supervised representation learning method for time series classification
Han Zhang()
School of Data Science and Artificial Intelligence, Dongbei University of Finance and Economics, Dalian 116025, China
 全文: PDF(1102 KB)   HTML
摘要:

针对时间序列分类任务中高质量特征表示获取困难及对标注数据依赖性强的问题,提出基于相似性向量自监督表示学习方法Sim2Vec. 该方法突破自监督方法对人工数据增强策略的依赖,将时间序列在时域与频域的内在相似性作为训练信号,引导模型学习保持结构一致性的特征表示. 设计顺序不变的门控自注意力机制,增强模型对关键结构特征的关注能力,有效抑制无关噪声干扰. 实验结果表明,在包括Epilepsy数据集的9个真实世界时间序列数据集中,Sim2Vec在无监督预训练条件下的分类性能与鲁棒性显著优于多种主流自监督学习模型. 在低标注数据场景下,该方法可以保持与全监督方法相当的准确率,展现出广阔的实际应用前景.

关键词: 时间序列分类;  自监督学习;  相似性度量;  表示学习;  注意力机制    
Abstract:

A similarity-vector-based self-supervised representation learning method, Sim2Vec, was proposed to address the challenges of acquiring high-quality feature representations and the strong dependency on labeled data in time series classification tasks. The method eliminated the reliance on artificial data augmentation strategies in self-supervised approaches. Instead, it employed the intrinsic similarity of time series in both the time and frequency domains as training signals, guiding the model to learn structure-preserving feature representations. A sequence-invariant gated self-attention mechanism was designed to enhance the model’s ability to focus on key structural features while effectively suppressing irrelevant noise interference. Experimental results demonstrated that Sim2Vec significantly outperformed multiple mainstream self-supervised learning models in classification performance and robustness under unsupervised pre-training conditions on 9 real-world time series datasets (including the Epilepsy dataset). In low-labeled-data scenarios, the method maintained the accuracy comparable to fully supervised approaches, demonstrating promising application prospects.

Key words: time series classification    self-supervised learning    similarity measurement    representation learning    attention mechanism
收稿日期: 2025-06-13 出版日期: 2026-11-25
CLC:  TP 183  
基金资助: 辽宁省教育厅高校基本科研项目(LJ212510173008);国家自然科学基金资助项目(72273019).
作者简介: 张晗(1990—),男,讲师,硕导,从事神经网络和表示学习研究. orcid.org/0000-0002-7923-7005. E-mail:hanzhang@dufe.edu.cn
服务  
把本文推荐给朋友
加入引用管理器
E-mail Alert
作者相关文章  
张晗

引用本文:

张晗. 基于相似性自监督表示学习的时间序列分类方法[J]. 浙江大学学报(工学版), 2027, 61(1): 165-176.

Han Zhang. Similarity-based self-supervised representation learning method for time series classification. Journal of ZheJiang University (Engineering Science), 2027, 61(1): 165-176.

链接本文:

https://www.zjujournals.com/eng/CN/10.3785/j.issn.1008-973X.2027.01.016    或    https://www.zjujournals.com/eng/CN/Y2027/V61/I1/165

图1  基于相似性自监督表示学习的时序分类方法Sim2Vec整体架构
图2  门控顺序不变注意力机制示意图
数据集$ {N}_{\text{tr}} $$ {N}_{\text{te}} $$ {N}_{\text{sub}} $$ L $$ C $$ {N}_{\text{cls}} $
WISDM2134 61414 421294036
PAMAP251 19211 59091005218
USC-HAD46 899932714100612
Sleep25 612891020300015
Skoda22 58756461506411
Opportunity15 0112374410011318
WISDM11 9605207134036
Epilepsy9200230050017812
UCI-HAR735229473012896
表1  实验所用数据集详细信息
模块卷积核大小C
通道卷积1$ 1\times 3 $16
空间卷积1$ C\times 1 $16
通道卷积2$ 1\times 3 $32
空间卷积2$ C\times 1 $32
表2  时域与频域编码器的结构配置
数据集fs/HzLNFFTM
WISDM2208012864
PAMAP2100256256128
USC-HAD100256256128
Sleep100256256128
Skoda98256256128
Opportunity3012812864
WISDM208012864
Epilepsy174256256128
UCI-HAR5012812864
表3  快速傅里叶变换处理参数配置
数据集A/%
Sim2VecSeries2VecTS2VecTS-TCCTNCMCLTF-CTST
WISDM269.83$ \pm $0.2164.70$ \pm $0.3462.50$ \pm $0.4964.36$ \pm $1.0263.75$ \pm $0.9663.84$ \pm $0.9863.35$ \pm $2.0561.75$ \pm $1.34
PAMAP286.45$ \pm $0.2981.99$ \pm 0.41 $77.33$ \pm $0.5262.33$ \pm $1.2367.25$ \pm $1.9661.93$ \pm $1.7440.32$ \pm $1.7452.80$ \pm $1.15
USC-HAD60.17$ \pm $0.8756.12$ \pm $1.3447.28$ \pm $4.1753.89$ \pm $3.4351.19$ \pm $2.0550.45$ \pm $3.6048.51$ \pm $2.8346.57$ \pm $5.29
Sleep85.91$ \pm $1.3580.62$ \pm $3.5977.38$ \pm $4.7480.59$ \pm $1.8275.71$ \pm $4.9374.82$ \pm $4.1673.82$ \pm $6.6374.93$ \pm $5.68
Skoda99.37 ± 0.0498.65$ \pm $0.1198.09$ \pm $0.4496.39$ \pm $0.5295.39$ \pm $0.2794.04$ \pm $0.5396.40$ \pm $0.6786.95$ \pm $1.41
Opportunity86.32 ± 0.0486.56$ \pm $0.4285.00$ \pm $1.5682.90$ \pm $1.6883.81$ \pm $4.7382.54$ \pm $0.8583.06$ \pm $1.2582.81$ \pm $4.61
WISDM86.20 ± 0.2281.17$ \pm $0.2780.23$ \pm $2.3176.16$ \pm $2.3973.16$ \pm $5.4774.06$ \pm $2.1272.08$ \pm $3.0062.88$ \pm $6.54
Epilepsy98.95$ \pm $0.0297.61$ \pm $0.0397.52$ \pm $0.1896.83$ \pm $0.1295.83$ \pm $0.1596.91$ \pm $0.1396.73$ \pm $0.3382.61$ \pm $0.24
UCI-HAR95.40 ± 0.0994.77$ \pm $0.1393.76$ \pm $1.1789.21$ \pm $0.2490.21$ \pm $0.2788.46$ \pm $2.8481.09$ \pm $1.4686.21$ \pm $2.31
Average85.4082.4779.9078.0777.3776.3372.8170.83
Rank1.002.004.004.335.005.786.447.44
表4  自监督模型的准确率对比结果
数据集模型DinterDintraMAEFLOPs/109GPU/109ttrain/(s?epoch?1)
EpilepsySim2Vec0.312.680.108.71.842
Series2Vec0.381.850.138.21.938
TS2Vec0.391.720.149.12.141
TS-TCC0.431.630.1610.42.252
TNC0.611.420.1812.33.054
MCL0.491.580.179.82.548
TF-C0.451.610.2411.22.747
TST0.721.300.4114.63.562
UCI-HARSim2Vec0.372.420.148.81.844
Series2Vec0.432.020.188.32.040
TS2Vec0.461.980.199.22.242
TS-TCC0.501.790.2110.32.351
TNC0.591.600.2512.13.053
MCL0.541.710.229.92.649
TF-C0.511.680.2811.32.848
TST0.801.410.4314.73.663
WISDMSim2Vec0.392.310.168.91.945
Series2Vec0.441.920.208.42.041
TS2Vec0.461.870.229.32.343
TS-TCC0.491.740.2410.52.452
TNC0.561.630.2612.23.155
MCL0.521.700.259.92.650
TF-C0.501.680.2911.42.849
TST0.821.380.4614.83.664
OpportunitySim2Vec0.412.270.189.01.946
Series2Vec0.461.880.218.52.042
TS2Vec0.481.820.239.32.344
TS-TCC0.501.730.2510.42.452
TNC0.581.610.2712.33.256
MCL0.541.680.269.82.751
TF-C0.521.650.3011.42.850
TST0.841.360.4714.93.765
表5  模型在代表性数据集上的综合性能与计算效率对比结果
图3  不同标注样本数下线性探测模型与监督学习方法的分类准确率对比
模型A/%Aavg/%
WISDM2PAMAP2USC-HADSleepSkodaOpportunityWISDMEpilepsyUCI-HAR
随机初始化65.9175.1056.2682.2099.1689.3484.6998.1796.0682.99
Sim2Vec69.0078.8057.5083.5099.4090.0087.0098.4096.6084.58
提升/百分点3.093.701.241.300.240.662.310.230.541.59
表6  随机初始化与预训练分类准确率对比结果
模块A/%Aavg/%
WISDM2PAMAP2USC-HADSleepSkodaOpportunityWISDMEpilepsyUCI-HAR
去除注意力机制59.8370.6436.8461.2193.2582.9774.4091.0090.0373.37
去除频域分支60.8378.6438.8470.2196.2585.9779.7097.0092.6077.78
去除时域分支63.1671.8845.8263.3698.4286.4580.5496.6593.6477.76
Sim2Vec65.5082.7057.0081.5098.7087.0081.8097.7095.0083.15
表7  消融实验对比结果
损失函数Aavg/%损失函数Aavg/%
LSim(Sim2Vec)83.15LSim+Lcons83.30
Lcons(TS–TCC)78.07LSim+LSP84.15
LSP(TST)70.83LSim+LSP+Lcons84.25
表8  相似性保持损失与辅助损失的互补性分析
1 Mohammadi Foumani N, Miller L, Tan C W, et al. Deep learning for time series classification and extrinsic regression: a current survey. ACM Computing Surveys, 2024, 56 (9): 1- 45.
doi: 10.1145/3649447
2 Rajkomar A, Oren E, Chen K, et al. Scalable and accurate deep learning for electronic health records [PP/OL]. V3. arXiv (2018-05-11)[2026-06-13]. https://doi.org/10.48550/arXiv.1801.07860.
3 Bagnall A, Dau H A, Lines J, et al. The UEA multivariate time series classification archive, 2018 [PP/OL]. arXiv (2018-10-31)[2025-06-13]. https://doi.org/10.48550/arXiv.1811.00075.
4 Yue Z, Wang Y, Duan J, et al. TS2Vec: towards universal representation of time series. Proceedings of the AAAI Conference on Artificial Intelligence, 2022, 36 (8): 8980- 8987.
doi: 10.1609/aaai.v36i8.20881
5 Yang L, Hong S. Unsupervised time-series representation learning with iterative bilinear temporal-spectral fusion [C]// Proceedings of the 39th International Conference on Machine Learning. Baltimore: PMLR, 2022, 162: 25038–25054.
6 Goyal P, Caron M, Lefaudeux B, et al. Self-supervised pretraining of visual features in the wild [PP/OL]. V2. arXiv (2021-03-05)[2025-06-13]. https://doi.org/10.48550/arXiv.2103.01988.
7 van den Oord A, Li Y, Vinyals O. Representation learning with contrastive predictive coding [PP/OL]. V2. arXiv (2019-01-22)[2025-06-13]. https://doi.org/10.48550/arXiv.1807.03748.
8 Chen T, Kornblith S, Norouzi M, et al. A simple framework for contrastive learning of visual representations [C]// Proceedings of the 37th International Conference on Machine Learning. [S. 1. ]: PMLR, 2020, 119: 1597–1607.
9 He K, Fan H, Wu Y, et al. Momentum contrast for unsupervised visual representation learning [C]// Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. Seattle: IEEE, 2020: 9726–9735.
10 Franceschi J Y, Dieuleveut A, Jaggi M. Unsupervised scalable representation learning for multivariate time series [C]// Advances in Neural Information Processing Systems. [S. 1. ]: Curran Associates, Inc. , 2019, 32: 4650–4661.
11 Tonekaboni S, Eytan D, Goldenberg A. Unsupervised representation learning for time series with temporal neighborhood coding [PP/OL]. arXiv (2021-06-01)[2025-06-13]. https://doi.org/10.48550/arXiv.2106.00750.
12 Eldele E, Ragab M, Chen Z, et al. Time-series representation learning via temporal and contextual contrasting [PP/OL]. arXiv (2021-06-26)[2025-06-13]. https://doi.org/10.48550/arXiv.2106.14112.
13 Wickstrøm K, Kampffmeyer M, Mikalsen K Ø, et al. Mixing up contrastive learning: self-supervised representation learning for time series. Pattern Recognition Letters, 2022, 155, 54- 61.
doi: 10.1016/j.patrec.2022.02.007
14 Foumani N M, Tan C W, Webb G I, et al. Series2vec: similarity-based self-supervised representation learning for time series classification. Data Mining and Knowledge Discovery, 2024, 38 (4): 2520- 2544.
doi: 10.1007/s10618-024-01043-w
15 Zhang X, Zhao Z, Tsiligkaridis T, et al. Self-supervised contrastive pre-training for time series via time-frequency consistency [C]// Proceedings of the Advances in Neural Information Processing Systems. New Orleans: NeurIPS, 2022: 3988–4003.
16 Devlin J, Chang M W, Lee K, et al. BERT: pre-training of deep bidirectional transformers for language understanding [C]// North American Chapter of the Association for Computational Linguistics: Human Language Technologies. Minneapolis: ACL, 2019: 4171–4186.
17 Kostas D, Aroca-Ouellette S, Rudzicz F. BENDR: using transformers and a contrastive self-supervised learning task to learn from massive amounts of EEG data. Frontiers in Human Neuroscience, 2021, 15, 653659.
doi: 10.3389/fnhum.2021.653659
18 Mohammadi Foumani N, MacKellar G, Ghane S, et al. EEG2Rep: enhancing self-supervised EEG representation through informative masked inputs [C]// Proceedings of the 30th ACM SIGKDD Conference on Knowledge Discovery and Data Mining. Barcelona: ACM, 2024: 5544–5555.
19 Zerveas G, Jayaraman S, Patel D, et al. A transformer-based framework for multivariate time series representation learning [C]// Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery and Data Mining. [S. l. ]: ACM, 2021: 2114–2124.
20 Fawaz H I. Deep learning for time series classification [PP/OL]. arXiv (2020-10-01)[2025-06-13]. https://doi.org/10.48550/arXiv.2010.00567.
21 Tan C W, Bergmeir C, Petitjean F, et al. Time series extrinsic regression: predicting numeric values from time series data. Data Mining and Knowledge Discovery, 2021, 35 (3): 1032- 1060.
doi: 10.1007/s10618-021-00745-9
22 Sakoe H, Chiba S. A dynamic-programming approach to continuous speech recognition [C]// Proceedings of the 20th International Congress of Acoustics. Budapest: [s. n. ], 1971: 65−68.
23 Petitjean F, Ketterlin A, Gançarski P. A global averaging method for dynamic time warping, with applications to clustering. Pattern Recognition, 2011, 44 (3): 678- 693.
doi: 10.1016/j.patcog.2010.09.013
24 Cuturi M, Blondel M. Soft-DTW: a differentiable loss function for time-series [C]// Proceedings of the International Conference on Machine Learning. [S. 1. ]: PMLR, 2017: 894–903.
25 Mohammadi Foumani S N, Tan C, Salehi M. Disjoint-CNN for multivariate time series classification [C]// Proceedings of the International Conference on Data Mining Workshops. Auckland: IEEE, 2021: 760–769.
26 Foumani N M, Tan C W, Webb G I, et al. Improving position encoding of transformers for multivariate time series classification. Data Mining and Knowledge Discovery, 2024, 38 (1): 22- 48.
doi: 10.1007/s10618-023-00948-2
27 Cooley J W, Lewis P A W, Welch P D. The fast Fourier transform and its applications. IEEE Transactions on Education, 1969, 12 (1): 27- 34.
doi: 10.1109/te.1969.4320436
28 Agrawal R, Faloutsos C, Swami A N. Efficient similarity search in sequence databases [C]// Proceedings of the 4th International Conference on Foundations of Data Organization and Algorithms. Berlin: Springer, 1993: 69–84.
29 Vaswani A, Shazeer N, Parmar N, et al. Attention is all you need [C]//Proceedings of the Advances in Neural Information Processing Systems. Red Hook: Curran Associates Inc., , 2017, 30: 5998–6008.
30 Huber P J. Robust estimation of a location parameter. The Annals of Mathematical Statistics, 1964, 35 (1): 73- 101.
doi: 10.1214/aoms/1177703732
31 Andrzejak R G, Lehnertz K, Mormann F, et al. Indications of nonlinear deterministic and finite-dimensional structures in time series of brain electrical activity: dependence on recording region and brain state. Physical Review E, 2001, 64 (6): 061907.
doi: 10.1103/physreve.64.061907
32 Goldberger A L, Amaral L A, Glass L, et al. PhysioBank, PhysioToolkit, and PhysioNet: components of a new research resource for complex physiologic signals. Circulation, 2000, 101 (23): E215- E220.
doi: 10.1161/01.cir.101.23.e215
33 Anguita D, Ghio A, Oneto L, et al. A public domain dataset for human activity recognition using smartphones [C]// Proceedings of the 21th European Symposium on Artificial Neural Networks. Bruges: [s. n. ], 2013: 3–4.
[1] 石瑞贵,董飞,夏孝云,慕灯聪,张帝,葛鲲鹏. 基于图像增强与多注意力机制的低照度图像目标检测[J]. 浙江大学学报(工学版), 2027, 61(1): 120-130, 141.
[2] 杨恒,王韶涵,董青,赵科渊,杨明亮. 基于注意力增强的跨模态多层融合网络的物体位姿估计[J]. 浙江大学学报(工学版), 2026, 60(9): 1872-1880.
[3] 火久元,姜灏,常琛. 基于改进EAST的高速公路交通标识文本检测[J]. 浙江大学学报(工学版), 2026, 60(9): 1881-1889.
[4] 李宏伟,丁建阳,柴志雷. 用于实时语义分割的数据高效轻量模型[J]. 浙江大学学报(工学版), 2026, 60(9): 1934-1941.
[5] 宋莉,宛袁玉,宋明黎. 基于混合空洞注意力机制的图卷积强化学习[J]. 浙江大学学报(工学版), 2026, 60(9): 1980-1990.
[6] 郝亚如,艾远高,张鹏,吴慰. 半监督多视图相似性和鉴别表示联合学习[J]. 浙江大学学报(工学版), 2026, 60(9): 1991-1997.
[7] 赵明华,吕雨萱,吕佳豪,陈逸飞,石程,胡静. 基于多尺度外观运动融合的视频异常检测[J]. 浙江大学学报(工学版), 2026, 60(8): 1730-1738.
[8] 刘慧霞,王荣景,高宇轩,曹猛,盛苏英,马友鹏. 基于自适应神经网络的无信号交叉口车辆无死锁调度算法[J]. 浙江大学学报(工学版), 2026, 60(8): 1832-1840.
[9] 徐恺蔚,KHIZER BIN TALIBHafiz,曹衍龙,许源平,许志杰,宋景春. 基于光流和卷积视觉Transformer的轻量级微表情识别[J]. 浙江大学学报(工学版), 2026, 60(7): 1381-1391.
[10] 杨艳春,李佳龙. 基于多路协同与空谱先验的高光谱与多光谱图像融合[J]. 浙江大学学报(工学版), 2026, 60(7): 1427-1437.
[11] 张乃洲,赵云超,曹薇,张啸剑. 基于多视图跨模态特征融合的图像描述生成[J]. 浙江大学学报(工学版), 2026, 60(6): 1205-1212.
[12] 李云红,张琪琪,陈锦妮,陈伟重,苏雪平,梁成名. 基于生成对抗网络和坐标注意力机制的文本生成图像算法[J]. 浙江大学学报(工学版), 2026, 60(6): 1213-1220.
[13] 李国燕,于威,梅玉鹏,张明辉,王新强. 全局局部特征融合的遥感图像建筑物提取[J]. 浙江大学学报(工学版), 2026, 60(5): 1100-1108.
[14] 宋耀莲,彭驰,唐菁敏,赵宣植,虞贵财. 基于融合注意力机制的光学遥感图像小目标检测算法[J]. 浙江大学学报(工学版), 2026, 60(4): 763-771.
[15] 万刚,王小波,石纲,叶德震,朱思思,司帆. 基于特征细化与注意力增强重构的水下图像增强算法[J]. 浙江大学学报(工学版), 2026, 60(4): 800-811.