{"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/xtsformer-cross-temporal-scale-transformer","title":"XTSFormer: Cross-Temporal-Scale Transformer for Irregular-Time Event Prediction in Clinical Applications","arxiv_id":"2402.02258","date":"2024-02-03","proceeding":null,"authors":["Tingsong Xiao","Zelin Xu","Wenchong He","Zhengkun Xiao","Yupu Zhang","Zibo Liu","Shigang Chen","My T. Thai","Jiang Bian","Parisa Rashidi","Zhe Jiang"],"abstract":"Adverse clinical events related to unsafe care are among the top ten causes of death in the U.S. Accurate modeling and prediction of clinical events from electronic health records (EHRs) play a crucial role in patient safety enhancement. An example is modeling de facto care pathways that characterize common step-by-step plans for treatment or care. However, clinical event data pose several unique challenges, including the irregularity of time intervals between consecutive events, the existence of cycles, periodicity, multi-scale event interactions, and the high computational costs associated with long event sequences. Existing neural temporal point processes (TPPs) methods do not effectively capture the multi-scale nature of event interactions, which is common in many real-world clinical applications. To address these issues, we propose the cross-temporal-scale transformer (XTSFormer), specifically designed for irregularly timed event data. Our model consists of two vital components: a novel Feature-based Cycle-aware Time Positional Encoding (FCPE) that adeptly captures the cyclical nature of time, and a hierarchical multi-scale temporal attention mechanism, where different temporal scales are determined by a bottom-up clustering approach. Extensive experiments on several real-world EHR datasets show that our XTSFormer outperforms multiple baseline methods. The code is available at https://github.com/spatialdatasciencegroup/XTSFormer.","url_abs":"https://arxiv.org/abs/2402.02258v2","url_pdf":"https://arxiv.org/pdf/2402.02258v2.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":"xtsformer-cross-temporal-scale-transformer","repo_url":"https://github.com/spatialdatasciencegroup/xtsformer","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":null}],"tasks":[{"task_slug":"point-processes","task_name":"Point Processes"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/2402.02258","atlas_url":"https://app.syntology.ai/?focus=2402.02258","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2402.02258"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-25T09:33:49+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/spatialdatasciencegroup/xtsformer","reach":null}],"summary":{"ran_fixture":1,"ran_honours":1,"ran_draft_wrong":1},"by_repo_kind":{"official":{"samples":3,"ran":3,"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":3,"samples":[{"code_sha256_prefix":"e0734fa71a8f2251","entry":"preprocess_seq_sliding_window","repo":"spatialdatasciencegroup/xtsformer","repo_kind":"official","path":"XTSFormer/dataset.py","file_url":"https://github.com/spatialdatasciencegroup/xtsformer/blob/HEAD/XTSFormer/dataset.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e0734fa71a8f2251"}},{"code_sha256_prefix":"d7dd37a9239fc8a4","entry":"read_medication_csv","repo":"spatialdatasciencegroup/xtsformer","repo_kind":"official","path":"XTSFormer/dataset.py","file_url":"https://github.com/spatialdatasciencegroup/xtsformer/blob/HEAD/XTSFormer/dataset.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"d7dd37a9239fc8a4"}},{"code_sha256_prefix":"ca07e01936e567cf","entry":"read_medication_data","repo":"spatialdatasciencegroup/xtsformer","repo_kind":"official","path":"XTSFormer/dataset.py","file_url":"https://github.com/spatialdatasciencegroup/xtsformer/blob/HEAD/XTSFormer/dataset.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":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"ca07e01936e567cf"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}