{"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/timesurl-self-supervised-contrastive-learning","title":"TimesURL: Self-supervised Contrastive Learning for Universal Time Series Representation Learning","arxiv_id":"2312.15709","date":"2023-12-25","proceeding":null,"authors":["Jiexi Liu","Songcan Chen"],"abstract":"Learning universal time series representations applicable to various types of downstream tasks is challenging but valuable in real applications. Recently, researchers have attempted to leverage the success of self-supervised contrastive learning (SSCL) in Computer Vision(CV) and Natural Language Processing(NLP) to tackle time series representation. Nevertheless, due to the special temporal characteristics, relying solely on empirical guidance from other domains may be ineffective for time series and difficult to adapt to multiple downstream tasks. To this end, we review three parts involved in SSCL including 1) designing augmentation methods for positive pairs, 2) constructing (hard) negative pairs, and 3) designing SSCL loss. For 1) and 2), we find that unsuitable positive and negative pair construction may introduce inappropriate inductive biases, which neither preserve temporal properties nor provide sufficient discriminative features. For 3), just exploring segment- or instance-level semantics information is not enough for learning universal representation. To remedy the above issues, we propose a novel self-supervised framework named TimesURL. Specifically, we first introduce a frequency-temporal-based augmentation to keep the temporal property unchanged. And then, we construct double Universums as a special kind of hard negative to guide better contrastive learning. Additionally, we introduce time reconstruction as a joint optimization objective with contrastive learning to capture both segment-level and instance-level information. As a result, TimesURL can learn high-quality universal representations and achieve state-of-the-art performance in 6 different downstream tasks, including short- and long-term forecasting, imputation, classification, anomaly detection and transfer learning.","url_abs":"https://arxiv.org/abs/2312.15709v1","url_pdf":"https://arxiv.org/pdf/2312.15709v1.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":"timesurl-self-supervised-contrastive-learning","repo_url":"https://github.com/Alrash/TimesURL","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"timesurl-self-supervised-contrastive-learning","repo_url":"https://github.com/WenjieDu/PyPOTS","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"anomaly-detection","task_name":"Anomaly Detection"},{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"imputation","task_name":"Imputation"},{"task_slug":"representation-learning","task_name":"Representation 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":{"syntology_url":null,"atlas_url":"https://app.syntology.ai/?focus=2312.15709","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2312.15709"}},"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/Alrash/TimesURL","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/WenjieDu/PyPOTS","reach":null}],"summary":{"ran_draft_wrong":3,"ran_fixture":1,"unverified":2},"by_repo_kind":{"official":{"samples":6,"ran":4,"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":0,"samples":[{"code_sha256_prefix":"5254eb44ce12370e","entry":"pad_nan_to_target","repo":"Alrash/TimesURL","repo_kind":"official","path":"src/utils.py","file_url":"https://github.com/Alrash/TimesURL/blob/HEAD/src/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"5254eb44ce12370e"}},{"code_sha256_prefix":"645d1fdb1dc0e80c","entry":"pkl_load","repo":"Alrash/TimesURL","repo_kind":"official","path":"src/utils.py","file_url":"https://github.com/Alrash/TimesURL/blob/HEAD/src/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"645d1fdb1dc0e80c"}},{"code_sha256_prefix":"79783deb10f33397","entry":"torch_pad_nan","repo":"Alrash/TimesURL","repo_kind":"official","path":"src/utils.py","file_url":"https://github.com/Alrash/TimesURL/blob/HEAD/src/utils.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"79783deb10f33397"}},{"code_sha256_prefix":"02bd9566f5f59f5c","entry":"tp_noneffect","repo":"Alrash/TimesURL","repo_kind":"official","path":"src/timesurl.py","file_url":"https://github.com/Alrash/TimesURL/blob/HEAD/src/timesurl.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"02bd9566f5f59f5c"}},{"code_sha256_prefix":"3780ec41f3dabae3","entry":"freq_dropout","repo":"Alrash/TimesURL","repo_kind":"official","path":"src/timesurl.py","file_url":"https://github.com/Alrash/TimesURL/blob/HEAD/src/timesurl.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"3780ec41f3dabae3"}},{"code_sha256_prefix":"a99640ab52d24d82","entry":"freq_mix","repo":"Alrash/TimesURL","repo_kind":"official","path":"src/timesurl.py","file_url":"https://github.com/Alrash/TimesURL/blob/HEAD/src/timesurl.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a99640ab52d24d82"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}