interfaces

class zfit.core.interfaces.ZfitConstraint[source]

Bases: abc.ABC

abstract value()[source]
class zfit.core.interfaces.ZfitData[source]

Bases: zfit.core.interfaces.ZfitDimensional

abstract property axes

Return the axes.

copy(deep: bool = False, **overwrite_params) → zfit.core.interfaces.ZfitObject
abstract property n_obs

Return the number of observables.

property name

Name prepended to all ops created by this model.

abstract property obs

Return the observables.

abstract sort_by_axes(axes, allow_superset: bool = False)[source]
abstract sort_by_obs(obs, allow_superset: bool = False)[source]
abstract property space

Return the Space object that defines the dimensionality of the object.

abstract value(obs: List[str] = None) → Union[float, tensorflow.python.framework.ops.Tensor][source]
abstract property weights
class zfit.core.interfaces.ZfitDependentsMixin[source]

Bases: object

abstract get_dependents(only_floating: bool = True) -> OrderedSet(['z', 'f', 'i', 't', '.', 'P', 'a', 'r', 'm', 'e'])[source]
class zfit.core.interfaces.ZfitDimensional[source]

Bases: zfit.core.interfaces.ZfitObject

abstract property axes

Return the axes.

copy(deep: bool = False, **overwrite_params) → zfit.core.interfaces.ZfitObject
abstract property n_obs

Return the number of observables.

property name

Name prepended to all ops created by this model.

abstract property obs

Return the observables.

abstract property space

Return the Space object that defines the dimensionality of the object.

class zfit.core.interfaces.ZfitFunc[source]

Bases: zfit.core.interfaces.ZfitModel

abstract as_pdf()[source]
abstract property axes

Return the axes.

copy(deep: bool = False, **overwrite_params) → zfit.core.interfaces.ZfitObject
abstract property dtype

The DType of Tensor`s handled by this `model.

abstract func(x: Union[float, tensorflow.python.framework.ops.Tensor], name: str = 'value') → Union[float, tensorflow.python.framework.ops.Tensor][source]
abstract get_dependents(only_floating: bool = True) -> OrderedSet(['z', 'f', 'i', 't', '.', 'P', 'a', 'r', 'm', 'e'])
abstract get_params(only_floating: bool = False, names: Union[str, List[str], None] = None) → List[zfit.core.interfaces.ZfitParameter]
abstract integrate(limits: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool], norm_range: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool] = None, name: str = 'integrate') → Union[float, tensorflow.python.framework.ops.Tensor]

Integrate the function over limits (normalized over norm_range if not False).

Parameters
  • limits (tuple, Space) – the limits to integrate over

  • norm_range (tuple, Space) – the limits to normalize over or False to integrate the unnormalized probability

  • name (str) –

Returns

the integral value

Return type

Tensor

abstract property n_obs

Return the number of observables.

property name

Name prepended to all ops created by this model.

abstract property obs

Return the observables.

abstract property params
abstract partial_integrate(x: Union[float, tensorflow.python.framework.ops.Tensor], limits: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool], norm_range: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool] = None, name: str = 'partial_integrate') → Union[float, tensorflow.python.framework.ops.Tensor]

Partially integrate the function over the limits and evaluate it at x.

Dimension of limits and x have to add up to the full dimension and be therefore equal to the dimensions of norm_range (if not False)

Parameters
  • x (numerical) – The value at which the partially integrated function will be evaluated

  • limits (tuple, Space) – the limits to integrate over. Can contain only some axes

  • norm_range (tuple, Space, False) – the limits to normalize over. Has to have all axes

  • name (str) –

Returns

the value of the partially integrated function evaluated at x.

Return type

Tensor

abstract classmethod register_analytic_integral(func: Callable, limits: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool] = None, priority: int = 50, *, supports_norm_range: bool = False, supports_multiple_limits: bool = False)

Register an analytic integral with the class.

Parameters

Returns:

abstract classmethod register_inverse_analytic_integral(func: Callable)

