{"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/data-augmentation-for-electrocardiograms","title":"Data Augmentation for Electrocardiograms","arxiv_id":"2204.04360","date":"2022-04-09","proceeding":null,"authors":["Aniruddh Raghu","Divya Shanmugam","Eugene Pomerantsev","John Guttag","Collin M. Stultz"],"abstract":"Neural network models have demonstrated impressive performance in predicting pathologies and outcomes from the 12-lead electrocardiogram (ECG). However, these models often need to be trained with large, labelled datasets, which are not available for many predictive tasks of interest. In this work, we perform an empirical study examining whether training time data augmentation methods can be used to improve performance on such data-scarce ECG prediction problems. We investigate how data augmentation strategies impact model performance when detecting cardiac abnormalities from the ECG. Motivated by our finding that the effectiveness of existing augmentation strategies is highly task-dependent, we introduce a new method, TaskAug, which defines a flexible augmentation policy that is optimized on a per-task basis. We outline an efficient learning algorithm to do so that leverages recent work in nested optimization and implicit differentiation. In experiments, considering three datasets and eight predictive tasks, we find that TaskAug is competitive with or improves on prior work, and the learned policies shed light on what transformations are most effective for different tasks. We distill key insights from our experimental evaluation, generating a set of best practices for applying data augmentation to ECG prediction problems.","url_abs":"https://arxiv.org/abs/2204.04360v1","url_pdf":"https://arxiv.org/pdf/2204.04360v1.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":"data-augmentation-for-electrocardiograms","repo_url":"https://github.com/aniruddhraghu/ecg_aug","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"Apache-2.0"}}],"tasks":[{"task_slug":"data-augmentation","task_name":"Data Augmentation"}],"methods":[],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2204.04360","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2204.04360"}},"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/aniruddhraghu/ecg_aug","reach":{"status":"ok","spdx":"Apache-2.0"}}],"summary":{"unverified":14},"by_repo_kind":{"official":{"samples":14,"ran":0,"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":"f77132e6e07362a5","entry":"all_ops","repo":"aniruddhraghu/ecg_aug","repo_kind":"official","path":"aug_policy.py","file_url":"https://github.com/aniruddhraghu/ecg_aug/blob/HEAD/aug_policy.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"f77132e6e07362a5"}},{"code_sha256_prefix":"3c3fcd9021d77049","entry":"baseline_wander","repo":"aniruddhraghu/ecg_aug","repo_kind":"official","path":"functional.py","file_url":"https://github.com/aniruddhraghu/ecg_aug/blob/HEAD/functional.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"3c3fcd9021d77049"}},{"code_sha256_prefix":"babbdd13569d12fb","entry":"conv15x1","repo":"aniruddhraghu/ecg_aug","repo_kind":"official","path":"models.py","file_url":"https://github.com/aniruddhraghu/ecg_aug/blob/HEAD/models.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"babbdd13569d12fb"}},{"code_sha256_prefix":"5745974ee9419ea2","entry":"full_policy","repo":"aniruddhraghu/ecg_aug","repo_kind":"official","path":"aug_policy.py","file_url":"https://github.com/aniruddhraghu/ecg_aug/blob/HEAD/aug_policy.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"5745974ee9419ea2"}},{"code_sha256_prefix":"39ed79585e665e7c","entry":"gather_flat_grad","repo":"aniruddhraghu/ecg_aug","repo_kind":"official","path":"taskaug.py","file_url":"https://github.com/aniruddhraghu/ecg_aug/blob/HEAD/taskaug.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"39ed79585e665e7c"}},{"code_sha256_prefix":"16242b2c7a63e743","entry":"gaussian_noise","repo":"aniruddhraghu/ecg_aug","repo_kind":"official","path":"functional.py","file_url":"https://github.com/aniruddhraghu/ecg_aug/blob/HEAD/functional.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"16242b2c7a63e743"}},{"code_sha256_prefix":"46f2a67ab0375bf0","entry":"get_hyper_train_flat","repo":"aniruddhraghu/ecg_aug","repo_kind":"official","path":"taskaug.py","file_url":"https://github.com/aniruddhraghu/ecg_aug/blob/HEAD/taskaug.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"46f2a67ab0375bf0"}},{"code_sha256_prefix":"c8cc5d297ead6d57","entry":"get_loss","repo":"aniruddhraghu/ecg_aug","repo_kind":"official","path":"baseline.py","file_url":"https://github.com/aniruddhraghu/ecg_aug/blob/HEAD/baseline.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"c8cc5d297ead6d57"}},{"code_sha256_prefix":"34615160a839a22d","entry":"get_preds","repo":"aniruddhraghu/ecg_aug","repo_kind":"official","path":"baseline.py","file_url":"https://github.com/aniruddhraghu/ecg_aug/blob/HEAD/baseline.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"34615160a839a22d"}},{"code_sha256_prefix":"db9e01c78411b855","entry":"neumann_hyperstep_preconditioner","repo":"aniruddhraghu/ecg_aug","repo_kind":"official","path":"taskaug.py","file_url":"https://github.com/aniruddhraghu/ecg_aug/blob/HEAD/taskaug.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"db9e01c78411b855"}},{"code_sha256_prefix":"cde3852e96a5a541","entry":"rand_temporal_warp","repo":"aniruddhraghu/ecg_aug","repo_kind":"official","path":"functional.py","file_url":"https://github.com/aniruddhraghu/ecg_aug/blob/HEAD/functional.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"cde3852e96a5a541"}},{"code_sha256_prefix":"81f0ae2595a80555","entry":"resnet18","repo":"aniruddhraghu/ecg_aug","repo_kind":"official","path":"models.py","file_url":"https://github.com/aniruddhraghu/ecg_aug/blob/HEAD/models.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"81f0ae2595a80555"}},{"code_sha256_prefix":"d4af8e9568a847d3","entry":"resnet34","repo":"aniruddhraghu/ecg_aug","repo_kind":"official","path":"models.py","file_url":"https://github.com/aniruddhraghu/ecg_aug/blob/HEAD/models.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"d4af8e9568a847d3"}},{"code_sha256_prefix":"02aeb8cc5d89ffe6","entry":"update_lossdict","repo":"aniruddhraghu/ecg_aug","repo_kind":"official","path":"baseline.py","file_url":"https://github.com/aniruddhraghu/ecg_aug/blob/HEAD/baseline.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"02aeb8cc5d89ffe6"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}