{"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/time-series-representation-learning-via","title":"Time-Series Representation Learning via Temporal and Contextual Contrasting","arxiv_id":"2106.14112","date":"2021-06-26","proceeding":null,"authors":["Emadeldeen Eldele","Mohamed Ragab","Zhenghua Chen","Min Wu","Chee Keong Kwoh","XiaoLi Li","Cuntai Guan"],"abstract":"Learning decent representations from unlabeled time-series data with temporal dynamics is a very challenging task. In this paper, we propose an unsupervised Time-Series representation learning framework via Temporal and Contextual Contrasting (TS-TCC), to learn time-series representation from unlabeled data. First, the raw time-series data are transformed into two different yet correlated views by using weak and strong augmentations. Second, we propose a novel temporal contrasting module to learn robust temporal representations by designing a tough cross-view prediction task. Last, to further learn discriminative representations, we propose a contextual contrasting module built upon the contexts from the temporal contrasting module. It attempts to maximize the similarity among different contexts of the same sample while minimizing similarity among contexts of different samples. Experiments have been carried out on three real-world time-series datasets. The results manifest that training a linear classifier on top of the features learned by our proposed TS-TCC performs comparably with the supervised training. Additionally, our proposed TS-TCC shows high efficiency in few-labeled data and transfer learning scenarios. The code is publicly available at https://github.com/emadeldeen24/TS-TCC.","url_abs":"https://arxiv.org/abs/2106.14112v1","url_pdf":"https://arxiv.org/pdf/2106.14112v1.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":"time-series-representation-learning-via","repo_url":"https://github.com/emadeldeen24/TS-TCC","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"time-series-representation-learning-via","repo_url":"https://github.com/etna-team/etna","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"automatic-sleep-stage-classification","task_name":"Automatic Sleep Stage Classification"},{"task_slug":"contrastive-learning","task_name":"Contrastive Learning"},{"task_slug":"epilepsy-prediction","task_name":"Epilepsy Prediction"},{"task_slug":"fault-detection","task_name":"Fault Detection"},{"task_slug":"recognizing-and-localizing-human-actions","task_name":"Recognizing And Localizing Human Actions"},{"task_slug":"representation-learning","task_name":"Representation Learning"},{"task_slug":"self-supervised-learning","task_name":"Self-Supervised Learning"},{"task_slug":"time-series-1","task_name":"Time Series"},{"task_slug":"time-series","task_name":"Time Series Analysis"},{"task_slug":"time-series-classification","task_name":"Time Series Classification"},{"task_slug":"transfer-learning","task_name":"Transfer Learning"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[{"leaderboard":"/sota/automatic-sleep-stage-classification-on-sleep-1","task":"Automatic Sleep Stage Classification","dataset":"Sleep-EDF","model":"TS-TCC","rank_in_archive_order":3,"of":4,"metrics":{"Accuracy":"83.0"},"uses_additional_data":false},{"leaderboard":"/sota/epilepsy-prediction-on-epilepsy-seizure","task":"Epilepsy Prediction","dataset":"Epilepsy seizure prediction","model":"TS-TCC","rank_in_archive_order":1,"of":1,"metrics":{"1:1 Accuracy":"97.23"},"uses_additional_data":false},{"leaderboard":"/sota/recognizing-and-localizing-human-actions-on","task":"Recognizing And Localizing Human Actions","dataset":"HAR","model":"TS-TCC","rank_in_archive_order":1,"of":1,"metrics":{"1:1 Accuracy":"90.37"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2106.14112","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2106.14112"}},"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":"deterministic:regex_extraction","url":"https://github.com/emadeldeen24/TS-TCC","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/etna-team/etna","reach":null}],"summary":{"ran":1,"ran_fixture":1},"by_repo_kind":{"official":{"samples":1,"ran":1,"repositories":1},"listed":{"samples":1,"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":0,"samples":[{"code_sha256_prefix":"1255724e15dbe2e5","entry":"base_Model","repo":"emadeldeen24/TS-TCC","repo_kind":"official","path":"models/model.py","file_url":"https://github.com/emadeldeen24/TS-TCC/blob/HEAD/models/model.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"1255724e15dbe2e5"}},{"code_sha256_prefix":"50140c8208c033ca","entry":"hierarchical_contrastive_loss","repo":"etna-team/etna","repo_kind":"listed","path":"etna/libs/ts2vec/losses.py","file_url":"https://github.com/etna-team/etna/blob/HEAD/etna/libs/ts2vec/losses.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"invariant","behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"50140c8208c033ca"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}