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

confusing warning/error #45

Closed
tdhock opened this issue Oct 8, 2020 · 3 comments
Closed

confusing warning/error #45

tdhock opened this issue Oct 8, 2020 · 3 comments
Assignees

Comments

@tdhock
Copy link

tdhock commented Oct 8, 2020

hi @rkillick I'm using changepoint in my teaching https://github.com/tdhock/cs499-599-fall-2020/blob/master/homeworks/8.org
I recommended my students use the code

changepoint::cpt.mean(logratio_vector, Q=100, method=BinSeg”, penalty=Manual”)

and one student was wondering if it is normal to see a lot of warnings. For example,

> fit6 <- changepoint::cpt.mean(rnorm(10), penalty="Manual", method="BinSeg", pen.value=0, Q=6)
Warning message:
In BINSEG(sumstat, pen = pen.value, cost_func = costfunc, minseglen = minseglen,  :
  The number of changepoints identified is Q, it is advised to increase Q to make sure changepoints have not been missed.
> 

But if I increase Q I get an error:

> fit7 <- changepoint::cpt.mean(rnorm(10), penalty="Manual", method="BinSeg", pen.value=0, Q=7)
Error in BINSEG(sumstat, pen = pen.value, cost_func = costfunc, minseglen = minseglen,  : 
  Q is larger than the maximum number of segments 6
> 

so that brings up two questions:

  • can you please remove the warning when the user specifies pen.value=0? in that case the largest model will always be returned and that is no surprise (no need to warn).
  • can maximum number of segments be the number of data points? (10 instead of 6 in this example)

Thanks!
Toby

@rkillick
Copy link
Owner

rkillick commented Oct 9, 2020

Ooooooh interesting!

  • can you please remove the warning when the user specifies pen.value=0? in that case the largest model will always be returned and that is no surprise (no need to warn).

Yes, I agree that this is a special case that isn't currently considered separately.

  • can maximum number of segments be the number of data points? (10 instead of 6 in this example)
    Thanks for spotting this. The check was hardcoded in the BINSEG function as n/2+1 whereas it should be n/minseglen+1.

@rkillick
Copy link
Owner

rkillick commented Oct 9, 2020

Done in the github version. Not pushed to CRAN yet as i'm doing final tests on the cpt.reg function before the next release.

@rkillick rkillick closed this as completed Oct 9, 2020
@tdhock
Copy link
Author

tdhock commented Oct 9, 2020

great thanks for the quick response Rebecca!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants