-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: Allow exponentially weighted functions to specify alpha directly #12492
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
Conversation
evectant
commented
Feb 29, 2016
- Closes ENH: Allow exponential weighing functions to specify alpha, in addition to span / com / halflife #10789
- Passes Travis CI, nosetests, and flake8
- Covered by new tests in test_window.py:TestMoments
- Documented in computation.rst and v0.18.0.txt
I am not sure we do any validity checks on any com parameters eg is alpha=0 valid? |
That's actually a question I had. Zero alpha is not okay, but zero half-life isn't either, and the code is not checking for that. Should I add the checks for |
yep I think we need some sanity checks as well here - raising a helpful ValueError would be nice (rather than giving weird/odd results) |
796f008
to
eb2a023
Compare
@@ -1066,6 +1066,67 @@ def test_ewma_halflife_arg(self): | |||
halflife=50) | |||
self.assertRaises(Exception, mom.ewma, self.arr) | |||
|
|||
def test_ewma_alpha_old_api(self): | |||
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add the issue number as a comment here
thanks @evectant just minor comments. |
@jreback: Added the comments, slightly reworded the description in computation.rst. Pushed and green. |
:math:`\alpha = 1 - exp(log(0.5) / halflife)` | ||
alpha : float, optional | ||
Specify smoothing factor :math:`\alpha` directly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a versionadded tag here
looks good. just some minor documentation comments. |
bd8cd93
to
8217634
Compare
pls rebase and push again, master has been updated |
|
||
if span is not None: | ||
# convert span to center of mass | ||
raise Exception("com, span, halflife, and alpha " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make this a ValueError
Closes pandas-dev#10789. Adds domain checks for exponentially weighted functions.
@jreback: Pushed and green. |
thanks @evectant great PR! |
give a look at the built documentation (should be done shortly), http://pandas-docs.github.io/pandas-docs-travis/ and make sure looks ok (obviously where you changed things!). If not pls issue a follow. |
@jreback The docs look good to me. Thanks for your help with the commit. |
looks good thanks for the PR! |