You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creating a kernel density estimation from a dataset using a MultiSpace is currently not working.
Current Behaviour
When creating a KDE from over a MultiSpace the constructor throws an error due to MultiSpaces not having the limits attribute, which is required for the padding of the data:
Traceback (most recent call last):
File "/afs/cern.ch/work/s/schmitse/ewp-rkstz/analysis/python/schmitse/mva_plots/python/MWE.py", line 14, in <module>
kde = zfit.pdf.KDE1DimExact(data=data_zfit, obs=obs, name='test')
File "/afs/cern.ch/work/s/schmitse/ewp-rkstz/analysis/python/schmitse/zfit/zfit/lib/python3.9/site-packages/zfit/models/kde.py", line 911, in __init__
data, weights, padding=padding, limits=obs.limits
File "/afs/cern.ch/work/s/schmitse/ewp-rkstz/analysis/python/schmitse/zfit/zfit/lib/python3.9/site-packages/zfit/core/space.py", line 133, in wrapped_func
return func(*args, **kwargs)
File "/afs/cern.ch/work/s/schmitse/ewp-rkstz/analysis/python/schmitse/zfit/zfit/lib/python3.9/site-packages/zfit/core/space.py", line 2727, in limits
self._raise_limits_not_implemented()
File "/afs/cern.ch/work/s/schmitse/ewp-rkstz/analysis/python/schmitse/zfit/zfit/lib/python3.9/site-packages/zfit/core/space.py", line 3069, in _raise_limits_not_implemented
raise MultipleLimitsNotImplemented(
zfit.util.exception.MultipleLimitsNotImplemented: Limits/lower/upper not implemented for MultiSpace. This error is either caught automatically as part of the codes logic or the MultiLimit case should be considered. To do that, simply iterate through the MultiSpace, which returns a simple space. Iterating through a Spaces also worksfor simple spaces.
Context (Environment)
zfit version: 0.10.1
Python version: 3.9.13
Are you using conda, pipenv, etc? : conda
Operating System: centos7
Tensorflow version: 2.9.1
Possible Solution/Implementation
KDEs over MultiSpaces should either raise a NotImplementedError or the padding of the input dataset should be reflected around the edges of the subspaces of the MultiSpace.
A quick fix to make the KDEs work again would be to pass the observable space limits only if the Space has the limits attribute:
# MultiSpaces have Attribute spaces, if MultiSpace dont pass limits. _limits=Noneifhasattr(obs, 'spaces') elseobs.limitsdata, size, weights=self._convert_init_data_weights_size(
data, weights, padding=padding, limits=_limits
)
The text was updated successfully, but these errors were encountered:
Hey @schmitse , coming back to this: instead of using the (overcomplicated) MultiSpace in zfit, the newest developments rather try to get rid of it, but instead, a "TruncatedPDF" can be used. I think the above case could be best solved.
what do you think?
(yes, the normalization changes, but this should not matter for pdf, as we don't care about the absolute norm, for extended, this will by default be adjusted accordingly)
Creating a kernel density estimation from a dataset using a
MultiSpace
is currently not working.Current Behaviour
When creating a KDE from over a
MultiSpace
the constructor throws an error due toMultiSpace
s not having thelimits
attribute, which is required for the padding of the data:. I attached a minimal (not) working example of the issue:
When running this you get the following error:
Context (Environment)
Possible Solution/Implementation
KDEs over
MultiSpaces
should either raise aNotImplementedError
or the padding of the input dataset should be reflected around the edges of the subspaces of theMultiSpace
.A quick fix to make the KDEs work again would be to pass the observable space limits only if the
Space
has thelimits
attribute:The text was updated successfully, but these errors were encountered: