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

Fix docstrings, enable distr_output in MQRNN #1021

Merged
merged 3 commits into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 4 additions & 2 deletions src/gluonts/model/seq2seq/_forking_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ class ForkingSeq2SeqNetworkBase(gluon.HybridBlock):
encoder to decoder mapping block.
decoder: Seq2SeqDecoder
decoder block.
output
An instance of DistributionOutput or QuantileOutput to use
quantile_output
quantile output
distr_output
distribution output
context_length: int,
length of the encoding sequence.
cardinality: List[int],
Expand Down
14 changes: 10 additions & 4 deletions src/gluonts/model/seq2seq/_mq_dnn_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ class MQCNNEstimator(ForkingSeq2SeqEstimator):
Optimizing for more quantiles than are of direct interest to you can result
in improved performance due to a regularizing effect.
(default: [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
distr_output
DistributionOutput to use. Only one between `quantile` and `distr_output`
can be set. (Default: None)
trainer
The GluonTS trainer to use for training. (default: Trainer())
scaling
Expand Down Expand Up @@ -175,7 +178,6 @@ def __init__(
if (quantiles is not None) or (distr_output is not None)
else [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
)
self.distr_output = distr_output

assert (
len(self.channels_seq)
Expand Down Expand Up @@ -308,7 +310,8 @@ def __init__(
context_length: Optional[int] = None,
decoder_mlp_dim_seq: List[int] = None,
trainer: Trainer = Trainer(),
quantiles: List[float] = None,
quantiles: Optional[List[float]] = None,
distr_output: Optional[DistributionOutput] = None,
scaling: bool = False,
scaling_decoder_dynamic_feature: bool = False,
) -> None:
Expand All @@ -328,7 +331,7 @@ def __init__(
)
self.quantiles = (
quantiles
if quantiles is not None
if (quantiles is not None) or (distr_output is not None)
else [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
)

Expand All @@ -351,12 +354,15 @@ def __init__(
prefix="decoder_",
)

quantile_output = QuantileOutput(self.quantiles)
quantile_output = (
QuantileOutput(self.quantiles) if self.quantiles else None
)

super().__init__(
encoder=encoder,
decoder=decoder,
quantile_output=quantile_output,
distr_output=distr_output,
freq=freq,
prediction_length=prediction_length,
context_length=context_length,
Expand Down
2 changes: 1 addition & 1 deletion test/model/seq2seq/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_accuracy(
)

accuracy_test(
Estimator, hyperparameters, accuracy=0.20 if quantiles else 0.40
Estimator, hyperparameters, accuracy=0.20 if quantiles else 0.50
)


Expand Down