tslearn/dtw-conflicting-constraints
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| tslearn | error | none, edit by hand | All versions |
tslearn.metrics._masks._compute_mask_generic executes raise RuntimeWarning(...) when global_constraint is unset (None or 0) and both sakoe_chiba_radius and itakura_max_slope are non-None. Even though the message mentions a warning, raise RuntimeWarning aborts execution as an exception.
dist = dtw(s1, s2, sakoe_chiba_radius=2, itakura_max_slope=2.0)dist = dtw(s1, s2, global_constraint="sakoe_chiba", sakoe_chiba_radius=2)What the rule reports
Section titled “What the rule reports”Calls to tslearn.metrics warping functions (dtw, dtw_path, cdist_dtw, soft_dtw, soft_dtw_normalized, cdist_soft_dtw, lcss, ctw, frechet, compute_mask, and their path variants) that pass both sakoe_chiba_radius and itakura_max_slope while omitting global_constraint or setting it to None / 0.
How to fix it
Section titled “How to fix it”Pass only the constraint you intend to enforce, and pair it with the matching global_constraint ("sakoe_chiba" or "itakura").
Diagnostic message
Section titled “Diagnostic message”Passing both sakoe_chiba_radius and itakura_max_slope without global_constraint raises RuntimeWarning as an exception in tslearn. Pass only one constraint argument or set global_constraint explicitly.See all rules in the tslearn pack.