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 instance splitter issue with short time series #533

Merged
merged 4 commits into from
Dec 17, 2019

Conversation

lostella
Copy link
Contributor

@lostella lostella commented Dec 17, 2019

Description of changes: Some checks are added in the InstanceSplitter class for the case where pick_incomplete=False. This would otherwise cause problems downstream, when the sampler would to sample from an interval that has inverted bounds.

Further checks and typing cleanup are added.

Opening for feedback, trying to include a small test for this.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@lostella lostella changed the title fix instance splitter issue with short time series Fix instance splitter issue with short time series Dec 17, 2019
@lostella lostella requested a review from jaheba December 17, 2019 14:14
@lostella
Copy link
Contributor Author

Polished the code, updated the tests, added test cases with pick_incomplete=True (I verified that these raise the issue on master)

Comment on lines +224 to +230
assert len(out) == max(
0,
len(target)
- pred_length
+ 1
- (0 if pick_incomplete else train_length),
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sometimes I really don't understand black

@codecov-io
Copy link

codecov-io commented Dec 17, 2019

Codecov Report

Merging #533 into master will increase coverage by 39.83%.
The diff coverage is 87.5%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #533       +/-   ##
===========================================
+ Coverage   43.29%   83.13%   +39.83%     
===========================================
  Files         177      177               
  Lines        9857     9857               
===========================================
+ Hits         4268     8195     +3927     
+ Misses       5589     1662     -3927
Impacted Files Coverage Δ
src/gluonts/transform/sampler.py 91.8% <100%> (+48.46%) ⬆️
src/gluonts/transform/split.py 97.64% <85.71%> (+80.68%) ⬆️
src/gluonts/dataset/artificial/_base.py 35.96% <0%> (+0.87%) ⬆️
src/gluonts/core/exception.py 62.5% <0%> (+2.08%) ⬆️
src/gluonts/model/trivial/constant.py 76.92% <0%> (+11.53%) ⬆️
src/gluonts/dataset/artificial/recipe.py 74% <0%> (+12.75%) ⬆️
src/gluonts/kernels/_kernel_output.py 87.09% <0%> (+12.9%) ⬆️
src/gluonts/model/seasonal_naive/_estimator.py 100% <0%> (+14.28%) ⬆️
src/gluonts/model/npts/_estimator.py 100% <0%> (+14.28%) ⬆️
src/gluonts/model/forecast.py 72.12% <0%> (+14.6%) ⬆️
... and 104 more

src/gluonts/transform/split.py Outdated Show resolved Hide resolved
test/test_transform.py Outdated Show resolved Hide resolved
@lostella lostella merged commit a9cde7b into awslabs:master Dec 17, 2019
@lostella lostella deleted the fix-splitter branch December 17, 2019 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants