juice tea
02/03/2023, 10:57 AMlag_transforms
the functions from window-ops for the (seasonal)rolling mean, std etc are working fine
however with the custom functions i run into issues.
so far i have tried the following but i keep getting the same error
python
@jit
def rolling_numpy(input_array, window_size):
return np.lib.stride_tricks.sliding_window_view(x=input_array, window_shape=window_size).mean(axis=1)
@jit
def rolling_pandas(input_array, window_size,min_samples=1):
return pd.Series(input_array).rolling(window=window_size,min_periods=min_samples).mean().fillna(method='backfill').values
File /opt/miniconda3/envs/mdf/lib/python3.9/site-packages/mlforecast/forecast.py:195, in MLForecast.preprocess(self, data, id_col, time_col, target_col, static_features, dropna, keep_last_n, max_horizon, return_X_y)
155 def preprocess(
156 self,
157 data: pd.DataFrame,
(...)
165 return_X_y: bool = False,
166 ) -> Union[pd.DataFrame, Tuple[pd.DataFrame, Union[pd.Series, pd.DataFrame]]]:
167 """Add the features to `data`.
...
<source elided>
lagged = shift_array(data[indptr[i] : indptr[i + 1]], lag)
out[i] = func(lagged, *args)[-1]
^
question what is the proper way of creating these custom functions?