Register an inverse analytical integral, the inverse (unnormalized) cdf.

Parameters

() (func) –

abstract sample(n: int, limits: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool] = None, name: str = 'sample') → Union[float, tensorflow.python.framework.ops.Tensor]

Sample n points within limits from the model.

Parameters
  • n (int) – The number of samples to be generated

  • limits (tuple, Space) – In which region to sample in

  • name (str) –

Returns

Tensor(n_obs, n_samples)

abstract property space

Return the Space object that defines the dimensionality of the object.

abstract update_integration_options(*args, **kwargs)
class zfit.core.interfaces.ZfitFunctorMixin[source]

Bases: object

abstract get_models() → List[zfit.core.interfaces.ZfitModel][source]
abstract property models
class zfit.core.interfaces.ZfitLoss[source]

Bases: zfit.core.interfaces.ZfitObject, zfit.core.interfaces.ZfitDependentsMixin

abstract add_constraints(constraints: List[tensorflow.python.framework.ops.Tensor])[source]
copy(deep: bool = False, **overwrite_params) → zfit.core.interfaces.ZfitObject
abstract property data
abstract property errordef
abstract property fit_range
abstract get_dependents(only_floating: bool = True) -> OrderedSet(['z', 'f', 'i', 't', '.', 'P', 'a', 'r', 'm', 'e'])
abstract gradients(params: Union[zfit.core.interfaces.ZfitParameter, int, float, complex, tensorflow.python.framework.ops.Tensor] = None) → List[tensorflow.python.framework.ops.Tensor][source]
abstract property model
property name

Name prepended to all ops created by this model.

abstract value() → Union[tensorflow.python.framework.ops.Tensor, numpy.array][source]
class zfit.core.interfaces.ZfitModel[source]

Bases: zfit.core.interfaces.ZfitNumeric, zfit.core.interfaces.ZfitDimensional

abstract property axes

Return the axes.

copy(deep: bool = False, **overwrite_params) → zfit.core.interfaces.ZfitObject
abstract property dtype

The DType of Tensor`s handled by this `model.

abstract get_dependents(only_floating: bool = True) -> OrderedSet(['z', 'f', 'i', 't', '.', 'P', 'a', 'r', 'm', 'e'])
abstract get_params(only_floating: bool = False, names: Union[str, List[str], None] = None) → List[zfit.core.interfaces.ZfitParameter]
abstract integrate(limits: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool], norm_range: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool] = None, name: str = 'integrate') → Union[float, tensorflow.python.framework.ops.Tensor][source]

Integrate the function over limits (normalized over norm_range if not False).

Parameters
  • limits (tuple, Space) – the limits to integrate over

  • norm_range (tuple, Space) – the limits to normalize over or False to integrate the unnormalized probability

  • name (str) –

Returns

the integral value

Return type

Tensor

abstract property n_obs

Return the number of observables.

property name

Name prepended to all ops created by this model.

abstract property obs

Return the observables.

abstract property params
abstract partial_integrate(x: Union[float, tensorflow.python.framework.ops.Tensor], limits: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool], norm_range: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool] = None, name: str = 'partial_integrate') → Union[float, tensorflow.python.framework.ops.Tensor][source]

Partially integrate the function over the limits and evaluate it at x.

Dimension of limits and x have to add up to the full dimension and be therefore equal to the dimensions of norm_range (if not False)

Parameters
  • x (numerical) – The value at which the partially integrated function will be evaluated

  • limits (tuple, Space) – the limits to integrate over. Can contain only some axes

  • norm_range (tuple, Space, False) – the limits to normalize over. Has to have all axes

  • name (str) –

Returns

the value of the partially integrated function evaluated at x.

Return type

Tensor

abstract classmethod register_analytic_integral(func: Callable, limits: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool] = None, priority: int = 50, *, supports_norm_range: bool = False, supports_multiple_limits: bool = False)[source]

Register an analytic integral with the class.

