Skip to content

Pure, immutable ParametrizedFunction #568

Description

@redeboer

Replace the stateful parameter contract of ParametrizedFunction with pure evaluation:

  • function(data, parameters): parameter values are merged with the construction-time defaults per call and are never sticky.
  • with_parameters(): returns a new function with updated defaults (for post-fit plotting, data generation, etc.). The compiled backend function is shared, so this is cheap.
  • update_parameters() is removed and ParametrizedBackendFunction becomes immutable (frozen).

This makes functions thread-safe and free of hidden side effects: estimators no longer mutate the user's function on every call. Estimator internals switch to the pure call and the documentation notebooks migrate to the new idioms in the same PR.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions