deepcharles / ruptures

ruptures: change point detection in Python
BSD 2-Clause "Simplified" License
1.56k stars 161 forks source link

fix(CostL2): set min_size to 1 #255

Closed deepcharles closed 2 years ago

deepcharles commented 2 years ago

The min_size parameter was set to 2 for CostL2 and produced bad segmentations for small signals (see Issue #242).

Now it is set to 1 by default.

deepcharles commented 2 years ago

resolves #242

codecov[bot] commented 2 years ago

Codecov Report

Merging #255 (fbc6e4d) into master (939e7e2) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #255   +/-   ##
=======================================
  Coverage   98.77%   98.77%           
=======================================
  Files          40       40           
  Lines         978      978           
=======================================
  Hits          966      966           
  Misses         12       12           
Flag Coverage Δ
unittests 98.77% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/ruptures/costs/costl2.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 939e7e2...fbc6e4d. Read the comment docs.

oboulant commented 2 years ago

I would add to the tests a special case for CostL2 where we explicitly check that the cost computed on a segment of size 1 returns 0.0 (and do not throw an NotEnoughPoints).