Skip to content

WIP: Add online keyword in ewm constructor for EWM mean updates #49

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 2 commits into from

Conversation

mroeschke
Copy link
Collaborator

@mroeschke mroeschke commented May 10, 2021

In [6]: s = pd.Series([0, 1, 2, np.nan, 4])

In [7]: ewm_online = s.head(1).ewm(com=0.5, online=True)

In [8]: ewm_online
Out[8]: OnlineExponentialMovingWindow [com=0.5,min_periods=1,adjust=True,ignore_na=False,axis=0]

In [10]: ewm_online.mean()
Out[10]:
0    0.0
dtype: float64

In [11]: ewm_online.mean(update=s.iloc[1:4])
Out[11]:
1    0.750000
2    1.615385
3    1.615385
dtype: float64

In [12]: ewm_online.reset()

In [13]: ewm_online.mean()
Out[13]:
0    0.0
dtype: float64

In [14]: ewm_online.mean(update=s.tail(4))
Out[14]:
1    0.750000
2    1.615385
3    1.615385
4    3.670213
dtype: float64

@mroeschke mroeschke mentioned this pull request May 10, 2021
@mroeschke mroeschke changed the title WIP: Add online method for EWM mean updates WIP: Add online keyword in ewm constructor for EWM mean updates May 10, 2021
@jreback
Copy link
Collaborator

jreback commented May 10, 2021

a full ewma

In [8]:  s = pd.Series([0, 1, 2, np.nan, 4])                                                                                                                                

In [9]: s.ewm(com=0.5).mean()                                                                                                                                               
Out[9]: 
0    0.000000
1    0.750000
2    1.615385
3    1.615385
4    3.670213
dtype: float64

def var(self, bias: bool = False, *args, **kwargs):
return NotImplementedError

def mean(self, engine=None, engine_kwargs=None, update=None, update_deltas=None):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why have engine, engine_kwargs here?

axis = self._get_axis_number(axis)
# error: Value of type variable "FrameOrSeries" of "ExponentialMovingWindow"
# cannot be "object"
if online:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this not .online(engine='numba', engine_kwargs=None)

@github-actions
Copy link

This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this.

@github-actions github-actions bot added the Stale label Jun 10, 2021
@mroeschke mroeschke closed this Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants