Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow Binseg to hit minsize bounds for segments #249

Merged
merged 6 commits into from
Apr 28, 2022

Conversation

oboulant
Copy link
Collaborator

@oboulant oboulant commented Apr 6, 2022

Binseg detection method fails at finding segments of length equals to min_size.


To reproduces 🔽

import numpy as np
from ruptures.detection import Binseg

signal = np.array([0,0.3,0.2,0.1, 10,11,12,13])
algo = Binseg(model="normal",jump=1).fit(signal)
computed_break_dict={n_bkps:algo.predict(n_bkps=n_bkps) for n_bkps in range(4)}
print(computed_break_dict)
expected_break_dict = {
    0:[8],
    1:[4,8],
    2:[4,6,8],
    3:[2,4,6,8]
    }
print(expected_break_dict)

Resolves #244

@github-actions github-actions bot added the Type: Fix Bug or Bug fixes label Apr 6, 2022
@codecov
Copy link

codecov bot commented Apr 6, 2022

Codecov Report

Merging #249 (a1633c3) into master (2bd37c2) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #249   +/-   ##
=======================================
  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/detection/binseg.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 2bd37c2...a1633c3. Read the comment docs.

@deepcharles deepcharles merged commit 939e7e2 into master Apr 28, 2022
@deepcharles deepcharles deleted the fix-binseg-minsize-bounds branch April 28, 2022 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Fix Bug or Bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

binseg incorrect for normal model with 8 data points
2 participants