Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mqcnn rts #668

Merged
merged 56 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
a104dea
more features for MQDNN, and Refactoring, remove of ts-fields from da…
lovvge Feb 11, 2020
56b150b
fix the future target calculation
lovvge Feb 18, 2020
356efaa
Added derive_auto_fields method.
Feb 25, 2020
eefce49
add use_dynamic_feat option
lovvge Feb 25, 2020
67d94eb
Added checks for dyn features.
Feb 25, 2020
2e8dc06
Fix from_hyperparameters for GluonEstimator.
Feb 25, 2020
70f3a25
enable date and age features, and rts
lovvge Feb 25, 2020
4aaf099
Merge branch 'master' into mqcnn-rts
Mar 27, 2020
1f66ac1
Fixup.
Feb 26, 2020
de08785
xx
Mar 31, 2020
2a6d737
Fixup.
Mar 31, 2020
592eb67
Another fixup.
Apr 1, 2020
9a1c1ac
Merge branch 'master' into mqcnn-rts
Apr 8, 2020
d19f5b5
Merge branch 'master' into mqcnn-rts
AaronSpieler Apr 14, 2020
db57304
Fixing formatting and tests.
Apr 14, 2020
ecf31e4
A lot of TODOs and comments added.
Apr 15, 2020
dab925c
Merge from production.
Apr 16, 2020
923510b
Fixing mq_dnn single quantile error and type errors.
Apr 16, 2020
e553095
Refactoring dnn_estimator file.
Apr 17, 2020
1ba5871
Adding additional tests, minor bugfix.
Apr 17, 2020
8ba66e0
Major refactoring that allows for disabling inputs at will. All tests…
Apr 17, 2020
ae683df
Removed print
Apr 17, 2020
bd733d8
Ensuring backward compatibility, some refactoring.
Apr 17, 2020
b17c663
Mainly argument refactoring, but also some legibility refactoring.
Apr 17, 2020
5b2cfc5
Merge branch 'master' into mqcnn-rts
AaronSpieler Apr 17, 2020
62395f6
Added use_feat_static_cat support and observed_values support.
Apr 20, 2020
cf30266
Merge branch 'master' into mqcnn-rts
AaronSpieler Apr 20, 2020
8d7b87d
Minor refactoring.
Apr 20, 2020
c8221a0
Merge branch 'mqcnn-rts' of https://github.com/lovvge/gluon-ts into m…
Apr 20, 2020
2be272b
Merge branch 'master' into mqcnn-rts
Apr 21, 2020
a3bf607
Addressing Jaspers Review
Apr 21, 2020
11209c3
Merge branch 'mqcnn-rts' of https://github.com/lovvge/gluon-ts into m…
Apr 21, 2020
ed594ac
Update src/gluonts/model/estimator.py
jaheba Apr 22, 2020
a25cd6a
Merge branch 'master' into mqcnn-rts
AaronSpieler Apr 22, 2020
edc17fb
Backwards compatibility and minor fixes.
Apr 23, 2020
3d8c73e
Merge branch 'mqcnn-rts' of https://github.com/lovvge/gluon-ts into m…
Apr 23, 2020
32271e7
Improvements to model thoughput.
Apr 30, 2020
7920a03
allow decoding features
lovvge May 2, 2020
23566bd
Merge branch 'master' into mqcnn-rts
AaronSpieler May 4, 2020
fdb011d
Temprorariliy added unconditional caching.
May 4, 2020
b280046
Enabled multiprocessing by default.
May 4, 2020
2ed3c19
Standartized comments.
May 4, 2020
1c57e45
Small bug fixes.
May 4, 2020
4fce760
making caching and multiprocessing always on a local change
May 5, 2020
12673bc
mend
May 5, 2020
a020a47
Backwards compatibility fix.
May 8, 2020
e978781
Removing deepstate noise.
May 8, 2020
af5eb10
Removing deepstate noise.
May 8, 2020
e3ad554
Adjusting read speed baseline for windows.
May 8, 2020
a7973a4
Added dynamic input to MQCNN decoder.
May 12, 2020
63b2565
Added toggle option for dynamic future feat.
May 12, 2020
18e45bc
Changed default of future dynamic to disabled.
May 12, 2020
c636cd8
Turning user specified arguments into implications.
May 13, 2020
442edf5
Adding documentation for MQCNN parameters, removing non gluonts code.
May 18, 2020
d5699fa
Removing backwards compatibility.
May 18, 2020
29064f0
Merge branch 'master' into mqcnn-rts
lostella May 18, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/gluonts/block/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def hybrid_forward(
pass


# TODO: add support for static variables at some point
class ForkingMLPDecoder(Seq2SeqDecoder):
"""
Multilayer perceptron decoder for sequence-to-sequence models.
Expand All @@ -76,7 +77,7 @@ def __init__(
self,
dec_len: int,
final_dim: int,
hidden_dimension_sequence: List[int] = list([]),
hidden_dimension_sequence: List[int] = [],
**kwargs,
) -> None:
super().__init__(**kwargs)
Expand Down Expand Up @@ -104,6 +105,7 @@ def __init__(
)
self.model.add(layer)

# TODO: add support for static input at some point
def hybrid_forward(
self, F, dynamic_input: Tensor, static_input: Tensor = None
) -> Tensor:
Expand All @@ -115,11 +117,10 @@ def hybrid_forward(
F
A module that can either refer to the Symbol API or the NDArray
API in MXNet.

dynamic_input
dynamic_features, shape (batch_size, sequence_length, num_features)
or (N, T, C).

dynamic_features, shape (batch_size, sequence_length, num_features) or (N, T, C)
where sequence_length is equal to the encoder length, and num_features is equal
to channel_seq[-1] for the MQCNN for example.
static_input
not used in this decoder.

Expand Down
83 changes: 66 additions & 17 deletions src/gluonts/block/enc2dec.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def hybrid_forward(
F,
encoder_output_static: Tensor,
encoder_output_dynamic: Tensor,
future_features: Tensor,
future_features_dynamic: Tensor,
) -> Tuple[Tensor, Tensor, Tensor]:
"""
Parameters
Expand All @@ -48,40 +48,36 @@ def hybrid_forward(
shape (batch_size, num_features) or (N, C)

encoder_output_dynamic
shape (batch_size, context_length, num_features) or (N, T, C)
shape (batch_size, sequence_length, num_features) or (N, T, C)

future_features
shape (batch_size, prediction_length, num_features) or (N, T, C)
future_features_dynamic
shape (batch_size, sequence_length, prediction_length, num_features) or (N, T, P, C`)


Returns
-------
Tensor
shape (batch_size, num_features) or (N, C)

Tensor
shape (batch_size, prediction_length, num_features) or (N, T, C)

Tensor
shape (batch_size, sequence_length, num_features) or (N, T, C)

"""
pass


class PassThroughEnc2Dec(Seq2SeqEnc2Dec):
"""
Simplest class for passing encoder tensors do decoder. Passes through
tensors.
tensors, except that future_features_dynamic is dropped.
"""

def hybrid_forward(
self,
F,
encoder_output_static: Tensor,
encoder_output_dynamic: Tensor,
future_features: Tensor,
) -> Tuple[Tensor, Tensor, Tensor]:
future_features_dynamic: Tensor,
) -> Tuple[Tensor, Tensor]:
"""
Parameters
----------
Expand All @@ -90,10 +86,10 @@ def hybrid_forward(
shape (batch_size, num_features) or (N, C)

encoder_output_dynamic
shape (batch_size, context_length, num_features) or (N, T, C)
shape (batch_size, sequence_length, num_features) or (N, T, C)

future_features
shape (batch_size, prediction_length, num_features) or (N, T, C)
future_features_dynamic
shape (batch_size, sequence_length, prediction_length, num_features) or (N, T, P, C`)


Returns
Expand All @@ -102,10 +98,63 @@ def hybrid_forward(
shape (batch_size, num_features) or (N, C)

Tensor
shape (batch_size, prediction_length, num_features) or (N, T, C)
shape (batch_size, prediction_length, num_features_02) or (N, T, C)
"""
return encoder_output_static, encoder_output_dynamic

Tensor

class FutureFeatIntegratorEnc2Dec(Seq2SeqEnc2Dec):
"""
Integrates the encoder_ouput_dynamic and future_features_dynamic into one
and passes them through as the dynamic input to the decoder.
"""

def hybrid_forward(
self,
F,
encoder_output_static: Tensor,
encoder_output_dynamic: Tensor,
future_features_dynamic: Tensor,
) -> Tuple[Tensor, Tensor]:
"""
Parameters
----------

encoder_output_static
shape (batch_size, num_features) or (N, C)

encoder_output_dynamic
shape (batch_size, sequence_length, num_features) or (N, T, C)

future_features_dynamic
shape (batch_size, sequence_length, prediction_length, num_features) or (N, T, P, C`)


Returns
-------
Tensor
shape (batch_size, num_features) or (N, C)

Tensor
shape (batch_size, prediction_length, num_features_02) or (N, T, C)

Tensor
shape (1,)
"""
return encoder_output_static, encoder_output_dynamic, future_features

# flatten the last two dimensions:
# => (batch_size, encoder_length, decoder_length * num_feature_dynamic)
future_features_dynamic = F.reshape(
future_features_dynamic, shape=(0, 0, -1)
)

# concatenate output of decoder and future_feat_dynamic covariates:
# => (batch_size, encoder_length, num_dec_input_dynamic + num_future_feat_dynamic)
total_dec_input_dynamic = F.concat(
encoder_output_dynamic, future_features_dynamic, dim=2
)

return (
encoder_output_static,
total_dec_input_dynamic,
)
Loading