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

Warn when parameter hits bounds #2525

Open
1 task done
lorenzennio opened this issue Jun 26, 2024 · 3 comments · May be fixed by #2526
Open
1 task done

Warn when parameter hits bounds #2525

lorenzennio opened this issue Jun 26, 2024 · 3 comments · May be fixed by #2526
Assignees
Labels
feat/enhancement New feature or request optimization

Comments

@lorenzennio
Copy link
Contributor

Summary

Hey,
I recently ran a lot of toys for a very large model and had a hard time debugging, as some nuisance parameters hit the parameter bounds for some of the toys.
It would be great if a warning could be added in that case. What do you think?

Additional Information

A simple example:

import pyhf

bkg = [5]
sig = [3]

data = bkg

samples = [
    dict(name="signal", data=list(sig), modifiers=[dict(name="mu", type="normfactor", data=None)]),
    dict(name="background", data=list(bkg), modifiers=[]),
]
model = pyhf.Model(dict(channels=[dict(name="singlechannel", samples=samples)]))

init = [5]
bounds =[(3, 10)]
pyhf.infer.mle.fit(data, model, init_pars=init, par_bounds=bounds)

Code of Conduct

  • I agree to follow the Code of Conduct
@lorenzennio lorenzennio added feat/enhancement New feature or request needs-triage Needs a maintainer to categorize and assign labels Jun 26, 2024
@kratsg
Copy link
Contributor

kratsg commented Jun 26, 2024

Where do you forsee the error being raised? Would it be as part of optimization (which scipy's fortran routines have a warning for that I added a long time ago; but minuit really doesn't) or do you imagine this being done after the fit is done and we're checking all returned fitted parameter values (for non-fixed parameters) to see if any of them are matching the upper or lower bounds of those parameters?

@kratsg kratsg added question Further information is requested and removed needs-triage Needs a maintainer to categorize and assign labels Jun 26, 2024
@lorenzennio
Copy link
Contributor Author

Either is fine, I guess. I would have just checked after the fit is done. Or do you see any complications with this?

@kratsg
Copy link
Contributor

kratsg commented Jun 26, 2024

Or do you see any complications with this?

harder to do it as part of the fit, mostly because scipy and minuit are entirely different and trying to add a check while doing optimization will slow down the optimization at each stage. It should be somewhat straightforward to add a way to check the bounds are hit. Given you provided an example, then we have a good way to test that we catch it.

@kratsg kratsg added optimization and removed question Further information is requested labels Jun 26, 2024
@kratsg kratsg self-assigned this Jun 26, 2024
@kratsg kratsg linked a pull request Jun 26, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat/enhancement New feature or request optimization
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants