Conversation
|
Task linked: CU-86b3gbr2k RDT - Add |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #932 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 18 18
Lines 2233 2277 +44
=========================================
+ Hits 2233 2277 +44
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
53d70fe to
f1dbfa5
Compare
fealho
left a comment
There was a problem hiding this comment.
Look great! I only left some minor comments.
| value was missing. Then use it to recreate missing values. | ||
| * ``None``: Do nothing with the missing values on the reverse transform. Simply | ||
| pass whatever data we get through. | ||
| constant (float): |
There was a problem hiding this comment.
"Default to 0" -> "Defaults to 0".
Also, either add the `` quotation marks around the 0, False, True values here, or remove them from the other values in the docstring, so it's conistent.
|
|
||
| class TestLogScaler: | ||
| def test___init__super_attrs(self): | ||
| """super() arguments are properly passed and set as attributes.""" |
rdt/transformers/numerical.py
Outdated
| data = super()._transform(data) | ||
|
|
||
| if data.ndim > 1: | ||
| self._validate_data(data[:, 0]) |
There was a problem hiding this comment.
I would create a helper function for lines 711-715 like you did for _fit, so we don't repeat the code.
rdt/transformers/numerical.py
Outdated
| data = data.to_numpy() | ||
|
|
||
| if data.ndim > 1: | ||
| if self.invert: |
rdt/transformers/numerical.py
Outdated
| invert: bool = False, | ||
| learn_rounding_scheme: bool = False, | ||
| ): | ||
| self.constant = constant |
There was a problem hiding this comment.
Could we add validation to the constant/invert args?
|
|
||
| class TestLogScaler: | ||
| def test_learn_rounding(self): | ||
| # Setup |
There was a problem hiding this comment.
Add short docstrings to these tests.
| # Run | ||
| transformer.fit(data, 'test') | ||
| transformed = transformer.transform(data) | ||
| reversed = transformer.reverse_transform(transformed) |
There was a problem hiding this comment.
Can we update this to reversed_values or something similar since reversed is a Python keyword?
fealho
left a comment
There was a problem hiding this comment.
Left a couple of comments, outside of those it looks good to me.
rdt/transformers/numerical.py
Outdated
| ): | ||
| self.constant = constant | ||
| self.invert = invert | ||
| if isinstance(constant, float): |
There was a problem hiding this comment.
Integers should probably be fine as well right?
| else: | ||
| self._validate_data(data) | ||
|
|
||
| def _log_transform(self, data): |
There was a problem hiding this comment.
You can move self._validate_data here as well, no?
|
Closing in favor of #935 |
Implements #930
CU-86b3gbr2k