Skip to content

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

Closed
wants to merge 1 commit into from

Conversation

evectant
Copy link
Contributor

@jreback
Copy link
Contributor

jreback commented Feb 29, 2016

I am not sure we do any validity checks on any com parameters

eg is alpha=0 valid?

@evectant
Copy link
Contributor Author

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 0 < alpha <= 1 and span >= 1, com >= 0, half-life > 0 following from that?

@jreback
Copy link
Contributor

jreback commented Feb 29, 2016

yep I think we need some sanity checks as well here - raising a helpful ValueError would be nice (rather than giving weird/odd results)

@evectant evectant force-pushed the issue-10789 branch 2 times, most recently from 796f008 to eb2a023 Compare March 1, 2016 01:31
@@ -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):
Copy link
Contributor

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

@jreback jreback added this to the 0.18.0 milestone Mar 1, 2016
@jreback jreback added API Design Numeric Operations Arithmetic, Comparison, and Logical operations labels Mar 1, 2016
@jreback
Copy link
Contributor

jreback commented Mar 1, 2016

thanks @evectant just minor comments.
ping when pushed and green.

@evectant
Copy link
Contributor Author

evectant commented Mar 2, 2016

@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
Copy link
Contributor

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

@jreback
Copy link
Contributor

jreback commented Mar 2, 2016

looks good. just some minor documentation comments.

@evectant evectant force-pushed the issue-10789 branch 2 times, most recently from bd8cd93 to 8217634 Compare March 5, 2016 06:19
@jreback
Copy link
Contributor

jreback commented Mar 5, 2016

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 "
Copy link
Contributor

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.
@evectant
Copy link
Contributor Author

evectant commented Mar 6, 2016

@jreback: Pushed and green.

@jreback jreback closed this in 547c784 Mar 6, 2016
@jreback
Copy link
Contributor

jreback commented Mar 6, 2016

thanks @evectant great PR!

@jreback
Copy link
Contributor

jreback commented Mar 6, 2016

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.

@evectant
Copy link
Contributor Author

evectant commented Mar 7, 2016

@jreback The docs look good to me. Thanks for your help with the commit.

@jreback
Copy link
Contributor

jreback commented Mar 7, 2016

looks good

thanks for the PR!

@evectant evectant deleted the issue-10789 branch March 21, 2016 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants