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

Add pow operation to synthetic data generation #571

Merged
merged 3 commits into from
Jan 29, 2020

Conversation

lostella
Copy link
Contributor

@lostella lostella commented Jan 29, 2020

This adds the pow operation to the synthetic data generation package. This is useful e.g. to generate uniformly log-scaled data.

Also, some minor code cleanup.

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

Comment on lines -168 to +177
return LiftedMul(self, other, operator.mul)
return LiftedMul(self, other)

def __rmul__(self, other):
return LiftedMul(other, self, operator.mul)
return LiftedMul(other, self)

def __truediv__(self, other):
return LiftedTruediv(self, other, operator.truediv)
return LiftedTruediv(self, other)

def __rtruediv__(self, other):
return LiftedTruediv(other, self, operator.truediv)
return LiftedTruediv(other, self)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As far as I understand, the third argument provided here is hardcoded in the specific LiftedBinaryOp subclass. Apparently calling the constructor with three arguments would directly invoke the parents' constructor? Not sure...

Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch, i would guess any of these calls would just fail.

@alexw91
Copy link
Member

alexw91 commented Jan 29, 2020

Codecov Report

Merging #571 into master will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #571      +/-   ##
==========================================
- Coverage   83.25%   83.25%   -0.01%     
==========================================
  Files         178      178              
  Lines        9957     9959       +2     
==========================================
+ Hits         8290     8291       +1     
- Misses       1667     1668       +1     

@codecov-io
Copy link

codecov-io commented Jan 29, 2020

Codecov Report

Merging #571 into master will increase coverage by 0.28%.
The diff coverage is 91.34%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #571      +/-   ##
==========================================
+ Coverage   83.25%   83.53%   +0.28%     
==========================================
  Files         178      182       +4     
  Lines        9959    10317     +358     
==========================================
+ Hits         8291     8618     +327     
- Misses       1668     1699      +31
Impacted Files Coverage Δ
src/gluonts/transform/split.py 98.24% <ø> (ø) ⬆️
src/gluonts/model/n_beats/_estimator.py 100% <100%> (ø)
src/gluonts/model/n_beats/__init__.py 83.33% <83.33%> (ø)
src/gluonts/model/n_beats/_ensemble.py 89.55% <89.55%> (ø)
src/gluonts/model/n_beats/_network.py 90.9% <90.9%> (ø)

Comment on lines -168 to +177
return LiftedMul(self, other, operator.mul)
return LiftedMul(self, other)

def __rmul__(self, other):
return LiftedMul(other, self, operator.mul)
return LiftedMul(other, self)

def __truediv__(self, other):
return LiftedTruediv(self, other, operator.truediv)
return LiftedTruediv(self, other)

def __rtruediv__(self, other):
return LiftedTruediv(other, self, operator.truediv)
return LiftedTruediv(other, self)
Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch, i would guess any of these calls would just fail.

@lostella lostella merged commit 2f10256 into awslabs:master Jan 29, 2020
@lostella lostella deleted the fix-synthetic-data-pow branch January 29, 2020 16:14
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.

4 participants