Skip to content

Design philosophy and goals

Jonas Eschle edited this page Oct 10, 2019 · 3 revisions

Things should not be easy or hard. But consistent.

The design of zfit is guided by the following points:

  • One thing
    The library is meant to do one thing: model fitting. Additional capabilities like advanced plotting, statistics etc. are intentionally left to other libraries.

  • Simplicity
    As often stated, easy cases should be easy or at least straightforward and not hard. For simple, one dimensional models and fits, no extended knowledge about advanced concepts or pitfalls should be necessary. Making mistakes can only happen when clearly leaving the known grounds.

  • Consistency
    When going from the simple to the more complex case, it should not be necessary to learn a whole new set of rules and behavior. Instead, enough generality should be contained also in the simple case, even if it means to slightly heighten the knowledge required for it. The overall difficulty should gradually increase, and expert knowledge should only be required for expert problems.

  • Flexibility
    No library can ever cover everything, so special cases will need to be implemented specially, but most elements of the library should nonetheless be usable and only the special part has to be implemented specially.

These requirements can be conflicting. Especially flexibility and simplicity are hard to reconcile. A conflict arises with the potential of creating bugs: since not every case is the most complicated one, not every user will know about all peculiarities of the library and may uses the freedom in the wrong way. To avoid mistakes due to the lack of knowledge of the library but also incorporate the flexibility, follows the pythonic way:

  • “We’re all adults here": keep a high flexibility to allow the vast majority of use-cases to be implemented, although it needs of course additional knowledge and things are not fail-safe.

  • “There should be one – and preferably only one – obvious way to do it": to counter unintentional mistakes that may arise from the above, clear guidelines and examples on how to accomplish something specific are provided. This is especially important for the simpler cases, in which one clear way is shown.

Performance

An important aspect of fitting in general is performance. zfit does not aim to outperform other libraries. It aims to be:

  • scalable with computing resources: run on multiple cpus, multiple nodes, GPUs
  • scalable with data: a constantish weak scaling is expected with increasing amount of data/normalization
  • order of magnitude in speed should be as other libraries and there should be no significant performance penalty when using zfit compared to other libraries.
Clone this wiki locally