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
I wanted to use the kalepy package on a SWeighted distribution, so there are many events with negative weights and I can't normalize them as the distribution would change. There is a ValueError in kalepy/kde.py, line 214: "Invalid weights entries, all must be finite and > 0!".
I would want to know if there is the possibility to adapt the code to run with negative weights or if the method just not allow the use of negative weights for some reason. Could someone clarify this to me?
Thanks in advance and Kind Regards.
The text was updated successfully, but these errors were encountered:
Hi, in principle it seems like this should be possible, but I've never explored negative weights. There will be some points in the code that need modification, for example, how does one calculate covariances using negative weights?
You're welcome to try implementing this in the code. If you disable the error message you're getting, it will allow negative weights, but then I think some numpy functions will probably throw errors.
Hi, just to let you know. I didn't find a way to handle negative weights because of the errors numpy throws when trying to calculate the covariances. So what I did is to split my sample into positive and negative weights, apply the KDE to both samples, and then rest the weights from "negative" sample renormalizing them by the sum of the sWeights. This seems to work but there are some downsides. If someone could find a way for handling negative weights it would be better.
Regards!
I wanted to use the kalepy package on a SWeighted distribution, so there are many events with negative weights and I can't normalize them as the distribution would change. There is a ValueError in kalepy/kde.py, line 214: "Invalid
weights
entries, all must be finite and > 0!".I would want to know if there is the possibility to adapt the code to run with negative weights or if the method just not allow the use of negative weights for some reason. Could someone clarify this to me?
Thanks in advance and Kind Regards.
The text was updated successfully, but these errors were encountered: