Juan David Ferreira
09/14/2022, 11:46 AMChris Burkart
09/19/2022, 2:26 AMSlack_sync
10/05/2022, 12:48 AMjuice 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?Florian Stracke
02/25/2023, 5:10 PMFlorian Stracke
05/10/2023, 1:49 PMNasreddine D
05/14/2023, 6:29 PMKyle Schmaus
05/31/2023, 9:20 PMmlforecast
world 🌎 !
A question for the package maintainers - would you every be interested in adding support for fraction differencing, analogous to ARFIMA models? I'm going to implement something like this for an existing mlforecast
project, and I'd be happy to create a ticket and/or PR if it's a direction you'd be interested in.Syed Umair Hassan
06/05/2023, 11:48 AMRehan Javed
06/15/2023, 11:14 AMPhilipp
06/16/2023, 1:21 AMAndrew Doherty
06/30/2023, 9:02 AMStatsForecast.cross_validation_fitted_values
will be implemented in MLForecast? I want to get a measure of how much my model is overfitting when tuning.
Cheers,
AndrewMatías Benedetto
07/10/2023, 9:24 AMSlackbot
07/13/2023, 4:04 PMMax (Nixtla)
07/20/2023, 8:18 PMGuillaume GALIE
08/03/2023, 1:27 PMMike C
08/04/2023, 8:50 PMfcst.fit(...)
? I could be way off, but it seems like using date_features
does label encoding but then these are treated as numeric features in the model itself (or maybe that is by design?). Also, trying to specify the cat indexes in the constructor for LGBMRegression provides the following:
UserWarning: categorical_feature keyword has been found in `params` and will be ignored.
Please use categorical_feature argument of the Dataset constructor to pass this parameter.
Thanks!Isaac
08/08/2023, 8:30 PMMLForecast.fit
handles dropping the NA data without issue (with the dropna param), but MLForecast.predict
runs an error with the underlying sklearn models. Am I doing something incorrectly?Isaac
08/09/2023, 5:10 PMIsaac
08/11/2023, 2:16 PMforecast_fitted_values
to MLForecast?Matej
08/15/2023, 4:01 PMclass BaseTargetTransform(abc.ABC):
def set_column_names(self, id_col: str, time_col: str, target_col: str):
self.id_col = id_col
self.time_col = time_col
self.target_col = target_col
@abc.abstractmethod
def fit_transform(self, df: 'pd.DataFrame') -> 'pd.DataFrame':
raise NotImplementedError
@abc.abstractmethod
def inverse_transform(self, df: 'pd.DataFrame') -> 'pd.DataFrame':
raise NotImplementedError
Q: How would I go about coding my own MSTL decomposition target transform ?Iva Eftimska
08/22/2023, 10:32 AMMike C
08/29/2023, 6:54 PMIsaac
09/06/2023, 1:50 PMforecast_fitted_values
function in MLForecast is broken. It's producing the transformed predictions rather than the inverse transformed one. I've written a Github issue.Brian Head
09/14/2023, 6:31 PMMLForecast
function using it with cross_validation. No issues with running it normally with a pandas dataframe, but when I try to run it with a spark dataframe (much like I was able to do wtih statsforecast), I get the following error: "RecursionError: maximum recursion depth exceeded in comparison". Haven't been able to find anything super helpful via google/stackoverflow, ChatGPT, nor this slack channel.
I've tried all of the algos in the code below and also limiting it to just one (several iterations).
Here's the code:
@njit
def rolling_mean_12(x):
return rolling_mean(x, window_size=12)
@njit
def rolling_mean_24(x):
return rolling_mean(x, window_size=24)
******
ML_models = [
lgb.LGBMRegressor(n_jobs=4, random_state=0, verbosity=-1),
# xgb.XGBRegressor(n_jobs=4, random_state=0),
# MLPRegressor(random_state=0, max_iter=1000, early_stopping=True, n_iter_no_change=10, tol=1e-4),
# RandomForestRegressor(random_state=0),
# ExtraTreesRegressor(random_state=0),
# HistGradientBoostingRegressor(random_state=0),
# KNeighborsRegressor()
]
mlf = MLForecast(
models = ML_models,
freq = 'M',# our series have integer timestamps, so we'll just add 1 in every timeste,
lags=[1, 12],
# lags=range(1,6, 1),
lag_transforms={
1: [expanding_mean],
12: [rolling_mean_12],
# 24: [rolling_mean_24],
},
# date_features=['year','month','quarter','days_in_month'],
target_transforms=[Differences([1, 24])]
)
#cross validation of statsforecast models using spark
ML_crossvalidation_SDF = mlf.cross_validation(
data=sdf,
window_size=3,
n_windows=5
).toPandas()
******
Note that the below does work with regular pandas dataframe:
ML_crossvalidation_df = mlf.cross_validation(
data=df2,
window_size=3,
n_windows=5,
)
Any help appreicated!Brian Head
09/22/2023, 2:47 PMvotingregressor
works within #mlforecast--in the sense it produces a result not a warning or failed run. Here are my questions:
• Is #mlforecast supposed to be able to use the votingregressor
?
• Even though I'm not specifying any weights, the votingregressor
does not produce true averages. Is there something I'm missing?
• How are the prediction intervals derived? I'm coming from the R
fable
world where you have to generate sample paths to derive prediction intervals for ensembles. Just wondering if what it is producing for PIs is accurate.
• The previous nixtla
package had a built-in ensemble forecaster. I have not been able to find such a function/method in the current statsforecast
or mlforecast
pacakges. If it exists can someone point me to documentation?
• If there is an ensembl forecaster, can you use it across SF and MLF?
Thanks!
#ensemble #combinationmodelIva Eftimska
09/26/2023, 8:54 AMIva Eftimska
09/26/2023, 8:54 AMIva Eftimska
09/26/2023, 8:55 AMIva Eftimska
09/26/2023, 2:48 PM