Time series forecasting with PyTorch

Overview

Our article on Towards Data Science introduces the package and provides background information.

Pytorch Forecasting aims to ease state-of-the-art timeseries forecasting with neural networks for real-world cases and research alike. The goal is to provide a high-level API with maximum flexibility for professionals and reasonable defaults for beginners. Specifically, the package provides

  • A timeseries dataset class which abstracts handling variable transformations, missing values, randomized subsampling, multiple history lengths, etc.
  • A base model class which provides basic training of timeseries models along with logging in tensorboard and generic visualizations such actual vs predictions and dependency plots
  • Multiple neural network architectures for timeseries forecasting that have been enhanced for real-world deployment and come with in-built interpretation capabilities
  • Multi-horizon timeseries metrics
  • Ranger optimizer for faster model training
  • Hyperparameter tuning with optuna

The package is built on pytorch-lightning to allow training on CPUs, single and multiple GPUs out-of-the-box.

Installation

If you are working on windows, you need to first install PyTorch with

pip install torch -f https://download.pytorch.org/whl/torch_stable.html.

Otherwise, you can proceed with

pip install pytorch-forecasting

Alternatively, you can install the package via conda

conda install pytorch-forecasting pytorch -c pytorch>=1.7 -c conda-forge

PyTorch Forecasting is now installed from the conda-forge channel while PyTorch is install from the pytorch channel.

Documentation

Visit https://pytorch-forecasting.readthedocs.io to read the documentation with detailed tutorials.

Available models

To implement new models, see the How to implement new models tutorial. It covers basic as well as advanced architectures.

Usage

import pytorch_lightning as pl
from pytorch_lightning.callbacks import EarlyStopping, LearningRateMonitor
from pytorch_forecasting.metrics import QuantileLoss
from pytorch_forecasting import TimeSeriesDataSet, TemporalFusionTransformer

# load data
data = ...

# define dataset
max_encoder_length = 36
max_prediction_length = 6
training_cutoff = "YYYY-MM-DD"  # day for cutoff

training = TimeSeriesDataSet(
    data[lambda x: x.date <= training_cutoff],
    time_idx= ...,
    target= ...,
    group_ids=[ ... ],
    max_encoder_length=max_encoder_length,
    max_prediction_length=max_prediction_length,
    static_categoricals=[ ... ],
    static_reals=[ ... ],
    time_varying_known_categoricals=[ ... ],
    time_varying_known_reals=[ ... ],
    time_varying_unknown_categoricals=[ ... ],
    time_varying_unknown_reals=[ ... ],
)


validation = TimeSeriesDataSet.from_dataset(training, data, min_prediction_idx=training.index.time.max() + 1, stop_randomization=True)
batch_size = 128
train_dataloader = training.to_dataloader(train=True, batch_size=batch_size, num_workers=2)
val_dataloader = validation.to_dataloader(train=False, batch_size=batch_size, num_workers=2)


early_stop_callback = EarlyStopping(monitor="val_loss", min_delta=1e-4, patience=1, verbose=False, mode="min")
lr_logger = LearningRateMonitor()
trainer = pl.Trainer(
    max_epochs=100,
    gpus=0,
    gradient_clip_val=0.1,
    limit_train_batches=30,
    callbacks=[lr_logger, early_stop_callback],
)


tft = TemporalFusionTransformer.from_dataset(
    training,
    learning_rate=0.03,
    hidden_size=32,
    attention_head_size=1,
    dropout=0.1,
    hidden_continuous_size=16,
    output_size=7,
    loss=QuantileLoss(),
    log_interval=2,
    reduce_on_plateau_patience=4
)
print(f"Number of parameters in network: {tft.size()/1e3:.1f}k")

# find optimal learning rate
res = trainer.lr_find(
    tft, train_dataloader=train_dataloader, val_dataloaders=val_dataloader, early_stop_threshold=1000.0, max_lr=0.3,
)

print(f"suggested learning rate: {res.suggestion()}")
fig = res.plot(show=True, suggest=True)
fig.show()

