Davide Cangelosi
03/25/2024, 4:23 PMDavide Cangelosi
03/25/2024, 4:24 PMDavide Cangelosi
03/25/2024, 4:24 PMFil Fil
03/25/2024, 4:49 PMDan Howarth
03/25/2024, 8:17 PMpredict_insample
that you can pass a df to instead of using the last training df? I'd like to evaluate a test set (completely separate unique_ids) by running sliding window forecasts.Pinak Dutta
03/25/2024, 10:59 PMAlejandro Holguin Mora
03/25/2024, 11:20 PMIsmail EL MASSI
03/26/2024, 2:04 PMnickeleres
03/27/2024, 3:17 PMtensorflow-metal
and tensorflow
to play nice, even using aarm64 Docker image.Qi Xin
03/28/2024, 4:41 PMMax (Nixtla)
03/28/2024, 10:07 PMMax (Nixtla)
03/28/2024, 10:12 PMValeriy
04/02/2024, 6:10 PMToni Borders
04/03/2024, 9:52 AMutilsforecast.evaluation.evaluate
function but I keep hitting the following error when adding the train_df parameter.
I’ve had a look at the source code which indicates that train_df is optional, however if I omit the train_df I get the same error.
call:
from utilsforecast.evaluation import evaluate
from utilsforecast.losses import (
mse, # mean square error
mape, # mean absolute percentage error
mae, # mean absolute error
mase, # mean absolute scaled error
rmse, # root mean square error
mqloss, # multi-quantile loss
scaled_crps, # scaled continues ranked probability score
)
eval_df = evaluate(forecasts, metrics=[metrics], train_df=train)
> File “/Users/.pyenv/versions/datascience/lib/python3.11/site-packages/utilsforecast/evaluation.py”, line 72, in evaluate
> metric_requires_y_train = {
> ^
> File “/Users/.pyenv/versions/datascience/lib/python3.11/site-packages/utilsforecast/evaluation.py”, line 73, in dictcomp
> _function_name(m): “train_df” in inspect.signature(m).parameters
> ^^^^^^^^^^^^^^^^^
> File “/Users/.pyenv/versions/datascience/lib/python3.11/site-packages/utilsforecast/evaluation.py”, line 22, in _function_name
> name = f.name
> ^^^^^^^^^^
> AttributeError: ‘list’ object has no attribute ‘__name__‘. Did you mean: ‘__ne__‘?
my forecasts dataframe has the following columns:
unique_id
ds
Naive
Naive-lo-95
Naive-hi-95
MSTL
MSTL-lo-95
MSTL-hi-95
AutoETS
AutoETS-lo-95
AutoETS-hi-95
combined-lo
combined-hi
combined-base
my train dataframe has the following columns:
ds
y
unique_id
and the metrics list is simply [mse, rmse, mape]
Any assistance would be appreciated.
Thanks in advance.Makarand Batchu
04/03/2024, 3:41 PMNaren Castellon
04/03/2024, 6:32 PMLuis Enrique Patiño
04/03/2024, 10:41 PMmlf.fit(
train_df,
prediction_intervals=PredictionIntervals(n_windows=2, h=horizon),
)
Unexpected exception formatting exception. Falling back to standard exception
Traceback (most recent call last):
File "/opt/conda/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "/tmp/ipykernel_33/4086377508.py", line 1, in <module>
mlf.fit(
File "/opt/conda/lib/python3.10/site-packages/mlforecast/utils.py", line 186, in inner
File "/opt/conda/lib/python3.10/site-packages/mlforecast/forecast.py", line 376, in fit
X = prep[self.ts.features_order_]
File "/opt/conda/lib/python3.10/site-packages/mlforecast/forecast.py", line 308, in _conformity_scores
h: int = 1,
File "/opt/conda/lib/python3.10/site-packages/mlforecast/utils.py", line 186, in inner
File "/opt/conda/lib/python3.10/site-packages/mlforecast/forecast.py", line 685, in cross_validation
keep_last_n=self.ts.keep_last_n,
File "/opt/conda/lib/python3.10/site-packages/mlforecast/utils.py", line 186, in inner
File "/opt/conda/lib/python3.10/site-packages/mlforecast/forecast.py", line 489, in predict
self._cs_df: Optional[DataFrame] = None
File "/opt/conda/lib/python3.10/site-packages/mlforecast/core.py", line 575, in predict
self.curr_dates = self.curr_dates[self._idxs]
File "/opt/conda/lib/python3.10/site-packages/mlforecast/core.py", line 505, in _predict_recursive
)
UnboundLocalError: local variable 'preds' referenced before assignment
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/conda/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 2144, in showtraceback
stb = self.InteractiveTB.structured_traceback(
File "/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py", line 1435, in structured_traceback
return FormattedTB.structured_traceback(
File "/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py", line 1326, in structured_traceback
return VerboseTB.structured_traceback(
File "/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py", line 1173, in structured_traceback
formatted_exception = self.format_exception_as_a_whole(etype, evalue, etb, number_of_lines_of_context,
File "/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py", line 1088, in format_exception_as_a_whole
frames.append(self.format_record(record))
File "/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py", line 970, in format_record
frame_info.lines, Colors, self.has_colors, lvals
File "/opt/conda/lib/python3.10/site-packages/IPython/core/ultratb.py", line 792, in lines
return self._sd.lines
File "/opt/conda/lib/python3.10/site-packages/stack_data/utils.py", line 145, in cached_property_wrapper
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/opt/conda/lib/python3.10/site-packages/stack_data/core.py", line 734, in lines
pieces = self.included_pieces
File "/opt/conda/lib/python3.10/site-packages/stack_data/utils.py", line 145, in cached_property_wrapper
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/opt/conda/lib/python3.10/site-packages/stack_data/core.py", line 681, in included_pieces
pos = scope_pieces.index(self.executing_piece)
File "/opt/conda/lib/python3.10/site-packages/stack_data/utils.py", line 145, in cached_property_wrapper
value = obj.__dict__[self.func.__name__] = self.func(obj)
File "/opt/conda/lib/python3.10/site-packages/stack_data/core.py", line 660, in executing_piece
return only(
File "/opt/conda/lib/python3.10/site-packages/executing/executing.py", line 116, in only
raise NotOneValueFound('Expected one value, found 0')
executing.executing.NotOneValueFound: Expected one value, found 0
Elizabeth Eve Stewart
04/09/2024, 6:53 PMMairon Cesar Simoes Chaves
04/10/2024, 5:40 PMmodel_lgbm.predict(h=15, new_df=new_skus_df)
Is it possible to parallelize this process? Because there are more than 300k distinct series
Thanks in advance!nickeleres
04/10/2024, 6:32 PM.predict()
AttributeError: 'TimeSeriesDataset' object has no attribute 'scalers_'
Jeff Tackes
04/10/2024, 11:51 PMGalvan Goh
04/11/2024, 2:06 AMRicardo Barros Lourenço
04/11/2024, 11:53 AMValeriy
04/12/2024, 3:05 PMQuang Bui
04/14/2024, 5:33 AMds
column)?
I've used the function below, which works fine to create the five-minutely time index based on the UTC time (ds
column):
def five_min_index(dates):
"""Calculate 5-minutely index for each datetime (0 to 287)"""
return (dates.hour * 60 + dates.minute) // 5
It is used in LightGBMCV()
as follows:
cv = LightGBMCV(
freq='5min',
target_transforms=[Differences([288])],
lags=[1,2,3,4,5,6,12,288],
lag_transforms={
1: [
ExponentiallyWeightedMean(alpha=0.5),
RollingMean(window_size=12),
],
12: [RollingMean(window_size=288)],
},
date_features=[five_min_index, 'hour', 'dayofweek'],
num_threads=4,
)
My y
depends on the clock-datetime, it's human driven, so is influenced by when we start the day and when we end the day.
Any thoughts? I'd like to be able to have the index in date_features
instead of having to create a dynamic exogenous feature...王梦石
04/14/2024, 10:31 PMElizabeth Eve Stewart
04/16/2024, 6:36 AMhorizon = 2
models = [NHITS(h=horizon,
input_size=2*horizon,
max_steps=50),
NBEATS(h=horizon,
input_size=2*horizon,
max_steps=50),
TimesNet(h=horizon,
input_size=2*horizon,
max_steps=50)]
#%%
nf = NeuralForecast(models=models, freq='H')
#%%
a=nf.cross_validation(df=data, step_size=horizon, n_windows=1)
By the way, i wanna know what is mas_Steps, is this iteration times? and what is input_size?Huseyn Zeynalov
04/16/2024, 8:29 PMAfiq Johari
04/17/2024, 7:12 AMMairon Cesar Simoes Chaves
04/17/2024, 3:40 PM