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 migrad_args option to Minuit2 optimizer #476

Merged
merged 1 commit into from
Jan 23, 2023

Conversation

redeboer
Copy link
Member

Closes #475

@redeboer redeboer added this to the 0.4.10 milestone Jan 23, 2023
@redeboer redeboer requested a review from Leongrim January 23, 2023 11:38
@redeboer redeboer self-assigned this Jan 23, 2023
@redeboer
Copy link
Member Author

@Leongrim, could you try out the branch of this PR?

pip install git+https://github.com/redeboer/tensorwaves@migrad-arguments
optimizer = Minuit2(
    migrad_args=dict(\
        ncall=...,
        iterate=...,
    ),
)
optimizer.optimize(estimator, initial_parameters)

@Leongrim
Copy link
Contributor

Leongrim commented Jan 23, 2023

Works really well.
Only one thing. If the input is not an int the error Minuit throws can be a little confusing.

TypeError: __call__(): incompatible function arguments. The following argument types are supported:
    1. (self: iminuit._core.MnApplication, arg0: int, arg1: float) -> ROOT::Minuit2::FunctionMinimum

Invoked with: <iminuit._core.MnMigrad object at 0x7f62bc94a830>, 1000000.0, 0.1```

I'm not sure if this is something we should take into account or not.
But since it already changing ncall is something that should be rarely necessary to change.

@redeboer
Copy link
Member Author

redeboer commented Jan 23, 2023

Only one thing. If the input is not an int the error Minuit throws can be a little confusing.

Which input type did you give? We could do some input evaluation (although that makes the code more complicated, possibly unnecessarily).

@redeboer
Copy link
Member Author

Oh I see, nvm, looks like float.

@Leongrim
Copy link
Contributor

I used a flaot (1e6).

@redeboer
Copy link
Member Author

I would leave it like that -- no input evaluation on migrad_args. Seems like iminuit.Minuit2.migrad() documents its signature well, and the TensorWaves documentation on migrad_args refers to that page.

@redeboer redeboer marked this pull request as ready for review January 23, 2023 12:30
@redeboer redeboer merged commit 678b5a1 into ComPWA:main Jan 23, 2023
@redeboer redeboer deleted the migrad-arguments branch January 23, 2023 12:31
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.

Setting number of iterations in migrad
2 participants