Parameters

Returns:

abstract classmethod register_inverse_analytic_integral(func: Callable)[source]

Register an inverse analytical integral, the inverse (unnormalized) cdf.

Parameters

() (func) –

abstract sample(n: int, limits: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool] = None, name: str = 'sample') → Union[float, tensorflow.python.framework.ops.Tensor][source]

Sample n points within limits from the model.

Parameters
  • n (int) – The number of samples to be generated

  • limits (tuple, Space) – In which region to sample in

  • name (str) –

Returns

Tensor(n_obs, n_samples)

abstract property space

Return the Space object that defines the dimensionality of the object.

abstract update_integration_options(*args, **kwargs)[source]
class zfit.core.interfaces.ZfitNumeric[source]

Bases: zfit.core.interfaces.ZfitDependentsMixin, zfit.core.interfaces.ZfitObject

copy(deep: bool = False, **overwrite_params) → zfit.core.interfaces.ZfitObject
abstract property dtype

The DType of Tensor`s handled by this `model.

abstract get_dependents(only_floating: bool = True) -> OrderedSet(['z', 'f', 'i', 't', '.', 'P', 'a', 'r', 'm', 'e'])
abstract get_params(only_floating: bool = False, names: Union[str, List[str], None] = None) → List[zfit.core.interfaces.ZfitParameter][source]
property name

Name prepended to all ops created by this model.

abstract property params
class zfit.core.interfaces.ZfitObject[source]

Bases: abc.ABC

copy(deep: bool = False, **overwrite_params) → zfit.core.interfaces.ZfitObject[source]
property name

Name prepended to all ops created by this model.

class zfit.core.interfaces.ZfitPDF[source]

Bases: zfit.core.interfaces.ZfitModel

abstract as_func(norm_range: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool] = False)[source]
abstract property axes

Return the axes.

copy(deep: bool = False, **overwrite_params) → zfit.core.interfaces.ZfitObject
abstract create_extended(yield_: Union[zfit.core.interfaces.ZfitParameter, int, float, complex, tensorflow.python.framework.ops.Tensor]) → zfit.core.interfaces.ZfitPDF[source]
abstract property dtype

The DType of Tensor`s handled by this `model.

abstract get_dependents(only_floating: bool = True) -> OrderedSet(['z', 'f', 'i', 't', '.', 'P', 'a', 'r', 'm', 'e'])
abstract get_params(only_floating: bool = False, names: Union[str, List[str], None] = None) → List[zfit.core.interfaces.ZfitParameter]
abstract get_yield() → Optional[zfit.core.interfaces.ZfitParameter][source]
abstract integrate(limits: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool], norm_range: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool] = None, name: str = 'integrate') → Union[float, tensorflow.python.framework.ops.Tensor]

Integrate the function over limits (normalized over norm_range if not False).

Parameters
  • limits (tuple, Space) – the limits to integrate over

  • norm_range (tuple, Space) – the limits to normalize over or False to integrate the unnormalized probability

  • name (str) –

Returns

the integral value

Return type

Tensor

abstract property is_extended
abstract property n_obs

Return the number of observables.

property name

Name prepended to all ops created by this model.

abstract normalization(limits: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool], name: str = 'normalization') → Union[tensorflow.python.framework.ops.Tensor, numpy.array][source]
abstract property obs

Return the observables.

abstract property params
abstract partial_integrate(x: Union[float, tensorflow.python.framework.ops.Tensor], limits: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool], norm_range: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool] = None, name: str = 'partial_integrate') → Union[float, tensorflow.python.framework.ops.Tensor]

Partially integrate the function over the limits and evaluate it at x.

Dimension of limits and x have to add up to the full dimension and be therefore equal to the dimensions of norm_range (if not False)

Parameters
  • x (numerical) – The value at which the partially integrated function will be evaluated

  • limits (tuple, Space) – the limits to integrate over. Can contain only some axes

  • norm_range (tuple, Space, False) – the limits to normalize over. Has to have all axes

  • name (str) –

