@@ -79,12 +79,19 @@ def test_interface_quantile(simple_df_for_agg: pd.DataFrame, out_column: str):
79
79
@pytest .mark .parametrize (
80
80
"window,seasonality,alpha,periods,fill_na,expected" ,
81
81
(
82
- (10 , 1 , 1 , 1 , 0 , np .array ([0 , 0 , 0.5 , 1 , 1.5 , 2 , 2.5 , 3 , 3.5 , 4 ])),
83
- (- 1 , 1 , 1 , 1 , 0 , np .array ([0 , 0 , 0.5 , 1 , 1.5 , 2 , 2.5 , 3 , 3.5 , 4 ])),
84
- (3 , 1 , 1 , 1 , - 17 , np .array ([- 17 , 0 , 0.5 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ])),
85
- (3 , 1 , 0.5 , 1 , - 17 , np .array ([- 17 , 0 , 0.5 , 2.5 / 3 , 4.25 / 3 , 2 , 7.75 / 3 , 9.5 / 3 , 11.25 / 3 , 13 / 3 ])),
86
- (3 , 1 , 0.5 , 3 , - 12 , np .array ([- 12 , - 12 , - 12 , 2.5 / 3 , 4.25 / 3 , 2 , 7.75 / 3 , 9.5 / 3 , 11.25 / 3 , 13 / 3 ])),
87
- (3 , 2 , 1 , 1 , - 17 , np .array ([- 17 , 0 , 1 , 1 , 2 , 2 , 3 , 4 , 5 , 6 ])),
82
+ (10 , 1 , 1 , 1 , 0 , np .array ([0 , 0.5 , 1 , 1.5 , 2 , 2.5 , 3 , 3.5 , 4 , 4.5 ])),
83
+ (- 1 , 1 , 1 , 1 , 0 , np .array ([0 , 0.5 , 1 , 1.5 , 2 , 2.5 , 3 , 3.5 , 4 , 4.5 ])),
84
+ (3 , 1 , 1 , 1 , - 17 , np .array ([0 , 0.5 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ])),
85
+ (3 , 1 , 0.5 , 1 , - 17 , np .array ([0 , 0.5 , 2.5 / 3 , 4.25 / 3 , 2 , 7.75 / 3 , 9.5 / 3 , 11.25 / 3 , 13 / 3 , 14.75 / 3 ])),
86
+ (
87
+ 3 ,
88
+ 1 ,
89
+ 0.5 ,
90
+ 3 ,
91
+ - 12 ,
92
+ np .array ([- 12 , - 12 , 2.5 / 3 , 4.25 / 3 , 2 , 7.75 / 3 , 9.5 / 3 , 11.25 / 3 , 13 / 3 , 14.75 / 3 ]),
93
+ ),
94
+ (3 , 2 , 1 , 1 , - 17 , np .array ([0 , 1 , 1 , 2 , 2 , 3 , 4 , 5 , 6 , 7 ])),
88
95
),
89
96
)
90
97
def test_mean_feature (
@@ -115,8 +122,8 @@ def test_mean_feature(
115
122
(
116
123
(10 , 1 , 1 , 0 , np .array ([0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ])),
117
124
(- 1 , 1 , 1 , 0 , np .array ([0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ])),
118
- (3 , 1 , 1 , - 17 , np .array ([- 17 , 0 , 0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 ])),
119
- (3 , 2 , 1 , - 17 , np .array ([- 17 , 0 , 1 , 0 , 1 , 0 , 1 , 2 , 3 , 4 ])),
125
+ (3 , 1 , 1 , - 17 , np .array ([0 , 0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ])),
126
+ (3 , 2 , 1 , - 17 , np .array ([0 , 1 , 0 , 1 , 0 , 1 , 2 , 3 , 4 , 5 ])),
120
127
),
121
128
)
122
129
def test_min_feature (
@@ -138,9 +145,9 @@ def test_min_feature(
138
145
@pytest .mark .parametrize (
139
146
"window,periods,fill_na,expected" ,
140
147
(
141
- (10 , 1 , 0 , np .array ([0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ])),
142
- (- 1 , 1 , 0 , np .array ([0 , 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ])),
143
- (3 , 2 , - 17 , np .array ([- 17 , - 17 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ])),
148
+ (10 , 1 , 0 , np .array ([0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ])),
149
+ (- 1 , 1 , 0 , np .array ([0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ])),
150
+ (3 , 2 , - 17 , np .array ([- 17 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ])),
144
151
),
145
152
)
146
153
def test_max_feature (simple_df_for_agg : pd .DataFrame , window : int , periods : int , fill_na : float , expected : np .array ):
@@ -155,8 +162,8 @@ def test_max_feature(simple_df_for_agg: pd.DataFrame, window: int, periods: int,
155
162
@pytest .mark .parametrize (
156
163
"window,periods,fill_na,expected" ,
157
164
(
158
- (3 , 3 , - 17 , np .array ([- 17 , - 17 , - 17 , 1 , 2 , 3 , 4 , 5 , 6 , 7 ])),
159
- (- 1 , 1 , - 17 , np .array ([- 17 , 0 , 0.5 , 1 , 1.5 , 2 , 2.5 , 3 , 3.5 , 4 ])),
165
+ (3 , 3 , - 17 , np .array ([- 17 , - 17 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 ])),
166
+ (- 1 , 1 , - 17 , np .array ([0 , 0.5 , 1 , 1.5 , 2 , 2.5 , 3 , 3.5 , 4 , 4.5 ])),
160
167
),
161
168
)
162
169
def test_median_feature (simple_df_for_agg : pd .DataFrame , window : int , periods : int , fill_na : float , expected : np .array ):
@@ -171,8 +178,8 @@ def test_median_feature(simple_df_for_agg: pd.DataFrame, window: int, periods: i
171
178
@pytest .mark .parametrize (
172
179
"window,periods,fill_na,expected" ,
173
180
(
174
- (3 , 3 , - 17 , np .array ([- 17 , - 17 , - 17 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ])),
175
- (3 , 1 , - 17 , np .array ([- 17 , - 17 , np .sqrt (0.5 ** 2 * 2 ), 1 , 1 , 1 , 1 , 1 , 1 , 1 ])),
181
+ (3 , 3 , - 17 , np .array ([- 17 , - 17 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ])),
182
+ (3 , 1 , - 17 , np .array ([- 17 , np .sqrt (0.5 ** 2 * 2 ), 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ])),
176
183
),
177
184
)
178
185
def test_std_feature (simple_df_for_agg : pd .DataFrame , window : int , periods : int , fill_na : float , expected : np .array ):
@@ -187,9 +194,9 @@ def test_std_feature(simple_df_for_agg: pd.DataFrame, window: int, periods: int,
187
194
@pytest .mark .parametrize (
188
195
"window,periods,fill_na,expected" ,
189
196
(
190
- (3 , 3 , - 17 , [- 17 , - 17 , - 17 , 4 / 3 , 2 / 3 , 2 / 3 , 8 / 3 , 2 , 14 / 9 , 10 / 9 ]),
191
- (4 , 1 , - 17 , [- 17 , 0 , 1 , 4 / 3 , 1.25 , 1 , 2.25 , 2.75 , 2 , 1.5 ]),
192
- (- 1 , 1 , 0 , [0 , 0 , 1 , 4 / 3 , 1.25 , 1.44 , 7 / 3 , 138 / 49 , 2.625 , 208 / 81 ]),
197
+ (3 , 3 , - 17 , [- 17 , - 17 , 4 / 3 , 2 / 3 , 2 / 3 , 8 / 3 , 2 , 14 / 9 , 10 / 9 , 22 / 9 ]),
198
+ (4 , 1 , - 17 , [0 , 1 , 4 / 3 , 1.25 , 1 , 2.25 , 2.75 , 2 , 1.5 , 9.5 / 4 ]),
199
+ (- 1 , 1 , 0 , [0 , 1 , 4 / 3 , 1.25 , 1.44 , 7 / 3 , 138 / 49 , 2.625 , 208 / 81 , 27 / 10 ]),
193
200
),
194
201
)
195
202
def test_mad_transform (df_for_agg : pd .DataFrame , window : int , periods : int , fill_na : float , expected : np .ndarray ):
@@ -202,7 +209,7 @@ def test_mad_transform(df_for_agg: pd.DataFrame, window: int, periods: int, fill
202
209
203
210
@pytest .mark .parametrize (
204
211
"window,periods,fill_na,expected" ,
205
- ((3 , 3 , - 17 , [- 17 , - 17 , - 17 , 4 / 3 , - 17 , - 17 , - 17 , 2 , 14 / 9 , 10 / 9 ]),),
212
+ ((3 , 3 , - 17 , [- 17 , - 17 , 4 / 3 , - 17 , - 17 , - 17 , 2 , 14 / 9 , 10 / 9 , 22 / 9 ]),),
206
213
)
207
214
def test_mad_transform_with_nans (
208
215
df_for_agg_with_nan : pd .DataFrame , window : int , periods : int , fill_na : float , expected : np .ndarray
0 commit comments