0)
np.random.seed(= np.random.rand(100) y
Online
def test_online(OnlineOp, regular_op, y, n_updates=10, **op_kwargs):
= regular_op(y, **op_kwargs)
expected = OnlineOp(**op_kwargs)
online = online.fit_transform(y[:-n_updates]).tolist()
calculated for i in range(y.size - n_updates, y.size):
calculated.append(online.update(y[i])) np.testing.assert_allclose(calculated, expected)
Rolling
Regular
RollingMean
RollingMean (window_size:int, min_samples:Optional[int]=None)
Initialize self. See help(type(self)) for accurate signature.
=4, min_samples=1)
test_online(RollingMean, rolling_mean, y, window_size=90, window_size=14, min_samples=3)
test_online(RollingMean, rolling_mean, y, n_updates=96, window_size=7, min_samples=7) test_online(RollingMean, rolling_mean, y, n_updates
RollingMax
RollingMax (window_size:int, min_samples:Optional[int]=None)
Initialize self. See help(type(self)) for accurate signature.
=4, min_samples=1)
test_online(RollingMax, rolling_max, y, window_size=90, window_size=14, min_samples=3)
test_online(RollingMax, rolling_max, y, n_updates=96, window_size=7, min_samples=7) test_online(RollingMax, rolling_max, y, n_updates
RollingMin
RollingMin (window_size:int, min_samples:Optional[int]=None)
Initialize self. See help(type(self)) for accurate signature.
=4, min_samples=1)
test_online(RollingMin, rolling_min, y, window_size=90, window_size=14, min_samples=3)
test_online(RollingMin, rolling_min, y, n_updates=96, window_size=7, min_samples=7) test_online(RollingMin, rolling_min, y, n_updates
RollingStd
RollingStd (window_size:int, min_samples:Optional[int]=None)
Initialize self. See help(type(self)) for accurate signature.
=4, min_samples=2)
test_online(RollingStd, rolling_std, y, window_size=90, window_size=14, min_samples=3)
test_online(RollingStd, rolling_std, y, n_updates=96, window_size=7, min_samples=7) test_online(RollingStd, rolling_std, y, n_updates
= RollingStd(7)
online_std
online_std.fit_transform(y)for _ in range(14):
0) online_std.update(
Seasonal
SeasonalRollingMean
SeasonalRollingMean (season_length:int, window_size:int, min_samples:Optional[int]=None)
Initialize self. See help(type(self)) for accurate signature.
=4, min_samples=1, season_length=7)
test_online(SeasonalRollingMean, seasonal_rolling_mean, y, window_size=79, window_size=4, min_samples=2, season_length=7) test_online(SeasonalRollingMean, seasonal_rolling_mean, y, n_updates
SeasonalRollingStd
SeasonalRollingStd (season_length:int, window_size:int, min_samples:Optional[int]=None)
Initialize self. See help(type(self)) for accurate signature.
=4, min_samples=2, season_length=7)
test_online(SeasonalRollingStd, seasonal_rolling_std, y, window_size=79, window_size=4, min_samples=2, season_length=7) test_online(SeasonalRollingStd, seasonal_rolling_std, y, n_updates
SeasonalRollingMin
SeasonalRollingMin (season_length:int, window_size:int, min_samples:Optional[int]=None)
Initialize self. See help(type(self)) for accurate signature.
=4, min_samples=1, season_length=7)
test_online(SeasonalRollingMin, seasonal_rolling_min, y, window_size=79, window_size=4, min_samples=2, season_length=7) test_online(SeasonalRollingMin, seasonal_rolling_min, y, n_updates
SeasonalRollingMax
SeasonalRollingMax (season_length:int, window_size:int, min_samples:Optional[int]=None)
Initialize self. See help(type(self)) for accurate signature.
=4, min_samples=1, season_length=7)
test_online(SeasonalRollingMax, seasonal_rolling_max, y, window_size=79, window_size=4, min_samples=2, season_length=7) test_online(SeasonalRollingMax, seasonal_rolling_max, y, n_updates
Expanding
Regular
ExpandingMean
ExpandingMean ()
Initialize self. See help(type(self)) for accurate signature.
0)
np.random.seed(= np.random.rand(100) y
test_online(ExpandingMean, expanding_mean, y)
ExpandingMax
ExpandingMax ()
Initialize self. See help(type(self)) for accurate signature.
test_online(ExpandingMax, expanding_max, y)
ExpandingMin
ExpandingMin ()
Initialize self. See help(type(self)) for accurate signature.
test_online(ExpandingMin, expanding_min, y)
ExpandingStd
ExpandingStd ()
Initialize self. See help(type(self)) for accurate signature.
test_online(ExpandingStd, expanding_std, y)
Seasonal
SeasonalExpandingMean
SeasonalExpandingMean (season_length:int)
Initialize self. See help(type(self)) for accurate signature.
=7) test_online(SeasonalExpandingMean, seasonal_expanding_mean, y, season_length
SeasonalExpandingStd
SeasonalExpandingStd (season_length:int)
Initialize self. See help(type(self)) for accurate signature.
=7) test_online(SeasonalExpandingStd, seasonal_expanding_std, y, season_length
SeasonalExpandingMin
SeasonalExpandingMin (season_length:int)
Initialize self. See help(type(self)) for accurate signature.
=7) test_online(SeasonalExpandingMin, seasonal_expanding_min, y, season_length
SeasonalExpandingMax
SeasonalExpandingMax (season_length:int)
Initialize self. See help(type(self)) for accurate signature.
=7) test_online(SeasonalExpandingMax, seasonal_expanding_max, y, season_length
EWM
EWMMean
EWMMean (alpha)
Initialize self. See help(type(self)) for accurate signature.
=0.3) test_online(EWMMean, ewm_mean, y, alpha
Shifting
Shift
Shift (offset:int)
Initialize self. See help(type(self)) for accurate signature.
for offset in (1, 3, 7):
=offset, n_updates=2*offset) test_online(Shift, shift_array, y, offset