Returns

the value of the partially integrated function evaluated at x.

Return type

Tensor

abstract pdf(x: Union[float, tensorflow.python.framework.ops.Tensor], norm_range: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool] = None, name: str = 'model') → Union[float, tensorflow.python.framework.ops.Tensor][source]
abstract classmethod register_analytic_integral(func: Callable, limits: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool] = None, priority: int = 50, *, supports_norm_range: bool = False, supports_multiple_limits: bool = False)

Register an analytic integral with the class.

Parameters

Returns:

abstract classmethod register_inverse_analytic_integral(func: Callable)

Register an inverse analytical integral, the inverse (unnormalized) cdf.

Parameters

() (func) –

abstract sample(n: int, limits: Union[Tuple[Tuple[float, ...]], Tuple[float, ...], bool] = None, name: str = 'sample') → Union[float, tensorflow.python.framework.ops.Tensor]

Sample n points within limits from the model.

Parameters
  • n (int) – The number of samples to be generated

  • limits (tuple, Space) – In which region to sample in

  • name (str) –

Returns

Tensor(n_obs, n_samples)

abstract set_norm_range()[source]
abstract property space

Return the Space object that defines the dimensionality of the object.

abstract update_integration_options(*args, **kwargs)
class zfit.core.interfaces.ZfitParameter[source]

Bases: zfit.core.interfaces.ZfitNumeric

copy(deep: bool = False, **overwrite_params) → zfit.core.interfaces.ZfitObject
abstract property dtype

The DType of Tensor`s handled by this `model.

abstract property floating
abstract get_dependents(only_floating: bool = True) -> OrderedSet(['z', 'f', 'i', 't', '.', 'P', 'a', 'r', 'm', 'e'])
abstract get_params(only_floating: bool = False, names: Union[str, List[str], None] = None) → List[zfit.core.interfaces.ZfitParameter]
abstract property independent
property name

Name prepended to all ops created by this model.

abstract property params
abstract property shape
abstract value()[source]
class zfit.core.interfaces.ZfitSpace[source]

Bases: zfit.core.interfaces.ZfitObject

abstract area() → float[source]

Return the total area of all the limits and axes. Useful, for example, for MC integration.

abstract property axes
copy(deep: bool = False, **overwrite_params) → zfit.core.interfaces.ZfitObject
abstract get_axes(obs: Union[str, Tuple[str, ...]] = None, as_dict: bool = True)[source]

Return the axes number of the observable if available (set by axes_by_obs).

Raises

AxesNotUnambiguousError – In case

abstract get_subspace(obs: Union[str, Iterable[str], zfit.Space] = None, axes=None, name=None) → zfit.core.limits.Space[source]
abstract iter_areas(rel: bool = False) → Tuple[float, ...][source]

Return the areas of each limit.

abstract iter_limits()[source]

Iterate through the limits by returning several observables/(lower, upper)-tuples.

abstract property limits

Return the tuple(lower, upper).

abstract property lower

Return the lower limits.

abstract property n_limits

Return the number of limits.

abstract property n_obs

Return the number of observables (axis).

property name

Name prepended to all ops created by this model.

abstract property obs

Return a list of the observable names.

abstract property upper

Return the upper limits.

abstract with_autofill_axes(overwrite: bool)[source]

Return a Space with filled axes corresponding to range(len(n_obs)).

Parameters

overwrite (bool) – If self.axes is not None, replace the axes with the autofilled ones. If axes is already set, don’t do anything if overwrite is False.

Returns

Space

abstract with_axes(axes)[source]

Sort by obs and return the new instance.

Parameters

() (axes) –

Returns

Space

abstract with_limits(limits, name)[source]

Return a copy of the space with the new limits (and the new name).

Parameters
  • () (limits) –

  • name (str) –

Returns

Space

abstract with_obs(obs)[source]

Sort by obs and return the new instance.

Parameters

() (obs) –

Returns

Space