hepstats.utils.fit.api_check module#

Module for testing a fitting library validity with hepstats.

A fitting library should provide six basic objects:

  • model / probability density function

  • parameters of the models

  • data

  • loss / likelihood function

  • minimizer

  • fitresult (optional)

A function for each object is defined in this module, all should return True to work with hepstats.

The zfit API is currently the standard fitting API in hepstats.

hepstats.utils.fit.api_check.is_valid_parameter(object)[source]#
Checks if a parameter has the following attributes/methods:
  • value

  • set_value

  • floating

hepstats.utils.fit.api_check.is_valid_data(object)[source]#
Checks if the data object has the following attributes/methods:
  • nevents

  • weights

  • set_weights

  • space

hepstats.utils.fit.api_check.is_valid_pdf(object)[source]#
Checks if the pdf object has the following attributes/methods:
  • get_params

  • pdf

  • integrate

  • sample

  • get_yield

Also the function is_valid_parameter is called with each of the parameters returned by get_params as argument.

hepstats.utils.fit.api_check.is_valid_loss(object)[source]#
Checks if the loss object has the following attributes/methods:
  • model

  • data

  • get_params

  • constraints

  • fit_range

Also the function is_valid_pdf is called with each of the models returned by model as argument. Additionnally the function is_valid_data is called with each of the data objects return by data as argument.

hepstats.utils.fit.api_check.is_valid_fitresult(object)[source]#
Checks if the fit result object has the following attributes/methods:
  • loss

  • params

  • covariance

Also the function is_valid_loss is called with the loss as argument.

hepstats.utils.fit.api_check.is_valid_minimizer(object)[source]#
Checks if the minimzer object has the following attributes/methods:
  • minimize