83 Commits

Author SHA1 Message Date
Nick ccc35afb31 GluonTS import updates (#106)
* GluonTS import updates

* drop freq argument

see https://github.com/awslabs/gluon-ts/pull/1997
2022-07-29 16:46:17 -04:00
Kashif Rasul f2daf9c2b3 to numpy 2022-04-20 13:45:08 +02:00
Kashif Rasul ae0aed8339 fixed cosine schedule 2022-04-20 12:01:17 +02:00
Dr. Kashif Rasul 0e085ac3a9 added unit interval domain map 2021-05-18 08:26:11 +02:00
Kashif Rasul 908945b422 Time grad (#28)
* initial uncond image gaussian diff

TODO make it work for multivariate vector
add conditioning

* remove tqdm

* initial unet

TODO convert to 1d conv

* initial time grad estimator

* initial training

* initial sampling

* added huber loss

* use SinusoidalPosEmb from wavegrad

* use time diff network

* fix reshaping

* fix missing property

* clip false

* updated api

* added padding

* added circular padding

* use linear schedule

* added more schedules

* added back cosine schedule

* Delete Solar-time-grad.ipynb

* updated estimator API

* not tuple

* renamed to EpsilonTheta

* removed

* added example notebook

* removed some output

* fix requirements

* formatting

* added more options to time-grad

* added article
2021-02-11 10:09:25 +01:00
Dr. Kashif Rasul d5577a2c9e fix some tests 2020-12-30 19:17:54 +01:00
Dr. Kashif Rasul b072ab227b initial gluonts dependency 2020-12-17 17:04:56 +01:00
Dr. Kashif Rasul 149a35a7f8 Revert "add gate_logits to zero inflated"
This reverts commit 7415a15256.
2020-10-21 16:44:44 +02:00
Dr. Kashif Rasul 7415a15256 add gate_logits to zero inflated 2020-10-19 16:04:43 +02:00
Adele Gouttes e3b8de5da9 ASF-3099 Implement IQN in pytorch-ts (#21)
* ASF-3099 Bootstrap: write backbones of test, distribution and distribution output

* ASF-3099 First proposition for IQN distribution output
Mostly for backbones, the functions themselves are far from final

* ASF-3099 Add sample() to ImplicitQuantile and its test

* ASF-3099 Test prediction, sampling and convergence logic for IQN

* ASF-3099 IQN module takes the data input and taus in

* ASF-3099 Add torch.no_grad in the sampling

* ASF-3099 Add tests on quantiles (10%, 90%), for both normal and uniform

* ASF-3099 Improve feeting of quantile function:
Increase depth of quantile network, change activation to PReLU

* ASF-3099 Fix distribution attributes and module imports

* ASF-3099 Fix implicit quantile init

* ASF-3099 Add integration test with deepAR

* ASF-3099 Add a transformed distribution

* ASF-3099 Fix init of ImplicitQuantile

* ASF-3099 Make iqn distribution compatible with forecast-length>1

* ASF-3099 Fix device for new tensors

* ASF-3099 Fix device for new tensors: device is not a function...

* ASF-3099 Fix output size of the network

* ASF-3099 Define torch network in the DistributionOutput only
Distribution takes only the predicted quantiles, or the parameters
of the trained model to define a new quantile function

* ASF-3099 Test: create quantile function on compatible device
Attempt: class method might force the module to be created only once,
not necessarily with the right device

* ASF-3099 Second attempt: create quantile function on compatible device

* ASF-3099 Sampling returns a tensor of the correct shape
Shape is (num_sample, batch_size, forecast_length)

* ASF-3099 Handle empty sample shapes

* ASF-3099 Fix tau device at inference time

* ASF-3099 Fix device of the layer

* ASF-3099 Handle empty sample shapes (fix output)

* ASF-3099 Last activation of quantile layer should be removed
That way, embedded quantiles are symetrically distributed around the 0.5
quantile. Otherwise we distort part of their distribution before applying
it to the forecasted quantities

* ASF-3099 (test) Add a bunch of layers

* ASF-3099 [test] reduce the embedding size of tau

* ASF-3099 [test] Use same IQN version as in sales forecaster

* ASF-3099 Put original parameters back

* use @torch.no_grad() decorator

* ASF-3099 [test, to be reverted] Remove - in front of the loss

* ASF-3099 Revert former commit: put - back in the loss

* ASF-3099 [fix] Add log_prob method in piecewise linear

* ASF-3099 [test] ImplicitQuantileModule should be instanciated only once
Current problem: it's instanciated once at training and once at prediction,
as if the model was never trained. Thus it is now defined as a
global variable. However, this can only be a temporary hack: it means that
only one model can be trained during a session.

* ASF-3099 [test] ImplicitQuantileModule should be instanciated only once
Current problem: it's instanciated once at training and once at prediction,
as if the model was never trained.
However here, if the same model is retrained in the same session,
the module is not reset.

* ASF-3099 Add notebooks for experiments

* ASF-3099 [test] Move module to the distribution

* ASF-3099 Class method for args_proj

* ASF-3099 Clean up

* ASF-3099 More clean up

* ASF-3099 Define options for domain of preditected quantiles
Predicted quantiles can be either positive, either real

* ASF-3099 Set quantile_arg_proj in the init of the distribution output
Before it was instanciated once per python session, thus when retraining
the same models, the previously trained module was used, and not a fresh
one

* ASF-3099 Add test on number of instantiation of the quantile_arg_proj

* ASF-3099 Add an example notebook

* ASF-3099 Remove some notebooks

* ASF-3099 Remove diff vs master

Co-authored-by: Kashif Rasul <kashif.rasul@zalando.de>
Co-authored-by: Mateusz Koren <mateusz.koren@zalando.de>
Co-authored-by: Adele Gouttes <agouttes@bm1-lxslurmctl01.corp.ad.zalando.net>
2020-10-01 15:52:04 +02:00
Kashif Rasul 4aa176186a initial piecewise linear distribution (#22)
* initial piecewise linear distribution

test is failing though

* typo

* added more tests

* added TransformedPiecewiseLinear and output

* added test_robustness and fixed typos

* more typos

* fix issue with torch.where

* sample without grad

* added license
2020-09-17 09:29:19 +02:00
Kashif Rasul e685cf4b39 Zero Inflated output (#17)
* ZeroInflated output

added ZIP and ZINB outputs

* fix import

* use torch.sigmoid
2020-07-13 13:00:08 +02:00
Kashif Rasul 1d341ac515 fix NB test 2020-07-06 13:20:27 +02:00
Kashif Rasul f0d64126c6 remove initialization 2020-07-04 01:10:22 +02:00
Kashif Rasul ead4609f91 use logits for neg. bin. 2020-07-04 01:08:46 +02:00
Dr. Kashif Rasul bab3716819 formatting 2020-06-18 22:13:18 +02:00
Ingmar Schuster 5a06d3406f First go at IndependentDistributionOutput (#16)
* First go at IndependentDistributionOutput, subclassed by NormalOutput and NegativeBinomialOutput for now

* Multivariate test for new implementation of NormalOutput

* adding scaling parameter to NormalOutput

* IndependentNormalOutput now is an alias of NormalOutput with a DeprecatedWarning. Some more univariate distributions now inherit from IndependentDistributionOutput

* IndependentNormalOutput now is an alias of NormalOutput with a DeprecatedWarning. Some more univariate distributions now inherit from IndependentDistributionOutput
2020-06-18 17:08:44 +02:00
Dr. Kashif Rasul 9ac375a89d log_abs_det doesnt change int he forward 2020-06-04 10:34:58 +02:00
Dr. Kashif Rasul 6efcd6c5b9 upstream fixes to evaluator and NB output 2020-06-03 11:01:32 +02:00
Dr. Kashif Rasul e5f66530b1 fix serialization 2020-05-22 15:15:05 +02:00
Dr. Kashif Rasul 2f65617be0 fix name clash 2020-05-15 13:57:16 +02:00
Dr. Kashif Rasul cd5b061b9b fix scaling of mixtures 2020-05-15 13:21:52 +02:00
Dr. Kashif Rasul af0b129b21 fixed typos 2020-05-15 13:12:44 +02:00
Kashif Rasul 085ee835a5 Mixture output (#13)
* get dataset returns shuffled training data by default

* added Gaussian mixture output distribution

* added StudentTMixtureOutput
2020-05-15 13:04:45 +02:00
Dr. Kashif Rasul 86e6828091 NB multiply 2nd moment by scale 2020-05-07 16:20:14 +02:00
Kashif Rasul c5fac32bb2 initial lstnet multivariate point forecasting model (#9)
* initial lstnet

* lstnet network

* fixed forward

* fix splitter

* fix prediction

* rename argument to what it is i.e. time_first

* fixed scaling and some default values

* scaler can now take time_first=False tensors
2020-04-17 17:13:44 +02:00
Dr. Kashif Rasul 2d8f6d31f0 revert back change and added comments 2020-04-07 11:05:17 +02:00
Dr. Kashif Rasul 5b57396cea scale alpha so that sigma scales by scale as well 2020-04-07 09:41:22 +02:00
Dr. Kashif Rasul f615be41f0 Revert "scale alpha so that the var stays the same"
This reverts commit 3c6bbf28d7.
2020-04-06 12:09:38 +02:00
Dr. Kashif Rasul 3c6bbf28d7 scale alpha so that the var stays the same 2020-04-06 11:38:35 +02:00
Dr. Kashif Rasul 192f9d3991 fix typo 2020-03-31 11:04:56 +02:00
Dr. Kashif Rasul cb012405bf optimized the imports 2020-03-30 13:01:08 +02:00
Dr. Kashif Rasul 47063478b7 scale alpha by 1/scale so that var scales by scale factor 2020-03-27 11:34:12 +01:00
Dr. Kashif Rasul 55644c4671 added NormalOutput 2020-03-25 13:34:08 +01:00
Dr. Kashif Rasul 6bc281e526 fix scaling of alpha 2020-03-21 17:47:35 +01:00
Vahe Hakobyan 1b123ef152 Model serialization (#6)
* wip: serialization ran successfully

* wip: deserialization ran successfully
2020-03-12 11:32:46 +01:00
Kashif Rasul 6bc8de7edb call __init__ before registering buffers 2020-03-05 15:37:45 +01:00
Kashif Rasul 7a16872e26 fix the final log_abs_det_jacobian when scaling (#3)
* fix the final log_abs_det_jacobian

* fix argument name

* subclass from Flow class

* move buffer for base dist to Flow class as well

* formatting
2020-02-26 11:02:16 +01:00
Dr. Kashif Rasul b311aded13 exchange the forward and inverse in Real NVP 2020-01-22 10:48:45 +01:00
Kashif Rasul f09153cf5a fix RealNVP forward and inverse 2020-01-21 22:16:52 +01:00
Dr. Kashif Rasul ea2466f8a0 add scale variable 2020-01-17 13:14:31 +01:00
Dr. Kashif Rasul e472f57c1c fix import 2020-01-17 11:51:45 +01:00
Dr. Kashif Rasul 3b46a293c5 added Masked Linear Layer 2020-01-17 11:47:35 +01:00
Dr. Kashif Rasul 744eb22ec4 added MAF 2020-01-17 11:36:30 +01:00
Dr. Kashif Rasul 6ee817ab72 dont set scale if scaling is false 2020-01-15 15:24:11 +01:00
Dr. Kashif Rasul c1970eae9b revert 2020-01-15 13:24:57 +01:00
Dr. Kashif Rasul 888139203a detach scale tensor just in case and mult. in forward 2020-01-15 13:19:05 +01:00
Kashif Rasul 9938121a42 Test conditioning (#1)
* explicitly set the conditioning to flow

* try ELUs

* return first element of tuple

* typo

* revert ELU
2020-01-15 11:39:10 +01:00
Kashif Rasul c429003932 cleanup 2020-01-13 20:31:05 +01:00
Kashif Rasul f8bf093fee typo 2020-01-13 20:15:31 +01:00