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

Make minuit instance once for multiple hypotheses #52

Open
dachengx opened this issue Jul 22, 2023 · 2 comments
Open

Make minuit instance once for multiple hypotheses #52

dachengx opened this issue Jul 22, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@dachengx
Copy link
Collaborator

A Minuit instance is initialized every time we call StatisticalModel.fit, in some cases when there are a lot of hypotheses, the computational efficiency is not so high.

m = Minuit(
MinuitWrap(cost, s_args=self.parameters.names),
**defaults)

@dachengx dachengx self-assigned this Jul 22, 2023
@dachengx dachengx added the enhancement New feature or request label Jul 22, 2023
@dachengx
Copy link
Collaborator Author

Well, if the toydata is generated once per iteration, and multiple hypotheses are required, we should initiate the Minuit once, because it is only a function of toydata set and likelihood definition.

@hammannr
Copy link
Collaborator

It's true though if I remember correctly it caches some of the gradients. Do you have an estimate of whether this is a sizeable effect? Only then I would consider reusing the same instance multiple time (we should anyways time all of this at some point (#20 ).
If we want to implement it we could do it by defining self.minuit_object = None in the init, only generate it when it's not None and set it to None if we assign new data or something 😊

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

No branches or pull requests

2 participants