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

Define FitResult class #165

Open
redeboer opened this issue Nov 16, 2020 · 5 comments
Open

Define FitResult class #165

redeboer opened this issue Nov 16, 2020 · 5 comments
Labels
🔨 Maintenance Maintenance and upkeep improvements ❔ Question Discuss this matter in the team

Comments

@redeboer
Copy link
Member

redeboer commented Nov 16, 2020

Some thoughts:

@redeboer redeboer self-assigned this Nov 16, 2020
@redeboer redeboer transferred this issue from ComPWA/expertsystem Nov 17, 2020
@redeboer redeboer added ❔ Question Discuss this matter in the team 🔨 Maintenance Maintenance and upkeep improvements labels Nov 17, 2020
@jonas-eschle
Copy link
Contributor

What is exactly the purpose of the FitResult? Because in zfit we already define a fitresult API and in general it would be nice to converge on all this APIs if there isn't a good idea why to deviate.

What should the FitResult roughly do?

@redeboer
Copy link
Member Author

Not sure yet, it serves more as a note in the ticket system.

@redeboer
Copy link
Member Author

Background is this discussion #164 (comment)

@spflueger
Copy link
Member

List of things the FitResult has to be able to do (in my opinion):

  • Store all info, which initialized the fit (initial parameters) and the final state of the process (final parameters). I would also include an estimator value, here. (These things would be common to any kind of Optimizer)
  • [Optional/Optimizer dependent] Store infos like error estimates. Some Optimizers cannot directly provide this info. Therefore this info would have to be obtained by running a second Optimizer afterwards (or some code which can determine the errors).
  • [Optional/Optimizer dependent] All setting information of the Optimizer. The use case for this is to be to be able to keep track of different fits that have been performed.

That are all the requirements I can come up with. The current solution with the dict is just a "placerholder" solution, but it already encapsulates the idea. That is the FitResult should be a simple datastructure without any logic. I currently do not see any downside to this. The advantage is that things are very simple and yet flexible. Not sure what you think about this @mayou36

The implementation is another quite difficult question. I even opened a stack overflow thread for this a while ago, with no real conclusion. In ComPWA (c++) we picked a templated version of a FitResult. So this would correspond to a Generic class here. The idea was to include info in the Generic base of FitResult, that is common to FitResults from any possible Optimizer. This would be info like the initial and final parameters, or runtime, etc. Any Optimizer specific info would be injected in the result via the Generic.

A dict would be an alternative solutions (could be used also in class and be a substitute for the Generic).

@jonas-eschle
Copy link
Contributor

Hey, sorry for the late reply, I missed your answer! So what we have in zfit is a class FitResult and we solved it the following way

There are mandatory attributes including:

  • fmin
  • edm
  • converged
  • valid
  • info (dict with a lot of, and arbitrary, information
  • params (holds all the infos: value, uncertainties etc)
    together with two methods that can be executed, the info from the is added to the params dics
  • hesse (error with hessian approximation)
  • errors (minos-like error estimation, but can be completely independent)

All the additional information is stored in the info and can be arbitrary. This is where uncertainties from the minimizer are stored.

With time, more attributes can be added. Whateve we see is needed.

And the dicts basically solve all the problems of fixed structures (Python FTW).

@redeboer redeboer added this to the Release 0.2.2 milestone Mar 24, 2021
@redeboer redeboer added ❔ Question Discuss this matter in the team and removed ❔ Question Discuss this matter in the team labels Mar 26, 2021
@redeboer redeboer removed their assignment Mar 31, 2021
@redeboer redeboer removed this from the Release 0.2.4 milestone Apr 15, 2021
@redeboer redeboer changed the title Define FitResult class Define FitResult class Apr 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 Maintenance Maintenance and upkeep improvements ❔ Question Discuss this matter in the team
Projects
None yet
Development

No branches or pull requests

3 participants