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

Stabilize muon intensity fit #2425

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

RuneDominik
Copy link
Member

@RuneDominik RuneDominik commented Oct 25, 2023

See #2415

The cause of this issue might be that the likelihood values grow quite large and thus minuit does not converge properly as the values leave the [0, 1]-range by several orders of magnitude.

@maxnoe suggested to divide the likelihood used by the dof to lower the value. The likelihood is constructed to asymptotically resemble a chi2 so this changes the approach to chi2 per dof which does not change the minimum.

This does, ofc., not make the test more robust in any way.

@maxnoe
Copy link
Member

maxnoe commented Oct 27, 2023

This does, ofc., not make the test more robust in any way.

If this fixes the numerical issue that was the root cause, why not?

return np.sum(neg_log_l)
# neg_log_l provides the variable term, add constants here to only
# compute them once
return 0.5 * (len(neg_log_l) * np.log(2 * np.pi) + np.sum(neg_log_l))
Copy link
Member

Choose a reason for hiding this comment

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

log(2π) could be a global constant.

Copy link
Member

Choose a reason for hiding this comment

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

Also, do we gain something by putting an njit on this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've tried, this actually resulted in a slower computation time in my tests. Probably due this function only using basic numpy functions and thus already being vectorized,

@maxnoe
Copy link
Member

maxnoe commented Oct 30, 2023

Docs builds failure is fixed in main, please rebase

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

Successfully merging this pull request may close these issues.

2 participants