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

feat: add minuit_modifier constructor argument #399

Merged
merged 5 commits into from
Jan 11, 2022
Merged

Conversation

redeboer
Copy link
Member

@redeboer redeboer commented Jan 11, 2022

This makes it possible to access iminuit.Minuit's methods and attributes before calling optimize().

Usage example here.

This makes it possible to modify the internal iminuit.Minuit optimizer before calling optimize()
@redeboer redeboer added this to the 0.4.2 milestone Jan 11, 2022
@redeboer redeboer self-assigned this Jan 11, 2022
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@redeboer
Copy link
Member Author

redeboer commented Jan 11, 2022

@Leongrim, have a look if this helps. Preview instructions here.
@spflueger, I don't like the way setup() modifies the behaviour of optimize(), but this is the best I could come up with for now given this Optimizer interface.

@spflueger
Copy link
Member

spflueger commented Jan 11, 2022

Why does the minuit instance have to be tweaked before optimize? Cant that be done at construction?

A more general question. As far as I remember the operator interface is solely connected to the user. So a user can swap optimizers and does not have to adjust the optimize call. But the optimizer interface is not used in tensorwaves internally right?
Hence the interface is not really needed per se. Just some consistency thing for the user. So if this becomes too restrictive, then I think it can be abandoned.

@redeboer
Copy link
Member Author

redeboer commented Jan 11, 2022

Why does the minuit instance have to be tweaked before optimize? Cant that be done at construction?

I would have preferred that too, but one needs an estimator and the free parameters in order to construct an iminuit.Minuit instance. That would mean these become tied to the constructor, so each TensorWaves Minuit2 instance becomes specific to each set of free parameters. (At the same time though, this setup() method just obscures that fact and one can mess up things by for instance inserting a different estimator in setup() than in optimize()...)

A more general question. As far as I remember the operator interface is solely connected to the user. So a user can swap optimizers and does not have to adjust the optimize call. But the optimizer interface is not used in tensorwaves internally right? Hence the interface is not really needed per se. Just some consistency thing for the user. But if this is too restrictive. Then I think it can be abandoned.

[optimizer interface?] Yes, the Optimizer interface class is only used as an ABC to optimizer implementations and optimizer instances are not (currently) used elsewhere in the source code.

@spflueger
Copy link
Member

@redeboer Ok maybe we can do a quick call to discuss this.

@redeboer
Copy link
Member Author

@redeboer Ok maybe we can do a quick call to discuss this.

@spflueger Done ✔️ Usage can be previewed here. Not the most pretty, but less error prone than this setup() method.

@redeboer redeboer changed the title feat: add Minuit2.setup() method feat: add minuit_modifier constructor argument Jan 11, 2022
@spflueger
Copy link
Member

@redeboer Ok maybe we can do a quick call to discuss this.

@spflueger Done heavy_check_mark Usage can be previewed here. Not the most pretty, but less error prone than this setup() method.

LGTM

@redeboer redeboer marked this pull request as ready for review January 11, 2022 16:07
@redeboer redeboer enabled auto-merge (squash) January 11, 2022 16:07
@redeboer redeboer merged commit 80a80fe into main Jan 11, 2022
@redeboer redeboer deleted the tweak-iminuit branch January 11, 2022 16:14
@redeboer redeboer changed the title feat: add minuit_modifier constructor argument feat: add minuit_modifier constructor argument Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Released
Development

Successfully merging this pull request may close these issues.

None yet

2 participants