{"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/self-supervised-spatial-temporal-normality","title":"Self-Supervised Spatial-Temporal Normality Learning for Time Series Anomaly Detection","arxiv_id":"2406.19770","date":"2024-06-28","proceeding":null,"authors":["Yutong Chen","Hongzuo Xu","Guansong Pang","Hezhe Qiao","Yuan Zhou","Mingsheng Shang"],"abstract":"Time Series Anomaly Detection (TSAD) finds widespread applications across various domains such as financial markets, industrial production, and healthcare. Its primary objective is to learn the normal patterns of time series data, thereby identifying deviations in test samples. Most existing TSAD methods focus on modeling data from the temporal dimension, while ignoring the semantic information in the spatial dimension. To address this issue, we introduce a novel approach, called Spatial-Temporal Normality learning (STEN). STEN is composed of a sequence Order prediction-based Temporal Normality learning (OTN) module that captures the temporal correlations within sequences, and a Distance prediction-based Spatial Normality learning (DSN) module that learns the relative spatial relations between sequences in a feature space. By synthesizing these two modules, STEN learns expressive spatial-temporal representations for the normal patterns hidden in the time series data. Extensive experiments on five popular TSAD benchmarks show that STEN substantially outperforms state-of-the-art competing methods. Our code is available at https://github.com/mala-lab/STEN.","url_abs":"https://arxiv.org/abs/2406.19770v1","url_pdf":"https://arxiv.org/pdf/2406.19770v1.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":"self-supervised-spatial-temporal-normality","repo_url":"https://github.com/mala-lab/sten","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok"}}],"tasks":[{"task_slug":"anomaly-detection","task_name":"Anomaly Detection"},{"task_slug":"time-series-1","task_name":"Time Series"},{"task_slug":"time-series-anomaly-detection","task_name":"Time Series Anomaly Detection"}],"methods":[{"method_slug":"focus","method_name":"Focus"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2406.19770","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2406.19770"}},"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/mala-lab/sten","reach":{"status":"ok"}}],"summary":{"ran":18,"unverified":4},"by_repo_kind":{"official":{"samples":22,"ran":18,"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":22,"samples":[{"code_sha256_prefix":"d404bee58fedcd26","entry":"E_gt_func","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/affiliation/_affiliation_zone.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/affiliation/_affiliation_zone.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d404bee58fedcd26"}},{"code_sha256_prefix":"5b15105ac4a406f6","entry":"auc_pr","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/_anomaly_detection.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/_anomaly_detection.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"5b15105ac4a406f6"}},{"code_sha256_prefix":"69f0cb37c656f2ed","entry":"auc_roc","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/_anomaly_detection.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/_anomaly_detection.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"69f0cb37c656f2ed"}},{"code_sha256_prefix":"8f8697a132293736","entry":"convert_vector_to_events","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/affiliation/generics.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/affiliation/generics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8f8697a132293736"}},{"code_sha256_prefix":"8a3cb24dcc21da58","entry":"generate_data","repo":"mala-lab/sten","repo_kind":"official","path":"utils/data.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/utils/data.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"8a3cb24dcc21da58"}},{"code_sha256_prefix":"fbe988b1d8858b93","entry":"get_adjust_F1PA","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/metrics.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/metrics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fbe988b1d8858b93"}},{"code_sha256_prefix":"2ad5606541f726c4","entry":"get_sub_seqs","repo":"mala-lab/sten","repo_kind":"official","path":"utils/utility.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/utils/utility.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"2ad5606541f726c4"}},{"code_sha256_prefix":"6609607d0b6bb345","entry":"get_sub_seqs_label","repo":"mala-lab/sten","repo_kind":"official","path":"utils/utility.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/utils/utility.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"6609607d0b6bb345"}},{"code_sha256_prefix":"356c56fa1f7667a1","entry":"has_point_anomalies","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/affiliation/generics.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/affiliation/generics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"356c56fa1f7667a1"}},{"code_sha256_prefix":"fb1b5ffef7b2069f","entry":"import_ts_data_unsupervised","repo":"mala-lab/sten","repo_kind":"official","path":"utils/dataloading.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/utils/dataloading.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"fb1b5ffef7b2069f"}},{"code_sha256_prefix":"d2e653db871e18d5","entry":"infer_Trange","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/affiliation/generics.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/affiliation/generics.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d2e653db871e18d5"}},{"code_sha256_prefix":"19f48f4d2af20ece","entry":"interval_intersection","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/affiliation/_integral_interval.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/affiliation/_integral_interval.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"19f48f4d2af20ece"}},{"code_sha256_prefix":"224f0e59f24ef978","entry":"interval_length","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/affiliation/_integral_interval.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/affiliation/_integral_interval.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"224f0e59f24ef978"}},{"code_sha256_prefix":"f64cec27bc739f6b","entry":"point_adjustment","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/_tsad_adjustment.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/_tsad_adjustment.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f64cec27bc739f6b"}},{"code_sha256_prefix":"64b9b03651a884fd","entry":"sum_interval_lengths","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/affiliation/_integral_interval.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/affiliation/_integral_interval.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"64b9b03651a884fd"}},{"code_sha256_prefix":"69f0580795e596bb","entry":"t_start","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/affiliation/_affiliation_zone.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/affiliation/_affiliation_zone.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"69f0580795e596bb"}},{"code_sha256_prefix":"d67287c6f0371922","entry":"t_stop","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/affiliation/_affiliation_zone.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/affiliation/_affiliation_zone.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d67287c6f0371922"}},{"code_sha256_prefix":"f97620592d90b232","entry":"tabular_metrics","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/_anomaly_detection.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/_anomaly_detection.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"f97620592d90b232"}},{"code_sha256_prefix":"5217682972bdb339","entry":"affiliation_precision_distance","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/affiliation/_single_ground_truth_event.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/affiliation/_single_ground_truth_event.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":"5217682972bdb339"}},{"code_sha256_prefix":"8609c6f18260493f","entry":"affiliation_precision_proba","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/affiliation/_single_ground_truth_event.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/affiliation/_single_ground_truth_event.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":"8609c6f18260493f"}},{"code_sha256_prefix":"4967c38c3a40570a","entry":"affiliation_recall_distance","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/affiliation/_single_ground_truth_event.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/affiliation/_single_ground_truth_event.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":"4967c38c3a40570a"}},{"code_sha256_prefix":"055f6e8b0a798866","entry":"pr_from_events","repo":"mala-lab/sten","repo_kind":"official","path":"metrics/affiliation/metrics.py","file_url":"https://github.com/mala-lab/sten/blob/HEAD/metrics/affiliation/metrics.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":"055f6e8b0a798866"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}