{"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/soft-dtw-a-differentiable-loss-function-for","title":"Soft-DTW: a Differentiable Loss Function for Time-Series","arxiv_id":"1703.01541","date":"2017-03-05","proceeding":"ICML 2017 8","authors":["Marco Cuturi","Mathieu Blondel"],"abstract":"We propose in this paper a differentiable learning loss between time series,\nbuilding upon the celebrated dynamic time warping (DTW) discrepancy. Unlike the\nEuclidean distance, DTW can compare time series of variable size and is robust\nto shifts or dilatations across the time dimension. To compute DTW, one\ntypically solves a minimal-cost alignment problem between two time series using\ndynamic programming. Our work takes advantage of a smoothed formulation of DTW,\ncalled soft-DTW, that computes the soft-minimum of all alignment costs. We show\nin this paper that soft-DTW is a differentiable loss function, and that both\nits value and gradient can be computed with quadratic time/space complexity\n(DTW has quadratic time but linear space complexity). We show that this\nregularization is particularly well suited to average and cluster time series\nunder the DTW geometry, a task for which our proposal significantly outperforms\nexisting baselines. Next, we propose to tune the parameters of a machine that\noutputs time series by minimizing its fit with ground-truth labels in a\nsoft-DTW sense.","url_abs":"http://arxiv.org/abs/1703.01541v2","url_pdf":"http://arxiv.org/pdf/1703.01541v2.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":"soft-dtw-a-differentiable-loss-function-for","repo_url":"https://github.com/mblondel/soft-dtw","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"paper_slug":"soft-dtw-a-differentiable-loss-function-for","repo_url":"https://github.com/Maghoumi/DeepNAG","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"soft-dtw-a-differentiable-loss-function-for","repo_url":"https://github.com/PeteWe/ts_similarity_tensorflow","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"tf","reach":{"status":"ok"}},{"paper_slug":"soft-dtw-a-differentiable-loss-function-for","repo_url":"https://github.com/baggepinnen/DynamicAxisWarping.jl","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"soft-dtw-a-differentiable-loss-function-for","repo_url":"https://github.com/jihyeonseong/SoM-TP","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"soft-dtw-a-differentiable-loss-function-for","repo_url":"https://github.com/keonlee9420/Soft-DTW-Loss","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"soft-dtw-a-differentiable-loss-function-for","repo_url":"https://github.com/khdlr/softdtw_jax","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"jax","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"soft-dtw-a-differentiable-loss-function-for","repo_url":"https://github.com/lyprince/sdtw_pytorch","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"soft-dtw-a-differentiable-loss-function-for","repo_url":"https://github.com/yueyaog/TSGEM_Clustering","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"none","reach":{"status":"ok","spdx":"GPL-3.0"}}],"tasks":[{"task_slug":"dynamic-time-warping","task_name":"Dynamic Time Warping"},{"task_slug":"time-series-1","task_name":"Time Series"},{"task_slug":"time-series","task_name":"Time Series Analysis"}],"methods":[{"method_slug":"dtw","method_name":"DTW"}],"datasets_introduced":[],"methods_introduced":[],"results":[],"syntology":{"syntology_url":"https://syntology.ai/paper/1703.01541","atlas_url":"https://app.syntology.ai/?focus=1703.01541","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"1703.01541"}},"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/keonlee9420/Soft-DTW-Loss","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/jihyeonseong/SoM-TP","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/khdlr/softdtw_jax","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lyprince/sdtw_pytorch","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/Maghoumi/DeepNAG","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/yueyaog/TSGEM_Clustering","reach":{"status":"ok","spdx":"GPL-3.0"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/PeteWe/ts_similarity_tensorflow","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mblondel/soft-dtw","reach":{"status":"ok","spdx":"BSD-2-Clause"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/baggepinnen/DynamicAxisWarping.jl","reach":{"status":"ok","spdx":"NOASSERTION"}}],"summary":{"ran_fixture":1,"unverified":10},"by_repo_kind":{"official":{"samples":2,"ran":0,"repositories":1},"listed":{"samples":9,"ran":1,"repositories":4}},"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":"e1ffef61f9ff62a7","entry":"sakoe_chiba_band","repo":"lyprince/sdtw_pytorch","repo_kind":"listed","path":"sdtw.py","file_url":"https://github.com/lyprince/sdtw_pytorch/blob/HEAD/sdtw.py","link_basis":"first_harvest_node","language":"python","status":"ran_fixture","verification_level":1,"contract_check":"RAISES","metamorphic_tier":"well_formed","behaviour_fingerprint":true,"licence":"NONE","inline_ok":false,"mcp_get_code":{"code_sha256":"e1ffef61f9ff62a7"}},{"code_sha256_prefix":"4f2a86831e92d61e","entry":"delannoy_num","repo":"mblondel/soft-dtw","repo_kind":"official","path":"sdtw/path.py","file_url":"https://github.com/mblondel/soft-dtw/blob/HEAD/sdtw/path.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"4f2a86831e92d61e"}},{"code_sha256_prefix":"c542e2fb148a11f8","entry":"dist_func_cos","repo":"Maghoumi/DeepNAG","repo_kind":"listed","path":"models/hausdorff_distance.py","file_url":"https://github.com/Maghoumi/DeepNAG/blob/HEAD/models/hausdorff_distance.py","link_basis":"harvester_set","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":"c542e2fb148a11f8"}},{"code_sha256_prefix":"f6de6e2b30a06bf5","entry":"distance_matrix","repo":"khdlr/softdtw_jax","repo_kind":"listed","path":"softdtw_jax/softdtw_jax.py","file_url":"https://github.com/khdlr/softdtw_jax/blob/HEAD/softdtw_jax/softdtw_jax.py","link_basis":"harvester_set","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":"f6de6e2b30a06bf5"}},{"code_sha256_prefix":"2331123dca3def2c","entry":"jacobean_product_squared_euclidean","repo":"keonlee9420/Soft-DTW-Loss","repo_kind":"listed","path":"sdtw_cuda_loss.py","file_url":"https://github.com/keonlee9420/Soft-DTW-Loss/blob/HEAD/sdtw_cuda_loss.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":"2331123dca3def2c"}},{"code_sha256_prefix":"1d66eaff37129b6a","entry":"jacobean_product_squared_euclidean","repo":"lyprince/sdtw_pytorch","repo_kind":"listed","path":"sdtw.py","file_url":"https://github.com/lyprince/sdtw_pytorch/blob/HEAD/sdtw.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":"1d66eaff37129b6a"}},{"code_sha256_prefix":"57a33bcae3c2374a","entry":"load_ucr","repo":"mblondel/soft-dtw","repo_kind":"official","path":"sdtw/dataset.py","file_url":"https://github.com/mblondel/soft-dtw/blob/HEAD/sdtw/dataset.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"BSD-2-Clause","inline_ok":true,"mcp_get_code":{"code_sha256":"57a33bcae3c2374a"}},{"code_sha256_prefix":"8f1d21b59b848f46","entry":"masked_max","repo":"Maghoumi/DeepNAG","repo_kind":"listed","path":"models/hausdorff_distance.py","file_url":"https://github.com/Maghoumi/DeepNAG/blob/HEAD/models/hausdorff_distance.py","link_basis":"harvester_set","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":"8f1d21b59b848f46"}},{"code_sha256_prefix":"f405ce4fd7400a67","entry":"masked_mean","repo":"Maghoumi/DeepNAG","repo_kind":"listed","path":"models/hausdorff_distance.py","file_url":"https://github.com/Maghoumi/DeepNAG/blob/HEAD/models/hausdorff_distance.py","link_basis":"harvester_set","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":"f405ce4fd7400a67"}},{"code_sha256_prefix":"05bf33cfc4c9c7cf","entry":"pad_inf","repo":"khdlr/softdtw_jax","repo_kind":"listed","path":"softdtw_jax/softdtw_jax.py","file_url":"https://github.com/khdlr/softdtw_jax/blob/HEAD/softdtw_jax/softdtw_jax.py","link_basis":"harvester_set","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":"05bf33cfc4c9c7cf"}},{"code_sha256_prefix":"3f0b3faa4c343689","entry":"softmin","repo":"lyprince/sdtw_pytorch","repo_kind":"listed","path":"sdtw.py","file_url":"https://github.com/lyprince/sdtw_pytorch/blob/HEAD/sdtw.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":"3f0b3faa4c343689"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}