{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/soft-contrastive-learning-for-time-series","title":"Soft Contrastive Learning for Time Series","arxiv_id":"2312.16424","date":"2023-12-27","proceeding":null,"authors":["Seunghan Lee","Taeyoung Park","Kibok Lee"],"abstract":"Contrastive learning has shown to be effective to learn representations from time series in a self-supervised way. However, contrasting similar time series instances or values from adjacent timestamps within a time series leads to ignore their inherent correlations, which results in deteriorating the quality of learned representations. To address this issue, we propose SoftCLT, a simple yet effective soft contrastive learning strategy for time series. This is achieved by introducing instance-wise and temporal contrastive loss with soft assignments ranging from zero to one. Specifically, we define soft assignments for 1) instance-wise contrastive loss by the distance between time series on the data space, and 2) temporal contrastive loss by the difference of timestamps. SoftCLT is a plug-and-play method for time series contrastive learning that improves the quality of learned representations without bells and whistles. In experiments, we demonstrate that SoftCLT consistently improves the performance in various downstream tasks including classification, semi-supervised learning, transfer learning, and anomaly detection, showing state-of-the-art performance. Code is available at this repository: https://github.com/seunghan96/softclt.","url_abs":"https://arxiv.org/abs/2312.16424v3","url_pdf":"https://arxiv.org/pdf/2312.16424v3.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"soft-contrastive-learning-for-time-series","repo_url":"https://github.com/seunghan96/softclt","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"anomaly-detection","task_name":"Anomaly Detection"},{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"time-series-1","task_name":"Time Series"},{"task_slug":"transfer-learning","task_name":"Transfer Learning"}],"methods":[{"method_slug":"contrastive-learning","method_name":"Contrastive Learning"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2312.16424","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2312.16424"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/seunghan96/softclt","reach":null}],"summary":{"ran_honours":1,"unverified":3},"by_repo_kind":{"official":{"samples":4,"ran":1,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":4,"samples":[{"code_sha256_prefix":"b8f3ea7ebc4553c2","entry":"densify","repo":"seunghan96/softclt","repo_kind":"official","path":"softclt_catcc/main_semi_classification.py","file_url":"https://github.com/seunghan96/softclt/blob/HEAD/softclt_catcc/main_semi_classification.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"b8f3ea7ebc4553c2"}},{"code_sha256_prefix":"0be0fff234787733","entry":"hier_CL_soft","repo":"seunghan96/softclt","repo_kind":"official","path":"softclt_catcc/models/soft_losses.py","file_url":"https://github.com/seunghan96/softclt/blob/HEAD/softclt_catcc/models/soft_losses.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"0be0fff234787733"}},{"code_sha256_prefix":"11c3ac399a368b09","entry":"inst_CL_soft","repo":"seunghan96/softclt","repo_kind":"official","path":"softclt_catcc/models/soft_losses.py","file_url":"https://github.com/seunghan96/softclt/blob/HEAD/softclt_catcc/models/soft_losses.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"11c3ac399a368b09"}},{"code_sha256_prefix":"dcb343f47a053445","entry":"temp_CL_soft","repo":"seunghan96/softclt","repo_kind":"official","path":"softclt_catcc/models/soft_losses.py","file_url":"https://github.com/seunghan96/softclt/blob/HEAD/softclt_catcc/models/soft_losses.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"dcb343f47a053445"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}