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 LogScaler transformer #932

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

Add LogScaler transformer #932

wants to merge 8 commits into from

Conversation

rwedge
Copy link
Contributor

@rwedge rwedge commented Jan 16, 2025

Implements #930

CU-86b3gbr2k

@sdv-team
Copy link
Contributor

Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (d6ea5d1) to head (d5bc2ed).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #932   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           18        18           
  Lines         2233      2274   +41     
=========================================
+ Hits          2233      2274   +41     
Flag Coverage Δ
integration 83.06% <90.47%> (+0.13%) ⬆️
unit 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rwedge rwedge force-pushed the issue-930-LogScaler branch from 53d70fe to f1dbfa5 Compare January 17, 2025 16:17
@rwedge rwedge marked this pull request as ready for review January 22, 2025 17:33
@rwedge rwedge requested a review from a team as a code owner January 22, 2025 17:33
@rwedge rwedge requested review from frances-h and fealho and removed request for a team January 22, 2025 17:33
Copy link
Member

@fealho fealho left a comment

Choose a reason for hiding this comment

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

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):
Copy link
Member

Choose a reason for hiding this comment

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

"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."""
Copy link
Member

Choose a reason for hiding this comment

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

Missing "Test" at the start

data = super()._transform(data)

if data.ndim > 1:
self._validate_data(data[:, 0])
Copy link
Member

Choose a reason for hiding this comment

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

I would create a helper function for lines 711-715 like you did for _fit, so we don't repeat the code.

data = data.to_numpy()

if data.ndim > 1:
if self.invert:
Copy link
Member

Choose a reason for hiding this comment

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

Same here.

invert: bool = False,
learn_rounding_scheme: bool = False,
):
self.constant = constant
Copy link
Member

Choose a reason for hiding this comment

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

Could we add validation to the constant/invert args?


class TestLogScaler:
def test_learn_rounding(self):
# Setup
Copy link
Member

Choose a reason for hiding this comment

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

Add short docstrings to these tests.

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