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: sanity_check usage when n_bkps is not explicitly specified #190

Merged
merged 2 commits into from
Jul 28, 2021

Conversation

oboulant
Copy link
Collaborator

In cases where the n_bkps is not explicitly specified, current sanity_check() usage does not reflect how it should be used. Indeed, in some cases, finding 0 n_bkps is a fine results. Therefore, we should not make the assumption that there is at least 1 break point in the following cases :

  • Binseg : if the n_bkps is not specified at predict() time, then allow for 0 break points
  • BottomUp : if the n_bkps is not specified at predict() time, then allow for 0 break points
  • Window : if the n_bkps is not specified at predict() time, then allow for 0 break points
  • Pelt : allow for 0 break points

There is one special case :

  • KernelCPD : our C implementation make the assumption that when it is called, we are looking for at least 1 break point. Therefore, for this class, even if "in theory" for the Pelt option allows for 0 break point, we keep the sanity_checks() usage to reflect implementation choices.

Tests are also modified accordingly.

closes #188

@oboulant oboulant changed the title Fix sanity_check usage when n_bkps is not explicitly specified fix sanity_check usage when n_bkps is not explicitly specified Jul 26, 2021
@codecov
Copy link

codecov bot commented Jul 26, 2021

Codecov Report

Merging #190 (dc878fb) into master (d211c5c) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #190   +/-   ##
=======================================
  Coverage   96.31%   96.31%           
=======================================
  Files          40       40           
  Lines         978      978           
=======================================
  Hits          942      942           
  Misses         36       36           
Impacted Files Coverage Δ
src/ruptures/detection/binseg.py 100.00% <ø> (ø)
src/ruptures/detection/bottomup.py 100.00% <ø> (ø)
src/ruptures/detection/kernelcpd.py 100.00% <ø> (ø)
src/ruptures/detection/pelt.py 100.00% <ø> (ø)
src/ruptures/detection/window.py 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 d211c5c...dc878fb. Read the comment docs.

@oboulant oboulant changed the title fix sanity_check usage when n_bkps is not explicitly specified fix: sanity_check usage when n_bkps is not explicitly specified Jul 26, 2021
@oboulant oboulant marked this pull request as ready for review July 27, 2021 07:25
Copy link
Owner

@deepcharles deepcharles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merci beaucoup @oboulant !

@deepcharles deepcharles added the Type: Fix Bug or Bug fixes label Jul 27, 2021
@oboulant oboulant merged commit fe2b352 into master Jul 28, 2021
@oboulant oboulant deleted the fix-sanity-usage branch July 28, 2021 11:53
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.

Too strict sanity check for Pelt model?
2 participants