loss¶
-
class
zfit.loss.
ExtendedUnbinnedNLL
(model, data, fit_range=None, constraints=None)[source]¶ Bases:
zfit.core.loss.UnbinnedNLL
An Unbinned Negative Log Likelihood with an additional poisson term for the
-
add_cache_dependents
(cache_dependents: Union[zfit.core.interfaces.ZfitCachable, Iterable[zfit.core.interfaces.ZfitCachable]], allow_non_cachable: bool = True)¶ Add dependents that render the cache invalid if they change.
Parameters: - cache_dependents (ZfitCachable) –
- allow_non_cachable (bool) – If True, allow cache_dependents to be non-cachables. If False, any cache_dependents that is not a ZfitCachable will raise an error.
Raises: TypeError
– if one of the cache_dependents is not a ZfitCachable _and_ allow_non_cachable if False.
-
add_constraints
(constraints)¶
-
constraints
¶
-
copy
(deep: bool = False, name: str = None, **overwrite_params) → zfit.core.interfaces.ZfitObject¶
-
data
¶
-
errordef
¶
-
fit_range
¶
-
get_dependents
(only_floating: bool = True) → Set[zfit.core.parameter.Parameter]¶ Return a set of all independent
Parameter
that this object depends on.Parameters: only_floating (bool) – If True, only return floating Parameter
-
gradients
(params: Union[zfit.core.interfaces.ZfitParameter, int, float, complex, tensorflow.python.framework.ops.Tensor] = None) → List[tensorflow.python.framework.ops.Tensor]¶
-
model
¶
-
name
¶ Name prepended to all ops created by this model.
-
register_cacher
(cacher: Union[zfit.core.interfaces.ZfitCachable, Iterable[zfit.core.interfaces.ZfitCachable]])¶ Register a cacher that caches values produces by this instance; a dependent.
Parameters: () (cacher) –
-
reset_cache
(reseter: zfit.util.cache.ZfitCachable)¶
-
reset_cache_self
()¶ Clear the cache of self and all dependent cachers.
-
value
()¶
-
-
class
zfit.loss.
UnbinnedNLL
(model, data, fit_range=None, constraints=None)[source]¶ Bases:
zfit.core.loss.CachedLoss
The Unbinned Negative Log Likelihood.
-
add_cache_dependents
(cache_dependents: Union[zfit.core.interfaces.ZfitCachable, Iterable[zfit.core.interfaces.ZfitCachable]], allow_non_cachable: bool = True)¶ Add dependents that render the cache invalid if they change.
Parameters: - cache_dependents (ZfitCachable) –
- allow_non_cachable (bool) – If True, allow cache_dependents to be non-cachables. If False, any cache_dependents that is not a ZfitCachable will raise an error.
Raises: TypeError
– if one of the cache_dependents is not a ZfitCachable _and_ allow_non_cachable if False.
-
add_constraints
(constraints)¶
-
constraints
¶
-
copy
(deep: bool = False, name: str = None, **overwrite_params) → zfit.core.interfaces.ZfitObject¶
-
data
¶
-
errordef
¶
-
fit_range
¶
-
get_dependents
(only_floating: bool = True) → Set[zfit.core.parameter.Parameter]¶ Return a set of all independent
Parameter
that this object depends on.Parameters: only_floating (bool) – If True, only return floating Parameter
-
gradients
(params: Union[zfit.core.interfaces.ZfitParameter, int, float, complex, tensorflow.python.framework.ops.Tensor] = None) → List[tensorflow.python.framework.ops.Tensor]¶
-
model
¶
-
name
¶ Name prepended to all ops created by this model.
-
register_cacher
(cacher: Union[zfit.core.interfaces.ZfitCachable, Iterable[zfit.core.interfaces.ZfitCachable]])¶ Register a cacher that caches values produces by this instance; a dependent.
Parameters: () (cacher) –
-
reset_cache
(reseter: zfit.util.cache.ZfitCachable)¶
-
reset_cache_self
()¶ Clear the cache of self and all dependent cachers.
-
value
()¶
-
-
class
zfit.loss.
BaseLoss
(model, data, fit_range: Union[Tuple[Tuple[Tuple[float, ...]]], Tuple[float, float], bool] = None, constraints: List[tensorflow.python.framework.ops.Tensor] = None)[source]¶ Bases:
zfit.core.baseobject.BaseDependentsMixin
,zfit.core.interfaces.ZfitLoss
,zfit.util.cache.Cachable
,zfit.core.baseobject.BaseObject
A “simultaneous fit” can be performed by giving one or more model, data, fit_range to the loss. The length of each has to match the length of the others.
Parameters: - model (Iterable[ZfitModel]) – The model or models to evaluate the data on
- data (Iterable[ZfitData]) – Data to use
- fit_range (Iterable[
Space
]) – The fitting range. It’s the norm_range for the models (if - they – have a norm_range) and the data_range for the data.
- constraints (Iterable[tf.Tensor) – A Tensor representing a loss constraint. Using zfit.constraint.* allows for easy use of predefined constraints.
-
add_cache_dependents
(cache_dependents: Union[zfit.core.interfaces.ZfitCachable, Iterable[zfit.core.interfaces.ZfitCachable]], allow_non_cachable: bool = True)¶ Add dependents that render the cache invalid if they change.
Parameters: - cache_dependents (ZfitCachable) –
- allow_non_cachable (bool) – If True, allow cache_dependents to be non-cachables. If False, any cache_dependents that is not a ZfitCachable will raise an error.
Raises: TypeError
– if one of the cache_dependents is not a ZfitCachable _and_ allow_non_cachable if False.
-
constraints
¶
-
copy
(deep: bool = False, name: str = None, **overwrite_params) → zfit.core.interfaces.ZfitObject¶
-
data
¶
-
errordef
¶
-
fit_range
¶
-
get_dependents
(only_floating: bool = True) → Set[zfit.core.parameter.Parameter]¶ Return a set of all independent
Parameter
that this object depends on.Parameters: only_floating (bool) – If True, only return floating Parameter
-
gradients
(params: Union[zfit.core.interfaces.ZfitParameter, int, float, complex, tensorflow.python.framework.ops.Tensor] = None) → List[tensorflow.python.framework.ops.Tensor][source]¶
-
model
¶
-
name
¶ Name prepended to all ops created by this model.
-
register_cacher
(cacher: Union[zfit.core.interfaces.ZfitCachable, Iterable[zfit.core.interfaces.ZfitCachable]])¶ Register a cacher that caches values produces by this instance; a dependent.
Parameters: () (cacher) –
-
reset_cache
(reseter: zfit.util.cache.ZfitCachable)¶
-
reset_cache_self
()¶ Clear the cache of self and all dependent cachers.
-
class
zfit.loss.
SimpleLoss
(func: Callable, dependents: Optional[Dict[str, zfit.core.interfaces.ZfitParameter]] = None, errordef: Optional[float] = None)[source]¶ Bases:
zfit.core.loss.CachedLoss
Loss from a (function returning a ) Tensor.
Parameters: - func – Callable that constructs the loss and returns a tensor.
- dependents – The dependents (independent zfit.Parameter) of the loss. If not given, the dependents are figured out automatically.
- errordef – Definition of which change in the loss corresponds to a change of 1 sigma. For example, 1 for Chi squared, 0.5 for negative log-likelihood.
-
add_cache_dependents
(cache_dependents: Union[zfit.core.interfaces.ZfitCachable, Iterable[zfit.core.interfaces.ZfitCachable]], allow_non_cachable: bool = True)¶ Add dependents that render the cache invalid if they change.
Parameters: - cache_dependents (ZfitCachable) –
- allow_non_cachable (bool) – If True, allow cache_dependents to be non-cachables. If False, any cache_dependents that is not a ZfitCachable will raise an error.
Raises: TypeError
– if one of the cache_dependents is not a ZfitCachable _and_ allow_non_cachable if False.
-
add_constraints
(constraints)¶
-
constraints
¶
-
copy
(deep: bool = False, name: str = None, **overwrite_params) → zfit.core.interfaces.ZfitObject¶
-
data
¶
-
errordef
¶
-
fit_range
¶
-
get_dependents
(only_floating: bool = True) → Set[zfit.core.parameter.Parameter]¶ Return a set of all independent
Parameter
that this object depends on.Parameters: only_floating (bool) – If True, only return floating Parameter
-
gradients
(params: Union[zfit.core.interfaces.ZfitParameter, int, float, complex, tensorflow.python.framework.ops.Tensor] = None) → List[tensorflow.python.framework.ops.Tensor]¶
-
model
¶
-
name
¶ Name prepended to all ops created by this model.
-
register_cacher
(cacher: Union[zfit.core.interfaces.ZfitCachable, Iterable[zfit.core.interfaces.ZfitCachable]])¶ Register a cacher that caches values produces by this instance; a dependent.
Parameters: () (cacher) –
-
reset_cache
(reseter: zfit.util.cache.ZfitCachable)¶
-
reset_cache_self
()¶ Clear the cache of self and all dependent cachers.
-
value
()¶