https://github.com/nixtla logo
#neural-forecast
Title
# neural-forecast
p

Patricio

05/27/2022, 2:40 PM
Hi guys, any clues as to what this error could mean in the context of auto.NHITS?
Copy code
self.model.fit(Y_df=Y_df,
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/neuralforecast/auto.py", line 35, in fit
    self.model, self.trials = hyperopt_tunning(space=<http://self.space|self.space>,
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/neuralforecast/experiments/utils.py", line 1123, in hyperopt_tunning
    fmin(fmin_objective, space=space, algo=tpe.suggest,
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/hyperopt/fmin.py", line 507, in fmin
    return trials.fmin(
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/hyperopt/base.py", line 682, in fmin
    return fmin(
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/hyperopt/fmin.py", line 553, in fmin
    rval.exhaust()
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/hyperopt/fmin.py", line 356, in exhaust
    self.run(self.max_evals - n_done, block_until_done=self.asynchronous)
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/hyperopt/fmin.py", line 292, in run
    self.serial_evaluate()
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/hyperopt/fmin.py", line 170, in serial_evaluate
    result = self.domain.evaluate(spec, ctrl)
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/hyperopt/base.py", line 907, in evaluate
    rval = self.fn(pyll_rval)
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/neuralforecast/experiments/utils.py", line 991, in evaluate_model
    results, _, trainer = model_fit_predict(mc=mc,
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/neuralforecast/experiments/utils.py", line 891, in model_fit_predict
    model, trainer, val_loader, test_loader, scaler_y = fit(
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/neuralforecast/experiments/utils.py", line 755, in predict
    outputs = trainer.predict(model, loader)
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1026, in predict
    return self._call_and_handle_interrupt(
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 724, in _call_and_handle_interrupt
    return trainer_fn(*args, **kwargs)
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1073, in _predict_impl
    results = self._run(model, ckpt_path=self.ckpt_path)
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1237, in _run
    results = self._run_stage()
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1323, in _run_stage
    return self._run_predict()
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py", line 1382, in _run_predict
    return self.predict_loop.run()
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/pytorch_lightning/loops/base.py", line 204, in run
    self.advance(*args, **kwargs)
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/pytorch_lightning/loops/dataloader/prediction_loop.py", line 101, in advance
    dl_predictions, dl_batch_indices = self.epoch_loop.run(
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/pytorch_lightning/loops/base.py", line 204, in run
    self.advance(*args, **kwargs)
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/pytorch_lightning/loops/epoch/prediction_epoch_loop.py", line 92, in advance
    batch_idx, batch = next(dataloader_iter)
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 517, in __next__
    data = self._next_data()
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 557, in _next_data
    data = self._dataset_fetcher.fetch(index)  # may raise StopIteration
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/neuralforecast/data/tsdataset.py", line 793, in __getitem__
    windows, S, ts_idxs = self._create_windows_tensor(idx=idx)
  File "/Users/Pato/Work/env/lib/python3.8/site-packages/neuralforecast/data/tsdataset.py", line 696, in _create_windows_tensor
    ts_idxs = t.as_tensor(ts_idxs, dtype=t.long)
Exception: Time Series [0] are not sampleable. Check the data, masks, window_sampling_limit, input_size, output_size, masks.
Y_df
looks like this, can’t find any obvious issues with it:
f

fede (nixtla) (they/them)

05/27/2022, 9:38 PM
Hi @Patricio! Thanks for using NeuralForecast 🙂 I think it may be a problem with the size of the series. Would it be possible for you to share your data with us?
🙌 1
p

Patricio

05/28/2022, 7:09 PM
Hey @fede! I think we could share, but it will probably require an NDA 🤔, let me get back to you on Monday once I’ve checked with the team 👍
k

Kin Gtz. Olivares

05/29/2022, 9:33 PM
Last time @Patricio, that we observed this unsampleable windows error was because some series are smaller than the n_time_in parameter and are unable to be fed to the N-HiTS
Two possibilities come to my mind: • add more data to the problem series repeating observations to the past (hacky) reduce the input size of the model (n_time_in) Let us know if that works
If that is the case can you help us with a github ISSUE so future users know too?
p

Patricio

05/30/2022, 4:09 PM
Ohhh yes @Kin Gtz. Olivares, that actually makes sense for this input df and I didn’t think about this. Will check it and post an issue if that’s the case! Thank you for the pointer 🙏
k

Kin Gtz. Olivares

05/30/2022, 4:09 PM
👍
p

Patricio

05/31/2022, 10:36 PM
I’ve done a bit more digging and experimenting. Seems to me the issue is triggered whenever the data amount (for any group) is such that either the validation or test masks yield an amount of data points smaller than
n_time_in
or
n_time_out
. Could this be it?