trainer.fit(
    tft, train_dataloader=train_dataloader, val_dataloaders=val_dataloader,
)
Comments
  • tft unable to set target to a list of strings (multiple targets)

    tft unable to set target to a list of strings (multiple targets)

    • PyTorch-Forecasting version: 0.8.5
    • PyTorch version: 1.8.1
    • Python version: 3.8.10
    • Operating System: linux 3.10.0-1160.25.1.el7.x86_64

    according to doc: https://pytorch-forecasting.readthedocs.io/en/latest/api/pytorch_forecasting.data.timeseries.TimeSeriesDataSet.html the target parameter can be set to a list of strings indicating multiple variables for prediction However, during run time, the code spits the following error:

    TypeError: new() received an invalid combination of arguments - got (list, int), but expected one of:
     * (*, torch.device device)
          didn't match because some of the arguments have invalid types: (list, int)
     * (torch.Storage storage)
     * (Tensor other)
     * (tuple of ints size, *, torch.device device)
     * (object data, *, torch.device device)
    
    question potential bug 
    opened by QitianMa 18
  • dictionary update sequence element #0 has length 1; 2 is required

    dictionary update sequence element #0 has length 1; 2 is required

    I'm trying to forecast a time series. For that, I decided to redo the tutorial "Demand forecasting with the Temporal Fusion Transformer". As the version that is on the GitHub seems to be more recent, I solved the instructions that are there. However, when executing the instruction trainer.fit(tft, train_dataloaders = train_dataloader, val_dataloaders = val_dataloader,), the following error message appears: "dictionary update sequence element #0 has length 1; 2 is required".

    I've tried all the possibilities I knew, but the error persists.

    My notebook on Google Colab: https://colab.research.google.com/drive/1NX-ah_Nuqyt6m2Wsn2WcKkadRariISFu?usp=sharing

    opened by cristianegea 17
  • The prediction result of Temporal Fusion Transformer is a straight line

    The prediction result of Temporal Fusion Transformer is a straight line

    • PyTorch-Forecasting version: 0.8.3
    • PyTorch version: 1.7.1
    • Python version: 3.9
    • Operating System: win10

    Expected behavior

    I execute the Temporal Fusion Transformer for power bus load forecasting. The resolution of the data is 15 minutes, which means that there are 96 data points in a day. I want to enter the data from the previous day to predict the 96 data values of the day.

    Actual behavior

    But the predicted curve is a straight line. The predicted result is 96 nearly the same value. image

    question 
    opened by 2448778655 16
  • Is there leakage?

    Is there leakage?

    My model (DeepAR) is performing way better than I think it should.

    I've done some hunting and it appears that even in test mode input_vector at this point contains scaled target values.

    I tried following things further to here, and note that there is specific handling in place for when n_samples is not None (which is the case when using DeepAR.predict()), but I can't see where the scaled values masked / excluded.

    Am I just lost / paranoid or is there leakage somewhere?

    bug 
    opened by JakeForsey 15
  • Errors

    Errors

    Hello, im stallion.py but im getting few problems: using gpu = 1 in the trainer return

    models/temporal_fusion_transformer/init.py", line 793, in _log_interpretation dim=0

    using only the cpu it works but return this error:

    AttributeError: module 'tensorflow._api.v1.io.gfile' has no attribute 'get_filesystem' which apparently it is due to pytorch and tensorboard incompatibility but i managed to install pytorch-forecasting without problems so could you tell me what version of pythorch/tensorboard are you using?

    thanks

    opened by lorrp1 14
  • Index out of error when training starts

    Index out of error when training starts

    • PyTorch-Forecasting version: 0.8.3
    • PyTorch version: 1.7.1
    • Python version: 3.7.9
    • Operating System: Linux

    Expected behaviour

    I am training a simple time series forecasting on temperature prediction problem. I have replicated the Stallion code for my dataset. I get an index out of bounds error as soon as training starts. I am unable to debug it.

    Code to reproduce the problem

    ### Data Set and Data Loader
    max_prediction_length = 6
    max_encoder_length = 24
    training_cutoff = train_data["time_idx"].max() - max_prediction_length
    
    training = TimeSeriesDataSet(
        train_data[lambda x: x.time_idx <= training_cutoff],
        time_idx="time_idx",
        target="meantemp",
        group_ids= ["group"],
        min_encoder_length=max_encoder_length // 2,  # keep encoder length long (as it is in the validation set)
        max_encoder_length=max_encoder_length,
        min_prediction_length=1,
        max_prediction_length=max_prediction_length,
        time_varying_known_categoricals=["day", "month"],
        time_varying_known_reals=["time_idx", "humidity","wind_speed"],
        time_varying_unknown_reals=['meantemp'],
    #     target_normalizer=GroupNormalizer(
    #         groups=["group"], transformation="softplus"
    #     ),  # use softplus and normalize by group
        
        target_normalizer= EncoderNormalizer(transformation='softplus'),  # use softplus and normalize by group
        add_relative_time_idx=True,
        allow_missings=True,
        add_target_scales=True,
        add_encoder_length=True,
    )
    
    
    validation = TimeSeriesDataSet.from_dataset(training, train_data, predict=True, 
                                                min_prediction_idx=training_cutoff + 1,
                                                stop_randomization=False)
    
    # create dataloaders for model
    batch_size = 32  # set this between 32 to 128
    train_dataloader = training.to_dataloader(train=True, batch_size=batch_size, num_workers=0)
    val_dataloader = validation.to_dataloader(train=False, batch_size=batch_size, num_workers=4)
    
    ### Training code
    early_stop_callback = EarlyStopping(monitor="val_loss", min_delta=1e-4, patience=10, verbose=False, mode="min")
    lr_logger = LearningRateMonitor()  # log the learning rate
    logger = TensorBoardLogger("lightning_logs")  # logging results to a tensorboard
    
    trainer = pl.Trainer(
        max_epochs=30,
        gpus=0,
        weights_summary="top",
        gradient_clip_val=0.1,
        limit_train_batches=30,  # coment in for training, running valiation every 30 batches
        # fast_dev_run=True,  # comment in to check that networkor dataset has no serious bugs
        callbacks=[lr_logger, early_stop_callback],
        logger=logger,
    )
    
    
    tft = TemporalFusionTransformer.from_dataset(
        training,
        learning_rate=0.1,
        hidden_size=16,
        attention_head_size=1,
        dropout=0.1,
        hidden_continuous_size=8,
        output_size=7,  # 7 quantiles by default
        loss=QuantileLoss(),
        log_interval=10,  # uncomment for learning rate finder and otherwise, e.g. to 10 for logging every 10 batches
        reduce_on_plateau_patience=4,
    )
    print(f"Number of parameters in network: {tft.size()/1e3:.1f}k")
    
    # fit network
    trainer.fit(
        tft,
        train_dataloader=train_dataloader,
        val_dataloaders=val_dataloader,
    )
    

    The error comes on the fit function. See below:


    RuntimeError Traceback (most recent call last) in 3 tft, 4 train_dataloader=train_dataloader, ----> 5 val_dataloaders=val_dataloader, 6 )

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py in fit(self, model, train_dataloader, val_dataloaders, datamodule) 508 self.call_hook('on_fit_start') 509 --> 510 results = self.accelerator_backend.train() 511 self.accelerator_backend.teardown() 512

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/accelerators/accelerator.py in train(self) 55 def train(self): 56 self.trainer.setup_trainer(self.trainer.model) ---> 57 return self.train_or_test() 58 59 def teardown(self):

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/accelerators/accelerator.py in train_or_test(self) 72 else: 73 self.trainer.train_loop.setup_training() ---> 74 results = self.trainer.train() 75 return results 76

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py in train(self) 559 with self.profiler.profile("run_training_epoch"): 560 # run train epoch --> 561 self.train_loop.run_training_epoch() 562 563 if self.max_steps and self.max_steps <= self.global_step:

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/trainer/training_loop.py in run_training_epoch(self) 548 # ------------------------------------ 549 with self.trainer.profiler.profile("run_training_batch"): --> 550 batch_output = self.run_training_batch(batch, batch_idx, dataloader_idx) 551 552 # when returning -1 from train_step, we end epoch early

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/trainer/training_loop.py in run_training_batch(self, batch, batch_idx, dataloader_idx) 716 717 # optimizer step --> 718 self.optimizer_step(optimizer, opt_idx, batch_idx, train_step_and_backward_closure) 719 720 else:

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/trainer/training_loop.py in optimizer_step(self, optimizer, opt_idx, batch_idx, train_step_and_backward_closure) 491 on_tpu=self.trainer.use_tpu and TPU_AVAILABLE, 492 using_native_amp=using_native_amp, --> 493 using_lbfgs=is_lbfgs, 494 ) 495

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/core/lightning.py in optimizer_step(self, epoch, batch_idx, optimizer, optimizer_idx, optimizer_closure, on_tpu, using_native_amp, using_lbfgs) 1296 1297 """ -> 1298 optimizer.step(closure=optimizer_closure) 1299 1300 def optimizer_zero_grad(

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/core/optimizer.py in step(self, closure, make_optimizer_step, *args, **kwargs) 284 285 if make_optimizer_step: --> 286 self.__optimizer_step(*args, closure=closure, profiler_name=profiler_name, **kwargs) 287 else: 288 # make sure to call optimizer_closure when accumulating

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/core/optimizer.py in __optimizer_step(self, closure, profiler_name, *args, **kwargs) 142 else: 143 with trainer.profiler.profile(profiler_name): --> 144 optimizer.step(closure=closure, *args, **kwargs) 145 146 accelerator_backend = trainer.accelerator_backend

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_forecasting/optim.py in step(self, closure) 129 closure: A closure that reevaluates the model and returns the loss. 130 """ --> 131 _ = closure() 132 loss = None 133 # note - below is commented out b/c I have other work that passes back

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/trainer/training_loop.py in train_step_and_backward_closure() 711 opt_idx, 712 optimizer, --> 713 self.trainer.hiddens 714 ) 715 return None if result is None else result.loss

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/trainer/training_loop.py in training_step_and_backward(self, split_batch, batch_idx, opt_idx, optimizer, hiddens) 804 with self.trainer.profiler.profile("training_step_and_backward"): 805 # lightning module hook --> 806 result = self.training_step(split_batch, batch_idx, opt_idx, hiddens) 807 self._curr_step_result = result 808

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/trainer/training_loop.py in training_step(self, split_batch, batch_idx, opt_idx, hiddens) 317 model_ref._current_fx_name = 'training_step' 318 model_ref._results = Result() --> 319 training_step_output = self.trainer.accelerator_backend.training_step(args) 320 self.trainer.logger_connector.cache_logged_metrics() 321

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/accelerators/cpu_accelerator.py in training_step(self, args) 60 61 def training_step(self, args): ---> 62 return self._step(self.trainer.model.training_step, args) 63 64 def validation_step(self, args):

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_lightning/accelerators/cpu_accelerator.py in _step(self, model_step, args) 56 output = model_step(*args) 57 else: ---> 58 output = model_step(*args) 59 return output 60

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_forecasting/models/base_model.py in training_step(self, batch, batch_idx) 263 """ 264 x, y = batch --> 265 log, _ = self.step(x, y, batch_idx) 266 # log loss 267 self.log("train_loss", log["loss"], on_step=True, on_epoch=True, prog_bar=True)

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_forecasting/models/temporal_fusion_transformer/init.py in step(self, x, y, batch_idx) 545 """ 546 # extract data and run model --> 547 log, out = super().step(x, y, batch_idx) 548 # calculate interpretations etc for latter logging 549 if self.log_interval > 0:

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_forecasting/models/base_model.py in step(self, x, y, batch_idx, **kwargs) 378 self.log_metrics(x, y, out) 379 if self.log_interval > 0: --> 380 self.log_prediction(x, out, batch_idx) 381 log = {"loss": loss, "n_samples": x["decoder_lengths"].size(0)} 382

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_forecasting/models/base_model.py in log_prediction(self, x, out, batch_idx) 487 log_indices = [0] 488 for idx in log_indices: --> 489 fig = self.plot_prediction(x, out, idx=idx, add_loss_to_title=True) 490 tag = f"{['Val', 'Train'][self.training]} prediction" 491 if self.training:

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_forecasting/models/temporal_fusion_transformer/init.py in plot_prediction(self, x, out, idx, plot_attention, add_loss_to_title, show_future_observed, ax) 708 # add attention on secondary axis 709 if plot_attention: --> 710 interpretation = self.interpret_output(out) 711 for f in to_list(fig): 712 ax = f.axes[0]

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_forecasting/models/temporal_fusion_transformer/init.py in interpret_output(self, out, reduction, attention_prediction_horizon, attention_as_autocorrelation) 596 597 # histogram of decode and encode lengths --> 598 encoder_length_histogram = integer_histogram(out["encoder_lengths"], min=0, max=self.hparams.max_encoder_length) 599 decoder_length_histogram = integer_histogram( 600 out["decoder_lengths"], min=1, max=out["decoder_variables"].size(1)

    ~/miniconda3/envs/torch/lib/python3.7/site-packages/pytorch_forecasting/utils.py in integer_histogram(data, min, max) 32 max = uniques.max() 33 hist = torch.zeros(max - min + 1, dtype=torch.long, device=data.device).scatter( ---> 34 dim=0, index=uniques - min, src=counts 35 ) 36 return hist

    RuntimeError: index 25 is out of bounds for dimension 0 with size 25

    error

    potential bug 
    opened by priya-dwivedi 12
  • Tensor Dimension Error When Applying TFT to Multiple Groups in Own Data

    Tensor Dimension Error When Applying TFT to Multiple Groups in Own Data

    Hi @jdb78,

    After getting the TFT model working well for one group of data based on our last convo (and updating to the latest version of the library), I'm getting an odd tensor dimension error when I try to train my model across multiple groups on my data. Specifically on epoch 15 I get this error/trace:

    ---------------------------------------------------------------------------
    RuntimeError                              Traceback (most recent call last)
    <ipython-input-32-14fda4f79b4a> in <module>
          1 # Train model
    ----> 2 trainer.fit(
          3     tft,
          4     train_dataloader = train_dataloader,
          5     val_dataloaders = val_dataloader
    
    ~/anaconda3/envs/forecasting/lib/python3.8/site-packages/pytorch_lightning/trainer/states.py in wrapped_fn(self, *args, **kwargs)
         46             if entering is not None:
         47                 self.state = entering
    ---> 48             result = fn(self, *args, **kwargs)
         49 
         50             # The INTERRUPTED state can be set inside the run function. To indicate that run was interrupted
    
    ~/anaconda3/envs/forecasting/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py in fit(self, model, train_dataloader, val_dataloaders, datamodule)
       1071             self.accelerator_backend = GPUBackend(self)
       1072             model = self.accelerator_backend.setup(model)
    -> 1073             results = self.accelerator_backend.train(model)
       1074 
       1075         elif self.use_tpu:
    
    ~/anaconda3/envs/forecasting/lib/python3.8/site-packages/pytorch_lightning/accelerators/gpu_backend.py in train(self, model)
         49 
         50     def train(self, model):
    ---> 51         results = self.trainer.run_pretrain_routine(model)
         52         return results
         53 
    
    ~/anaconda3/envs/forecasting/lib/python3.8/site-packages/pytorch_lightning/trainer/trainer.py in run_pretrain_routine(self, model)
       1237 
       1238         # CORE TRAINING LOOP
    -> 1239         self.train()
       1240 
       1241     def _run_sanity_check(self, ref_model, model):
    
    ~/anaconda3/envs/forecasting/lib/python3.8/site-packages/pytorch_lightning/trainer/training_loop.py in train(self)
        392                 # RUN TNG EPOCH
        393                 # -----------------
    --> 394                 self.run_training_epoch()
        395 
        396                 if self.max_steps and self.max_steps <= self.global_step:
    
    ~/anaconda3/envs/forecasting/lib/python3.8/site-packages/pytorch_lightning/trainer/training_loop.py in run_training_epoch(self)
        548 
        549         # process epoch outputs
    --> 550         self.run_training_epoch_end(epoch_output, checkpoint_accumulator, early_stopping_accumulator, num_optimizers)
        551 
        552         # checkpoint callback
    
    ~/anaconda3/envs/forecasting/lib/python3.8/site-packages/pytorch_lightning/trainer/training_loop.py in run_training_epoch_end(self, epoch_output, checkpoint_accumulator, early_stopping_accumulator, num_optimizers)
        662             # run training_epoch_end
        663             # a list with a result per optimizer index
    --> 664             epoch_output = model.training_epoch_end(epoch_output)
        665 
        666             if isinstance(epoch_output, Result):
    
    ~/anaconda3/envs/forecasting/lib/python3.8/site-packages/pytorch_forecasting/models/base_model.py in training_epoch_end(self, outputs)
        133 
        134     def training_epoch_end(self, outputs):
    --> 135         log, _ = self.epoch_end(outputs, label="train")
        136         return log
        137 
    
    ~/anaconda3/envs/forecasting/lib/python3.8/site-packages/pytorch_forecasting/models/temporal_fusion_transformer/__init__.py in epoch_end(self, outputs, label)
        613         log, out = super().epoch_end(outputs, label=label)
        614         if self.log_interval(label == "train") > 0:
    --> 615             self._log_interpretation(out, label=label)
        616         return log, out
        617 
    
    ~/anaconda3/envs/forecasting/lib/python3.8/site-packages/pytorch_forecasting/models/temporal_fusion_transformer/__init__.py in _log_interpretation(self, outputs, label)
        820         """
        821         # extract interpretations
    --> 822         interpretation = {
        823             name: torch.stack([x["interpretation"][name] for x in outputs]).sum(0)
        824             for name in outputs[0]["interpretation"].keys()
    
    ~/anaconda3/envs/forecasting/lib/python3.8/site-packages/pytorch_forecasting/models/temporal_fusion_transformer/__init__.py in <dictcomp>(.0)
        821         # extract interpretations
        822         interpretation = {
    --> 823             name: torch.stack([x["interpretation"][name] for x in outputs]).sum(0)
        824             for name in outputs[0]["interpretation"].keys()
        825         }
    
    RuntimeError: invalid argument 0: Sizes of tensors must match except in dimension 0. Got 6 and 7 in dimension 1 at /tmp/pip-req-build-8yht7tdu/aten/src/THC/generic/THCTensorMath.cu:71
    

    At first I thought this could be because not every state has the same amount of data available. For example, for select states, the number of days for which data exist are:

    state
    CA    218
    FL    218
    GA    218
    NY    218
    TX    218
    WA    260
    

    So I tried just getting the last 218 observations for each state and resetting time_idx, but the same tensor error was raised.

    Right now I'm only including the state as a group variable and am doing univariate time series modeling, so no other data are in the TFT.

    Also, the learning rate finder works, this is just the training that's failing. Really odd.

    I've made my code available here: https://drive.google.com/file/d/1r1w2tHZJrr8iXVqw7U5_qL1x4iOUsauk/view?usp=sharing. The data I'm playing with are on COVID, and the notebook includes a pd.read_csv() call that read in all the data for you from an online source, so you should be able to run it on your own without any issues.

    Any thoughts? Again, I greatly appreciate your feedback as I'm new to deep learning on time series data.

    Thanks in advance!

    Best, Alex

    bug help wanted 
    opened by AlexMRuch 12
  • Error when running TFT tutorial: AttributeError: 'functools.partial' object has no attribute '__name__'

    Error when running TFT tutorial: AttributeError: 'functools.partial' object has no attribute '__name__'

    • PyTorch-Forecasting version: 0.9.0
    • PyTorch version: 1.9.0
    • Python version: 1.3.8
    • Operating System: Debian 9 Linux 4.14

    Expected behavior

    I created a new virtual env and use pip install pytorch-forecasting and pip install pyarrow to run the tutorial code of TFT model.

    Actual behavior

    I got the following error:

    
    trainer.fit(...
    ---------------------------------------------------------------------------
    AttributeError                            Traceback (most recent call last)
    ~/qps_old/test.py in 
          165     tft,
          166     train_dataloader=train_dataloader,
    ----> 167     val_dataloaders=val_dataloader,
          168 )
          169 
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py in fit(self, model, train_dataloader, val_dataloaders, datamodule)
        458         )
        459 
    --> 460         self._run(model)
        461 
        462         assert self.state.stopped
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py in _run(self, model)
        753 
        754         # plugin will setup fitting (e.g. ddp will launch child processes)
    --> 755         self.pre_dispatch()
        756 
        757         # dispatch `start_training` or `start_evaluating` or `start_predicting`
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py in pre_dispatch(self)
        785             self.logger.log_hyperparams(self.lightning_module.hparams_initial)
        786             self.logger.log_graph(self.lightning_module)
    --> 787             self.logger.save()
        788 
        789     def post_dispatch(self):
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/pytorch_lightning/utilities/distributed.py in wrapped_fn(*args, **kwargs)
         47     def wrapped_fn(*args, **kwargs):
         48         if rank_zero_only.rank == 0:
    ---> 49             return fn(*args, **kwargs)
         50 
         51     return wrapped_fn
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/pytorch_lightning/loggers/tensorboard.py in save(self)
        236         # save the metatags file if it doesn't exist and the log directory exists
        237         if self._fs.isdir(dir_path) and not self._fs.isfile(hparams_file):
    --> 238             save_hparams_to_yaml(hparams_file, self.hparams)
        239 
        240     @rank_zero_only
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/pytorch_lightning/core/saving.py in save_hparams_to_yaml(config_yaml, hparams)
        398     for k, v in hparams.items():
        399         try:
    --> 400             yaml.dump(v)
        401         except TypeError:
        402             warn(f"Skipping '{k}' parameter because it is not possible to safely dump to YAML.")
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/__init__.py in dump(data, stream, Dumper, **kwds)
        288     If stream is None, return the produced string instead.
        289     """
    --> 290     return dump_all([data], stream, Dumper=Dumper, **kwds)
        291 
        292 def safe_dump_all(documents, stream=None, **kwds):
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/__init__.py in dump_all(documents, stream, Dumper, default_style, default_flow_style, canonical, indent, width, allow_unicode, line_break, encoding, explicit_start, explicit_end, version, tags, sort_keys)
        276         dumper.open()
        277         for data in documents:
    --> 278             dumper.represent(data)
        279         dumper.close()
        280     finally:
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent(self, data)
         25 
         26     def represent(self, data):
    ---> 27         node = self.represent_data(data)
         28         self.serialize(node)
         29         self.represented_objects = {}
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent_data(self, data)
         50             for data_type in data_types:
         51                 if data_type in self.yaml_multi_representers:
    ---> 52                     node = self.yaml_multi_representers[data_type](self, data)
         53                     break
         54             else:
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent_object(self, data)
        341                 and isinstance(state, dict) and newobj:
        342             return self.represent_mapping(
    --> 343                     'tag:yaml.org,2002:python/object:'+function_name, state)
        344         if not listitems and not dictitems  \
        345                 and isinstance(state, dict) and not state:
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent_mapping(self, tag, mapping, flow_style)
        116         for item_key, item_value in mapping:
        117             node_key = self.represent_data(item_key)
    --> 118             node_value = self.represent_data(item_value)
        119             if not (isinstance(node_key, ScalarNode) and not node_key.style):
        120                 best_style = False
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent_data(self, data)
         50             for data_type in data_types:
         51                 if data_type in self.yaml_multi_representers:
    ---> 52                     node = self.yaml_multi_representers[data_type](self, data)
         53                     break
         54             else:
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent_object(self, data)
        341                 and isinstance(state, dict) and newobj:
        342             return self.represent_mapping(
    --> 343                     'tag:yaml.org,2002:python/object:'+function_name, state)
        344         if not listitems and not dictitems  \
        345                 and isinstance(state, dict) and not state:
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent_mapping(self, tag, mapping, flow_style)
        116         for item_key, item_value in mapping:
        117             node_key = self.represent_data(item_key)
    --> 118             node_value = self.represent_data(item_value)
        119             if not (isinstance(node_key, ScalarNode) and not node_key.style):
        120                 best_style = False
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent_data(self, data)
         50             for data_type in data_types:
         51                 if data_type in self.yaml_multi_representers:
    ---> 52                     node = self.yaml_multi_representers[data_type](self, data)
         53                     break
         54             else:
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent_object(self, data)
        344         if not listitems and not dictitems  \
        345                 and isinstance(state, dict) and not state:
    --> 346             return self.represent_sequence(tag+function_name, args)
        347         value = {}
        348         if args:
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent_sequence(self, tag, sequence, flow_style)
         90         best_style = True
         91         for item in sequence:
    ---> 92             node_item = self.represent_data(item)
         93             if not (isinstance(node_item, ScalarNode) and not node_item.style):
         94                 best_style = False
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent_data(self, data)
         46         data_types = type(data).__mro__
         47         if data_types[0] in self.yaml_representers:
    ---> 48             node = self.yaml_representers[data_types[0]](self, data)
         49         else:
         50             for data_type in data_types:
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent_tuple(self, data)
        284 
        285     def represent_tuple(self, data):
    --> 286         return self.represent_sequence('tag:yaml.org,2002:python/tuple', data)
        287 
        288     def represent_name(self, data):
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent_sequence(self, tag, sequence, flow_style)
         90         best_style = True
         91         for item in sequence:
    ---> 92             node_item = self.represent_data(item)
         93             if not (isinstance(node_item, ScalarNode) and not node_item.style):
         94                 best_style = False
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent_data(self, data)
         50             for data_type in data_types:
         51                 if data_type in self.yaml_multi_representers:
    ---> 52                     node = self.yaml_multi_representers[data_type](self, data)
         53                     break
         54             else:
    
    ~/anaconda3/envs/envtest/lib/python3.7/site-packages/yaml/representer.py in represent_object(self, data)
        329         if dictitems is not None:
        330             dictitems = dict(dictitems)
    --> 331         if function.__name__ == '__newobj__':
        332             function = args[0]
        333             args = args[1:]
    
    AttributeError: 'functools.partial' object has no attribute '__name__'
    

    This is really strange, I thought it might be caused by version compatibility of pytorch-lightning and pytorch-forecasting (or tensorboard and PyYAML). I tried to use different version of pytorch-forecating, pytorch-lightning, but no progress.

    Code to reproduce the problem

    Just install the pytorch-forecasting and follow the turorial.

    pip install pytorch-forecasting
    pip install pyarrow
    
    #os.chdir("../../..")   #only change in the tutorial code to avoid permission error.
    

    Thank you!

    Solution

    Found the problem (although I don't know why). The problem lies in pandas version. I tested and found that pandas==1.2.x works fine but pandas==1.3.x will raise the error. Now pip install pytorch-forecasting and pip install --upgrade pandas==1.2.5 is OK to run.

    opened by LumingSun 11
  • Validation Data is not generated properly for my dataset

    Validation Data is not generated properly for my dataset

    Hi, Really appreciate your work on the TFT.

    I am trying to use my own dataset in the code but there seems to be a bug due to which the dataset is not being loaded properly for validation. The train dataloader is good. but the validation dataloader only has one batch and also validation(TimeSeriesDataSet) has only 1 entry.

    Below is my complete code

    data = load_csv()
    data['date']= pd.to_datetime(data['date'])
    data.reset_index(inplace=True, drop=True)
    data.reset_index(inplace=True)
    data.rename(columns={'index':'time_idx'}, inplace=True) # I use index as time_idx since my data is of minute frequency
    
    validation_len = int(len(data) * 0.1)
    training_cutoff = int(len(data)) - validation_len
    
    max_encode_length = 36
    max_prediction_length = 6
    
    print('Len of training data is : ',len(data[:training_cutoff]))
    print('Len of val data is : ',len(data[training_cutoff:]))
    training = TimeSeriesDataSet(
        data[:training_cutoff],
        time_idx="time_idx",
        target="T",
        group_ids=["Symbol"],
        max_encoder_length=max_encode_length,
        max_prediction_length=max_prediction_length,
        static_categoricals=["Symbol"],
        static_reals=[],
        time_varying_known_categoricals=[
            "hour_of_day",
            "day_of_week",
        ],
        time_varying_known_reals=[
            "time_idx",
        ],
        time_varying_unknown_categoricals=[],
        time_varying_unknown_reals=["V1", "V2","V3", "T", "V4"],
        constant_fill_strategy={"T": 0},
        dropout_categoricals=[],
    )
    print('Max Prediction Index : ',training.index.time.max())
    validation = TimeSeriesDataSet.from_dataset(training, data, min_prediction_idx=training.index.time.max()+1)
    batch_size = 128
    train_dataloader = training.to_dataloader(train=True, batch_size=batch_size, num_workers=1)
    val_dataloader = validation.to_dataloader(train=False, batch_size=batch_size, num_workers=1)
    
    print(len(training), len(validation))
    print(len(train_dataloader), len(val_dataloader))`
    

    This is what gets printed by the code :

    Len of training data is : 25920
    Len of val data is : 2880
    Min Prediction Index Value is 25919
    
    25920 1
    202 1
    

    You can see that the training dataset is good and the batches are also okay but validation batch is also 1 and dataset length is also 1.

    One more thing. if i use predict = False it generates validation data correctly but another bug arises due to that. if i use predict = True, only 1 batch and 1 sequence is given if i use predict_mode = true on the training dataset it also generates only 1 batch.

    Here is a sample of my CSV sample_data.csv.zip

    Please Help

    opened by RaviKumarAndroid 11
  • element 0 of tensors does not require grad and does not have a grad_fn

    element 0 of tensors does not require grad and does not have a grad_fn

    • PyTorch-Forecasting version: 0.7
    • PyTorch version: 1.7.0
    • Python version:3.8.3
    • Operating System:windows 10

    Hi, I'm trying to follow the tutorial with my own data. When I run the learning rate finder, i got this error:

    here is the full traceback:

    RuntimeError                              Traceback (most recent call last)
    <ipython-input-26-a92b5627800b> in <module>
          1 # find optimal learning rate
    ----> 2 res = trainer.tuner.lr_find(
          3     tft,
          4     train_dataloader=train_dataloader,
          5     val_dataloaders=val_dataloader,
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\tuner\tuning.py in lr_find(self, model, train_dataloader, val_dataloaders, min_lr, max_lr, num_training, mode, early_stop_threshold, datamodule)
        118             datamodule: Optional[LightningDataModule] = None
        119     ):
    --> 120         return lr_find(
        121             self.trainer,
        122             model,
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\tuner\lr_finder.py in lr_find(trainer, model, train_dataloader, val_dataloaders, min_lr, max_lr, num_training, mode, early_stop_threshold, datamodule)
        167 
        168     # Fit, lr & loss logged in callback
    --> 169     trainer.fit(model,
        170                 train_dataloader=train_dataloader,
        171                 val_dataloaders=val_dataloaders,
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\trainer\trainer.py in fit(self, model, train_dataloader, val_dataloaders, datamodule)
        444         self.call_hook('on_fit_start')
        445 
    --> 446         results = self.accelerator_backend.train()
        447         self.accelerator_backend.teardown()
        448 
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\accelerators\cpu_accelerator.py in train(self)
         57 
         58         # train or test
    ---> 59         results = self.train_or_test()
         60         return results
         61 
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\accelerators\accelerator.py in train_or_test(self)
         64             results = self.trainer.run_test()
         65         else:
    ---> 66             results = self.trainer.train()
         67         return results
         68 
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\trainer\trainer.py in train(self)
        493 
        494                 # run train epoch
    --> 495                 self.train_loop.run_training_epoch()
        496 
        497                 if self.max_steps and self.max_steps <= self.global_step:
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\trainer\training_loop.py in run_training_epoch(self)
        559             # TRAINING_STEP + TRAINING_STEP_END
        560             # ------------------------------------
    --> 561             batch_output = self.run_training_batch(batch, batch_idx, dataloader_idx)
        562 
        563             # when returning -1 from train_step, we end epoch early
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\trainer\training_loop.py in run_training_batch(self, batch, batch_idx, dataloader_idx)
        726 
        727                         # optimizer step
    --> 728                         self.optimizer_step(optimizer, opt_idx, batch_idx, train_step_and_backward_closure)
        729 
        730                     else:
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\trainer\training_loop.py in optimizer_step(self, optimizer, opt_idx, batch_idx, train_step_and_backward_closure, *args, **kwargs)
        467         with self.trainer.profiler.profile("optimizer_step"):
        468             # optimizer step lightningModule hook
    --> 469             self.trainer.accelerator_backend.optimizer_step(
        470                 optimizer, batch_idx, opt_idx, train_step_and_backward_closure, *args, **kwargs
        471             )
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\accelerators\accelerator.py in optimizer_step(self, optimizer, batch_idx, opt_idx, lambda_closure, *args, **kwargs)
        112 
        113         # model hook
    --> 114         model_ref.optimizer_step(
        115             epoch=self.trainer.current_epoch,
        116             batch_idx=batch_idx,
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\core\lightning.py in optimizer_step(self, epoch, batch_idx, optimizer, optimizer_idx, optimizer_closure, on_tpu, using_native_amp, using_lbfgs, *args, **kwargs)
       1378             optimizer.step(*args, **kwargs)
       1379         else:
    -> 1380             optimizer.step(closure=optimizer_closure, *args, **kwargs)
       1381 
       1382     def optimizer_zero_grad(
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\torch\optim\lr_scheduler.py in wrapper(*args, **kwargs)
         65                 instance._step_count += 1
         66                 wrapped = func.__get__(instance, cls)
    ---> 67                 return wrapped(*args, **kwargs)
         68 
         69             # Note that the returned function here is no longer a bound method,
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_forecasting\optim.py in step(self, closure)
        129             closure: A closure that reevaluates the model and returns the loss.
        130         """
    --> 131         _ = closure()
        132         loss = None
        133         # note - below is commented out b/c I have other work that passes back
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\trainer\training_loop.py in train_step_and_backward_closure()
        716 
        717                         def train_step_and_backward_closure():
    --> 718                             result = self.training_step_and_backward(
        719                                 split_batch,
        720                                 batch_idx,
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\trainer\training_loop.py in training_step_and_backward(self, split_batch, batch_idx, opt_idx, optimizer, hiddens)
        821             # backward pass
        822             with self.trainer.profiler.profile("model_backward"):
    --> 823                 self.backward(result, optimizer, opt_idx)
        824 
        825             # hook - call this hook only
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\trainer\training_loop.py in backward(self, result, optimizer, opt_idx, *args, **kwargs)
        841             self.trainer.accelerator_backend.backward(result, optimizer, opt_idx, *args, **kwargs)
        842         else:
    --> 843             result.closure_loss = self.trainer.accelerator_backend.backward(
        844                 result.closure_loss, optimizer, opt_idx, *args, **kwargs
        845             )
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\accelerators\accelerator.py in backward(self, closure_loss, optimizer, opt_idx, *args, **kwargs)
         93             # do backward pass
         94             model = self.trainer.get_model()
    ---> 95             model.backward(closure_loss, optimizer, opt_idx, *args, **kwargs)
         96 
         97             # once backward has been applied, release graph
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\pytorch_lightning\core\lightning.py in backward(self, loss, optimizer, optimizer_idx, *args, **kwargs)
       1256         """
       1257         if self.trainer.train_loop.automatic_optimization or self._running_manual_backward:
    -> 1258             loss.backward(*args, **kwargs)
       1259 
       1260     def toggle_optimizer(self, optimizer: Optimizer, optimizer_idx: int):
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\torch\tensor.py in backward(self, gradient, retain_graph, create_graph)
        219                 retain_graph=retain_graph,
        220                 create_graph=create_graph)
    --> 221         torch.autograd.backward(self, gradient, retain_graph, create_graph)
        222 
        223     def register_hook(self, hook):
    
    c:\users\u2\appdata\local\programs\python\python38\lib\site-packages\torch\autograd\__init__.py in backward(tensors, grad_tensors, retain_graph, create_graph, grad_variables)
        128         retain_graph = create_graph
        129 
    --> 130     Variable._execution_engine.run_backward(
        131         tensors, grad_tensors_, retain_graph, create_graph,
        132         allow_unreachable=True)  # allow_unreachable flag
    
    RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn
    
    potential bug 
    opened by mahdiebm99ipm 10
  • Hyperparameter optimization does not return learning rate

    Hyperparameter optimization does not return learning rate

    Presently, the hyperparameter optimization returns the best parameters for

    {'gradient_clip_val': 1.028043566346387,
     'hidden_size': 176,
     'dropout': 0.22095396475678628,
     'hidden_continuous_size': 36,
     'attention_head_size': 1}
    

    even when use_learning_rate_finder=True. I expect this could be fixed easily just by adding it to the optuna parameters to track.

    opened by AlexMRuch 10
  • Bump sphinx from 5.3.0 to 6.1.1

    Bump sphinx from 5.3.0 to 6.1.1

    Bumps sphinx from 5.3.0 to 6.1.1.

    Release notes

    Sourced from sphinx's releases.

    v6.1.1

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v6.1.0

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v6.0.1

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v6.0.0

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v6.0.0b2

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v6.0.0b1

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    Changelog

    Sourced from sphinx's changelog.

    Release 6.1.1 (released Jan 05, 2023)

    Bugs fixed

    • #11091: Fix util.nodes.apply_source_workaround for literal_block nodes with no source information in the node or the node's parents.

    Release 6.1.0 (released Jan 05, 2023)

    Dependencies

    Incompatible changes

    • #10979: gettext: Removed support for pluralisation in get_translation. This was unused and complicated other changes to sphinx.locale.

    Deprecated

    • sphinx.util functions:

      • Renamed sphinx.util.typing.stringify() to sphinx.util.typing.stringify_annotation()
      • Moved sphinx.util.xmlname_checker() to sphinx.builders.epub3._XML_NAME_PATTERN

      Moved to sphinx.util.display:

      • sphinx.util.status_iterator
      • sphinx.util.display_chunk
      • sphinx.util.SkipProgressMessage
      • sphinx.util.progress_message

      Moved to sphinx.util.http_date:

      • sphinx.util.epoch_to_rfc1123
      • sphinx.util.rfc1123_to_epoch

      Moved to sphinx.util.exceptions:

      • sphinx.util.save_traceback

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump ipython from 8.6.0 to 8.8.0

    Bump ipython from 8.6.0 to 8.8.0

    Bumps ipython from 8.6.0 to 8.8.0.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump nbsphinx from 0.8.10 to 0.8.11

    Bump nbsphinx from 0.8.10 to 0.8.11

    Bumps nbsphinx from 0.8.10 to 0.8.11.

    Release notes

    Sourced from nbsphinx's releases.

    nbsphinx 0.8.11

    https://pypi.org/project/nbsphinx/0.8.11/

    • LaTeX: apply code cell border style to all code blocks
    Changelog

    Sourced from nbsphinx's changelog.

    Version 0.8.11 -- 2022-12-29 -- PyPI__ -- diff__

    • LaTeX: apply code cell border style to all code blocks

    __ https://pypi.org/project/nbsphinx/0.8.11/ __ https://github.com/spatialaudio/nbsphinx/compare/0.8.10...0.8.11

    Version 0.8.10 -- 2022-11-13 -- PyPI__ -- diff__

    • Fix handling of source_suffix
    • A few LaTeX fixes

    __ https://pypi.org/project/nbsphinx/0.8.10/ __ https://github.com/spatialaudio/nbsphinx/compare/0.8.9...0.8.10

    Version 0.8.9 -- 2022-06-04 -- PyPI__ -- diff__

    • CSS: support tables in widgets
    • Avoid empty "raw" directive

    __ https://pypi.org/project/nbsphinx/0.8.9/ __ https://github.com/spatialaudio/nbsphinx/compare/0.8.8...0.8.9

    Version 0.8.8 -- 2021-12-31 -- PyPI__ -- diff__

    • Support for the sphinx_codeautolink extension
    • Basic support for the text builder

    __ https://pypi.org/project/nbsphinx/0.8.8/ __ https://github.com/spatialaudio/nbsphinx/compare/0.8.7...0.8.8

    Version 0.8.7 -- 2021-08-10 -- PyPI__ -- diff__

    • Fix assertion error in LaTeX build with Sphinx 4.1.0+

    __ https://pypi.org/project/nbsphinx/0.8.7/ __ https://github.com/spatialaudio/nbsphinx/compare/0.8.6...0.8.7

    Version 0.8.6 -- 2021-06-03 -- PyPI__ -- diff__

    • Support for Jinja2 version 3

    __ https://pypi.org/project/nbsphinx/0.8.6/ __ https://github.com/spatialaudio/nbsphinx/compare/0.8.5...0.8.6

    Version 0.8.5 -- 2021-05-12 -- PyPI__ -- diff__

    • Freeze Jinja2 version to 2.11 (for now, until a bugfix is found)
    • Add theme_comparison.py tool for creating multiple versions (with different HTML themes) of the docs at once

    __ https://pypi.org/project/nbsphinx/0.8.5/ __ https://github.com/spatialaudio/nbsphinx/compare/0.8.4...0.8.5

    Version 0.8.4 -- 2021-04-29 -- PyPI__ -- diff__

    • Support for mathjax3_config (for Sphinx >= 4)
    • Force loading MathJax on HTML pages generated from notebooks

    ... (truncated)

    Commits
    • fe3f1c1 Release 0.8.11
    • 3ee3995 DOC: use "booktabs" table style for LaTeX
    • dc076bd LaTeX: apply code cell border style to all code blocks
    • 936b1b6 LaTeX: disable rounded corners for code cells
    • dd7288d CircleCI: install binutils
    • 7137bb3 DOC: disallow ipython 8.7.0
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Why does this package on conda-forge limit prettytable to < 0.8?

    Why does this package on conda-forge limit prettytable to < 0.8?

    All of the versions of pytorch-forecasting on conda-forge >= 0.6.0 have a requirement of prettytable <0.8. However, looking at pyproject.toml, it does not appear that prettytable of any version is a dependency of this package. Is the conda-forge requirement valid, and if so, would it be possible to support a newer version of prettytable?

    opened by DManowitz 1
  • Bump setuptools from 65.3.0 to 65.5.1

    Bump setuptools from 65.3.0 to 65.5.1

    Bumps setuptools from 65.3.0 to 65.5.1.

    Changelog

    Sourced from setuptools's changelog.

    v65.5.1

    Misc ^^^^

    • #3638: Drop a test dependency on the mock package, always use :external+python:py:mod:unittest.mock -- by :user:hroncok
    • #3659: Fixed REDoS vector in package_index.

    v65.5.0

    Changes ^^^^^^^

    • #3624: Fixed editable install for multi-module/no-package src-layout projects.
    • #3626: Minor refactorings to support distutils using stdlib logging module.

    Documentation changes ^^^^^^^^^^^^^^^^^^^^^

    • #3419: Updated the example version numbers to be compliant with PEP-440 on the "Specifying Your Project’s Version" page of the user guide.

    Misc ^^^^

    • #3569: Improved information about conflicting entries in the current working directory and editable install (in documentation and as an informational warning).
    • #3576: Updated version of validate_pyproject.

    v65.4.1

    Misc ^^^^

    • #3613: Fixed encoding errors in expand.StaticModule when system default encoding doesn't match expectations for source files.
    • #3617: Merge with pypa/distutils@6852b20 including fix for pypa/distutils#181.

    v65.4.0

    Changes ^^^^^^^

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the Security Alerts page.
    dependencies 
    opened by dependabot[bot] 1
  • DeepAR unfixed data

    DeepAR unfixed data

    • PyTorch-Forecasting version: 0.10.3
    • PyTorch version:
    • Python version: 3.10
    • Operating System: Microsoft Windows 10

    hey :) How can I create train, validation, and test sets for a time series dataset with multiple series, where each series has a different length (maximum time index)? In particular, how can I specify the starting point for the prediction horizon for each series, since the min_prediction_length parameter of the DeepAR model expects an integer value that is applicable to all series?

    Actual behavior

    However, result was .... I think it has to do with ... because of ...

    Code to reproduce the problem

    
    

    Paste the command(s) you ran and the output. Including a link to a colab notebook will speed up issue resolution. If there was a crash, please include the traceback here. The code used to initialize the TimeSeriesDataSet and model should be also included.

    opened by aharonyi 0
Releases(v0.10.3)
  • v0.10.3(Sep 7, 2022)

    Fixed

    • Removed pandoc from dependencies as issue with poetry install (#1126)
    • Added metric attributes for torchmetric resulting in better multi-GPU performance (#1126)

    Added

    • "robust" encoder method can be customized by setting "center", "lower" and "upper" quantiles (#1126)
    Source code(tar.gz)
    Source code(zip)
  • v0.10.2(May 23, 2022)

    Added

    • DeepVar network (#923)
    • Enable quantile loss for N-HiTS (#926)
    • MQF2 loss (multivariate quantile loss) (#949)
    • Non-causal attention for TFT (#949)
    • Tweedie loss (#949)
    • ImplicitQuantileNetworkDistributionLoss (#995)

    Fixed

    • Fix learning scale schedule (#912)
    • Fix TFT list/tuple issue at interpretation (#924)
    • Allowed encoder length down to zero for EncoderNormalizer if transformation is not needed (#949)
    • Fix Aggregation and CompositeMetric resets (#949)

    Changed

    • Dropping Python 3.6 suppport, adding 3.10 support (#479)
    • Refactored dataloader sampling - moved samplers to pytorch_forecasting.data.samplers module (#479)
    • Changed transformation format for Encoders to dict from tuple (#949)

    Contributors

    • jdb78
    Source code(tar.gz)
    Source code(zip)
  • v0.10.1(Mar 24, 2022)

  • v0.10.0(Mar 23, 2022)

    Added

    • Added new N-HiTS network that has consistently beaten N-BEATS (#890)
    • Allow using torchmetrics as loss metrics (#776)
    • Enable fitting EncoderNormalizer() with limited data history using max_length argument (#782)
    • More flexible MultiEmbedding() with convenience output_size and input_size properties (#829)
    • Fix concatentation of attention (#902)

    Fixed

    • Fix pip install via github (#798)

    Contributors

    • jdb78
    • christy
    • lukemerrick
    • Seon82
    Source code(tar.gz)
    Source code(zip)
  • v0.9.2(Nov 29, 2021)

    Added

    • Added support for running pytorch_lightning.trainer.test (#759)

    Fixed

    • Fix inattention mutation to x_cont (#732).
    • Compatability with pytorch-lightning 1.5 (#758)

    Contributors

    • eavae
    • danielgafni
    • jdb78
    Source code(tar.gz)
    Source code(zip)
  • v0.9.1(Sep 26, 2021)

    Added

    • Use target name instead of target number for logging metrics (#588)
    • Optimizer can be initialized by passing string, class or function (#602)
    • Add support for multiple outputs in Baseline model (#603)
    • Added Optuna pruner as optional parameter in TemporalFusionTransformer.optimize_hyperparameters (#619)
    • Dropping support for Python 3.6 and starting support for Python 3.9 (#639)

    Fixed

    • Initialization of TemporalFusionTransformer with multiple targets but loss for only one target (#550)
    • Added missing transformation of prediction for MLP (#602)
    • Fixed logging hyperparameters (#688)
    • Ensure MultiNormalizer fit state is detected (#681)
    • Fix infinite loop in TimeDistributedEmbeddingBag (#672)

    Contributors

    • jdb78
    • TKlerx
    • chefPony
    • eavae
    • L0Z1K
    Source code(tar.gz)
    Source code(zip)
  • v0.9.0(Jun 4, 2021)

    Breaking changes

    • Removed dropout_categoricals parameter from TimeSeriesDataSet. Use categorical_encoders=dict(<variable_name>=NaNLabelEncoder(add_nan=True)) instead (#518)

    • Rename parameter allow_missings for TimeSeriesDataSet to allow_missing_timesteps (#518)

    • Transparent handling of transformations. Forward methods should now call two new methods (#518):

      • transform_output to explicitly rescale the network outputs into the de-normalized space
      • to_network_output to create a dict-like named tuple. This allows tracing the modules with PyTorch's JIT. Only prediction is still required which is the main network output.

      Example:

      def forward(self, x):
          normalized_prediction = self.module(x)
          prediction = self.transform_output(prediction=normalized_prediction, target_scale=x["target_scale"])
          return self.to_network_output(prediction=prediction)
      

    Added

    • Improved validation of input parameters of TimeSeriesDataSet (#518)

    Fixed

    • Fix quantile prediction for tensors on GPUs for distribution losses (#491)
    • Fix hyperparameter update for RecurrentNetwork.from_dataset method (#497)
    Source code(tar.gz)
    Source code(zip)
  • v0.8.5(Apr 27, 2021)

    Added

    • Allow lists for multiple losses and normalizers (#405)
    • Warn if normalization is with scale < 1e-7 (#429)
    • Allow usage of distribution losses in all settings (#434)

    Fixed

    • Fix issue when predicting and data is on different devices (#402)
    • Fix non-iterable output (#404)
    • Fix problem with moving data to CPU for multiple targets (#434)

    Contributors

    • jdb78
    • domplexity
    Source code(tar.gz)
    Source code(zip)
  • v0.8.4(Mar 7, 2021)

    Added

    • Adding a filter functionality to the timeseries datasset (#329)
    • Add simple models such as LSTM, GRU and a MLP on the decoder (#380)
    • Allow usage of any torch optimizer such as SGD (#380)

    Fixed

    • Moving predictions to CPU to avoid running out of memory (#329)
    • Correct determination of output_size for multi-target forecasting with the TemporalFusionTransformer (#328)
    • Tqdm autonotebook fix to work outside of Jupyter (#338)
    • Fix issue with yaml serialization for TensorboardLogger (#379)

    Contributors

    • jdb78
    • JakeForsey
    • vakker
    Source code(tar.gz)
    Source code(zip)
  • v0.8.3(Jan 31, 2021)

    Added

    • Make tuning trainer kwargs overwritable (#300)
    • Allow adding categories to NaNEncoder (#303)

    Fixed

    • Underlying data is copied if modified. Original data is not modified inplace (#263)
    • Allow plotting of interpretation on passed figure for NBEATS (#280)
    • Fix memory leak for plotting and logging interpretation (#311)
    • Correct shape of predict() method output for multi-targets (#268)
    • Remove cloudpickle to allow GPU trained models to be loaded on CPU devices from checkpoints (#314)

    Contributors

    • jdb78
    • kigawas
    • snumumrik
    Source code(tar.gz)
    Source code(zip)
  • v0.8.2(Jan 12, 2021)

  • v0.8.1(Jan 10, 2021)

    Added

    • Add "Release Notes" section to docs (#237)
    • Enable usage of lag variables for any model (#252)

    Changed

    • Require PyTorch>=1.7 (#245)

    Fixed

    • Fix issue for multi-target forecasting when decoder length varies in single batch (#249)
    • Enable longer subsequences for min_prediction_idx that were previously wrongfully excluded (#250)

    Contributors

    • jdb78
    Source code(tar.gz)
    Source code(zip)
  • v0.8.0(Jan 3, 2021)

    Added

    • Adding support for multiple targets in the TimeSeriesDataSet (#199) and amended tutorials.
    • Temporal fusion transformer and DeepAR with support for multiple tagets (#199)
    • Check for non-finite values in TimeSeriesDataSet and better validate scaler argument (#220)
    • LSTM and GRU implementations that can handle zero-length sequences (#235)
    • Helpers for implementing auto-regressive models (#236)

    Changed

    • TimeSeriesDataSet's y of the dataloader is a tuple of (target(s), weight) - potentially breaking for model or metrics implementation Most implementations will not be affected as hooks in BaseModel and MultiHorizonMetric were modified.

    Fixed

    • Fixed autocorrelation for pytorch 1.7 (#220)
    • Ensure reproducibility by replacing python set() with dict.fromkeys() (mostly TimeSeriesDataSet) (#221)
    • Ensures BetaDistributionLoss does not lead to infinite loss if actuals are 0 or 1 (#233)
    • Fix for GroupNormalizer if scaling by group (#223)
    • Fix for TimeSeriesDataSet when using min_prediction_idx (#226)

    Contributors

    • jdb78
    • JustinNeumann
    • reumar
    • rustyconover
    Source code(tar.gz)
    Source code(zip)
  • v0.7.1(Dec 7, 2020)

    Added

    • Tutorial on how to implement a new architecture covering basic and advanced use cases (#188)
    • Additional and improved documentation - particularly of implementation details (#188)

    Changed (breaking for new model implementations)

    • Moved multiple private methods to public methods (particularly logging) (#188)
    • Moved get_mask method from BaseModel into utils module (#188)
    • Instead of using label to communicate if model is training or validating, using self.training attribute (#188)
    • Using sample((n,)) of pytorch distributions instead of deprecated sample_n(n) method (#188)
    Source code(tar.gz)
    Source code(zip)
  • v0.7.0(Dec 3, 2020)

    Added

    • Beta distribution loss for probabilistic models such as DeepAR (#160)

    Changed

    • BREAKING: Simplifying how to apply transforms (such as logit or log) before and after applying encoder. Some transformations are included by default but a tuple of a forward and reverse transform function can be passed for arbitrary transformations. This requires to use a transformation keyword in target normalizers instead of, e.g. log_scale (#185)

    Fixed

    • Incorrect target position if len(static_reals) > 0 leading to leakage (#184)
    • Fixing predicting completely unseen series (#172)

    Contributors

    • jdb78
    • JakeForsey
    Source code(tar.gz)
    Source code(zip)
  • v0.6.1(Nov 24, 2020)

    Added

    • Using GRU cells with DeepAR (#153)

    Fixed

    • GPU fix for variable sequence length (#169)
    • Fix incorrect syntax for warning when removing series (#167)
    • Fix issue when using unknown group ids in validation or test dataset (#172)
    • Run non-failing CI on PRs from forks (#166, #156)

    Docs

    • Improved model selection guidance and explanations on how TimeSeriesDataSet works (#148)
    • Clarify how to use with conda (#168)

    Contributors

    • jdb78
    • JakeForsey
    Source code(tar.gz)
    Source code(zip)
  • v0.6.0(Nov 10, 2020)

    Added

    • DeepAR by Amazon (#115)
      • First autoregressive model in PyTorch Forecasting
      • Distribution loss: normal, negative binomial and log-normal distributions
      • Currently missing: handling lag variables and tutorial (planned for 0.6.1)
    • Improved documentation on TimeSeriesDataSet and how to implement a new network (#145)

    Changed

    • Internals of encoders and how they store center and scale (#115)

    Fixed

    • Update to PyTorch 1.7 and PyTorch Lightning 1.0.5 which came with breaking changes for CUDA handling and with optimizers (PyTorch Forecasting Ranger version) (#143, #137, #115)

    Contributors

    • jdb78
    • JakeForesey
    Source code(tar.gz)
    Source code(zip)
  • v0.5.3(Oct 31, 2020)

    Fixes

    • Fix issue where hyperparameter verbosity controlled only part of output (#118)
    • Fix occasional error when .get_parameters() from TimeSeriesDataSet failed (#117)
    • Remove redundant double pass through LSTM for temporal fusion transformer (#125)
    • Prevent installation of pytorch-lightning 1.0.4 as it breaks the code (#127)
    • Prevent modification of model defaults in-place (#112)
    Source code(tar.gz)
    Source code(zip)
  • v0.5.2(Oct 18, 2020)

    Added

    • Hyperparameter tuning with optuna to tutorial
    • Control over verbosity of hyper parameter tuning

    Fixes

    • Interpretation error when different batches had different maximum decoder lengths
    • Fix some typos (no changes to user API)
    Source code(tar.gz)
    Source code(zip)
  • v0.5.1(Oct 14, 2020)

  • v0.5.0(Oct 12, 2020)

    Added

    • Additional checks for TimeSeriesDataSet inputs - now flagging if series are lost due to high min_encoder_length and ensure parameters are integers
    • Enable classification - simply change the target in the TimeSeriesDataSet to a non-float variable, use the CrossEntropy metric to optimize and output as many classes as you want to predict

    Changed

    • Ensured PyTorch Lightning 0.10 compatibility
      • Using LearningRateMonitor instead of LearningRateLogger
      • Use EarlyStopping callback in trainer callbacks instead of early_stopping argument
      • Update metric system update() and compute() methods
      • Use trainer.tuner.lr_find() instead of trainer.lr_find() in tutorials and examples
    • Update poetry to 1.1.0
    Source code(tar.gz)
    Source code(zip)
  • v0.4.1(Oct 1, 2020)

    Fixes

    Model

    • Removed attention to current datapoint in TFT decoder to generalise better over various sequence lengths
    • Allow resuming optuna hyperparamter tuning study

    Data

    • Fixed inconsistent naming and calculation of encoder_lengthin TimeSeriesDataSet when added as feature

    Contributors

    • jdb78
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Sep 28, 2020)

    Added

    Models

    • Backcast loss for N-BEATS network for better regularisation
    • logging_metrics as explicit arguments to models

    Metrics

    • MASE (Mean absolute scaled error) metric for training and reporting
    • Metrics can be composed, e.g. 0.3* metric1 + 0.7 * metric2
    • Aggregation metric that is computed on mean prediction over all samples to reduce mean-bias

    Data

    • Increased speed of parsing data with missing datapoints. About 2s for 1M data points. If numba is installed, 0.2s for 1M data points
    • Time-synchronize samples in batches: ensure that all samples in each batch have with same time index in decoder

    Breaking changes

    • Improved subsequence detection in TimeSeriesDataSet ensures that there exists a subsequence starting and ending on each point in time.
    • Fix min_encoder_length = 0 being ignored and processed as min_encoder_length = max_encoder_length

    Contributors

    • jdb78
    • dehoyosb
    Source code(tar.gz)
    Source code(zip)
  • v0.3.1(Sep 13, 2020)

    • More tests driving coverage to ~90%
    • Performance tweaks for temporal fusion transformer
    • Reformatting with sort
    • Improve documentation - particularly expand on hyper parameter tuning

    Fixes:

    • Fix PoissonLoss quantiles calculation
    • Fix N-Beats visualisations
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Sep 2, 2020)

    Added

    • Calculating partial dependency for a variable
    • Improved documentation - in particular added FAQ section and improved tutorial
    • Data for examples and tutorials can now be downloaded. Cloning the repo is not a requirement anymore
    • Added Ranger Optimizer from pytorch_ranger package and fixed its warnings (part of preparations for conda package release)
    • Use GPU for tests if available as part of preparation for GPU tests in CI

    Changes

    • BREAKING: Fix typo “add_decoder_length” to “add_encoder_length” in TimeSeriesDataSet

    Bugfixes

    • Fixing plotting predictions vs actuals by slicing variables
    Source code(tar.gz)
    Source code(zip)
  • v0.2.4(Aug 26, 2020)

  • v0.2.3(Aug 23, 2020)

  • v0.2.2(Aug 23, 2020)

  • v0.2.1(Aug 23, 2020)

    This release improves robustness of the code.

    Fixing bug across code, in particularly

    • Ensuring that code works on GPUs
    • Adding tests for models, dataset and normalisers
    • Test using GitHub Actions (tests on GPU are still missing)

    Extend documentation by improving docstrings and adding two tutorials.

    Improving default arguments for TimeSeriesDataSet to avoid surprises

    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(Aug 16, 2020)

    Minor release

    Added

    • Basic tests for data and model (mostly integration tests)
    • Automatic target normalization
    • Improved visualization and logging of temporal fusion transformer
    • Model bugfixes and performance improvements for temporal fusion transformer

    Modified

    • Metrics are reduced to calculating loss. Target transformations are done by new target transformer
    Source code(tar.gz)
    Source code(zip)
Owner
Jan Beitner
Data scientist and consultant who loves to keep up with the latest academic research and drive real business impact
Jan Beitner
A python library for easy manipulation and forecasting of time series.

Time Series Made Easy in Python darts is a python library for easy manipulation and forecasting of time series. It contains a variety of models, from

Unit8 5.2k Jan 4, 2023
ETNA is an easy-to-use time series forecasting framework.

ETNA is an easy-to-use time series forecasting framework. It includes built in toolkits for time series preprocessing, feature generation, a variety of predictive models with unified interface - from classic machine learning to SOTA neural networks, models combination methods and smart backtesting. ETNA is designed to make working with time series simple, productive, and fun.

Tinkoff.AI 674 Jan 7, 2023
Nixtla is an open-source time series forecasting library.

Nixtla Nixtla is an open-source time series forecasting library. We are helping data scientists and developers to have access to open source state-of-

Nixtla 401 Jan 8, 2023
ETNA – time series forecasting framework

ETNA Time Series Library Predict your time series the easiest way Homepage | Documentation | Tutorials | Contribution Guide | Release Notes ETNA is an

Tinkoff.AI 675 Jan 8, 2023
Continuously evaluated, functional, incremental, time-series forecasting

timemachines Autonomous, univariate, k-step ahead time-series forecasting functions assigned Elo ratings You can: Use some of the functionality of a s

Peter Cotton 343 Jan 4, 2023
A machine learning toolkit dedicated to time-series data

tslearn The machine learning toolkit for time series analysis in Python Section Description Installation Installing the dependencies and tslearn Getti

null 2.3k Jan 5, 2023
Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.

Prophet: Automatic Forecasting Procedure Prophet is a procedure for forecasting time series data based on an additive model where non-linear trends ar

Facebook 15.4k Jan 7, 2023
Open source time series library for Python

PyFlux PyFlux is an open source time series library for Python. The library has a good array of modern time series models, as well as a flexible array

Ross Taylor 2k Jan 2, 2023
Automatic extraction of relevant features from time series:

tsfresh This repository contains the TSFRESH python package. The abbreviation stands for "Time Series Feature extraction based on scalable hypothesis

Blue Yonder GmbH 7k Jan 6, 2023
A unified framework for machine learning with time series

Welcome to sktime A unified framework for machine learning with time series We provide specialized time series algorithms and scikit-learn compatible

The Alan Turing Institute 6k Jan 6, 2023
A statistical library designed to fill the void in Python's time series analysis capabilities, including the equivalent of R's auto.arima function.

pmdarima Pmdarima (originally pyramid-arima, for the anagram of 'py' + 'arima') is a statistical library designed to fill the void in Python's time se

alkaline-ml 1.3k Dec 22, 2022
A machine learning toolkit dedicated to time-series data

tslearn The machine learning toolkit for time series analysis in Python Section Description Installation Installing the dependencies and tslearn Getti

null 2.3k Dec 29, 2022
Probabilistic time series modeling in Python

GluonTS - Probabilistic Time Series Modeling in Python GluonTS is a Python toolkit for probabilistic time series modeling, built around Apache MXNet (

Amazon Web Services - Labs 3.3k Jan 3, 2023
STUMPY is a powerful and scalable Python library for computing a Matrix Profile, which can be used for a variety of time series data mining tasks

STUMPY STUMPY is a powerful and scalable library that efficiently computes something called the matrix profile, which can be used for a variety of tim

TD Ameritrade 2.5k Jan 6, 2023
A Python package for time series classification

pyts: a Python package for time series classification pyts is a Python package for time series classification. It aims to make time series classificat

Johann Faouzi 1.4k Jan 1, 2023
Python module for machine learning time series:

seglearn Seglearn is a python package for machine learning time series or sequences. It provides an integrated pipeline for segmentation, feature extr

David Burns 536 Dec 29, 2022
Automatically build ARIMA, SARIMAX, VAR, FB Prophet and XGBoost Models on Time Series data sets with a Single Line of Code. Now updated with Dask to handle millions of rows.

Auto_TS: Auto_TimeSeries Automatically build multiple Time Series models using a Single Line of Code. Now updated with Dask. Auto_timeseries is a comp

AutoViz and Auto_ViML 519 Jan 3, 2023
A Python toolkit for rule-based/unsupervised anomaly detection in time series

Anomaly Detection Toolkit (ADTK) Anomaly Detection Toolkit (ADTK) is a Python package for unsupervised / rule-based time series anomaly detection. As

Arundo Analytics 888 Dec 30, 2022
AtsPy: Automated Time Series Models in Python (by @firmai)

Automated Time Series Models in Python (AtsPy) SSRN Report Easily develop state of the art time series models to forecast univariate data series. Simp

Derek Snow 465 Jan 2, 2023