-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gkernel result decaying rapidly towards zero #392
Comments
a) I believe they aren't aligned because we didn't want to change the APIs and break legacy examples (which I think is wise) |
@CommonClimate I did some testing and I realized that gkernel wasn't actually acknowledging the passed step_type, nor has it ever acknowledged step_type. The parameter was overwritten in old versions of the code base, and in the new version it didn't get passed to the underlying utility. This has been fixed in my most recent commits. In the example you attached, what's being shown is in fact the result of the usage of the 'max' step_style/step_type. However, the default parameter value for h, the kernel e-folding scale, means that the calculated weights are tiny for windows that contain only one or two data points in the low resolution portion of the series. When gkernel tries to calculate values using these tiny weights, python raises a warning and returns a nan value because we try to divide by a very, very small number. I changed the docstring to warn people about this behavior. The function works properly otherwise as far as I can tell, it just requires that the user exercise some caution. |
hmm, i'll see if we can get it to behave more like bin() by making h a function of the increment size. re: alignment, i'll add a step_style parameter and send a deprecation warning for step_type. |
I think it has less to do with step size than it does with the minimum number of points in a given window. As far as I can tell if you have windows that have only one or two points in them, the weights will be tiny and python will be unhappy (unless h is large). Making it so that windows that only contain a single point just return that point might alleviate the issue somewhat, although you can still get really low weight values for windows that have just two or three points as well (edit: I just tried this and it didn't seem to make much of a difference, so its probably best to try your approach). sounds good on the deprecation warning |
actually, I just got this with your code:
that's exactly what I was hoping the code would do, so no change needed. I'll just update the parameters and push a fix |
addressed by #393 |
Describe the bug
gkernel is not functioning as it should, values are moving exponentially towards zero
To Reproduce
To demonstrate the unusual behavior run
ts = pyleo.utils.load_dataset('LR04')
ts.gkernel().plot()
Expected behavior
Shouldn't decay towards zero
Additional context
This is likely due to code introduced by #381, which divides the value axis of the gkernel method by the sum of the weights each time values are calculated, resulting in the series decaying to zero very quickly.
The text was updated successfully, but these errors were encountered: