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

Remove handling_strategy parameter #843

Merged
merged 13 commits into from
Jun 28, 2022

Conversation

amontanez24
Copy link
Contributor

@amontanez24 amontanez24 commented Jun 14, 2022

resolves #833

@codecov-commenter
Copy link

codecov-commenter commented Jun 14, 2022

Codecov Report

Merging #843 (1ff251b) into master (0144739) will increase coverage by 1.93%.
The diff coverage is 98.30%.

@@            Coverage Diff             @@
##           master     #843      +/-   ##
==========================================
+ Coverage   67.69%   69.62%   +1.93%     
==========================================
  Files          38       38              
  Lines        2857     3009     +152     
==========================================
+ Hits         1934     2095     +161     
+ Misses        923      914       -9     
Impacted Files Coverage Δ
sdv/constraints/base.py 97.56% <94.73%> (+1.58%) ⬆️
sdv/constraints/errors.py 100.00% <100.00%> (ø)
sdv/constraints/tabular.py 99.63% <100.00%> (-0.10%) ⬇️
sdv/metadata/table.py 76.56% <100.00%> (+1.09%) ⬆️
sdv/metadata/utils.py 94.87% <100.00%> (ø)
sdv/tabular/base.py 81.49% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0144739...1ff251b. Read the comment docs.

@amontanez24 amontanez24 changed the base branch from master to issue-834-remove-fit_columns_model-parameter June 14, 2022 16:11
Base automatically changed from issue-834-remove-fit_columns_model-parameter to master June 17, 2022 14:56
@amontanez24 amontanez24 force-pushed the issue-833-remove-handling-strategy branch from 4adf5ab to 746e8c0 Compare June 17, 2022 18:50
@amontanez24 amontanez24 marked this pull request as ready for review June 17, 2022 20:53
@amontanez24 amontanez24 requested a review from a team as a code owner June 17, 2022 20:53
@amontanez24 amontanez24 requested review from katxiao and removed request for a team June 17, 2022 20:53
@amontanez24 amontanez24 force-pushed the issue-833-remove-handling-strategy branch from 4c6f834 to 6539c67 Compare June 22, 2022 15:22
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ amontanez24
❌ Andrew Montanez


Andrew Montanez seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@amontanez24 amontanez24 requested review from fealho and pvk-developer and removed request for katxiao June 22, 2022 16:52
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.

👍 just left some minor comments.

self.reverse_transform(transformed)
return transformed

except Exception:
Copy link
Member

Choose a reason for hiding this comment

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

Can you use the specific errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we want to catch all possible exceptions here

try:
transformed = self._transform(table_data)
if self.is_custom:
self.reverse_transform(transformed)
Copy link
Member

Choose a reason for hiding this comment

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

Why is this needed for custom transform?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

custom constraints can have a noop transform but a reverse_transform that requires specific columns, so the transform won't raise any errors but the reverse_transform will.

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.

Looks good, 2 details.

@@ -182,22 +178,8 @@ def transform(self, table_data):
pandas.DataFrame:
Input data unmodified.
"""
self._use_reject_sampling = False
self._validate_all_columns_present(table_data)
Copy link
Member

Choose a reason for hiding this comment

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

I think we can just copy paste the function logic here, instead of creating it separetely. The docstrings already describe that method either way, and it doesn't really have any test cases.

def _warn_of_missing_columns(constraint, error):
warnings.warn(
f'{constraint.__class__.__name__} cannot be transformed because columns: '
f'{error.missing_columns} are not found. Using the reject sampling approach '
Copy link
Member

Choose a reason for hiding this comment

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

were instead of `are, no?

def check_missing_columns(self, table_data):
"""Check ``table_data`` for missing columns.
def _fit(self, table_data):
del table_data
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering if we need this. Couldn't we just use pass or I'm missing something ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we could, this is just from before

Copy link
Member

@pvk-developer pvk-developer left a comment

Choose a reason for hiding this comment

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

LGTM! I left a minor change to the sre_parse I believe it was fine before:

[SDV] ***@lgn:~/Projects/SDV$ isort -df sdv/metadata/utils.py 
--- /home/***/Projects/SDV/sdv/metadata/utils.py:before	2022-06-28 14:17:23.330414
+++ /home/***/Projects/SDV/sdv/metadata/utils.py:after	2022-06-28 14:17:24.234020
@@ -1,11 +1,10 @@
 """Tools to generate strings from regular expressions."""
 
 import re
+import sre_parse
 import string
 
 import numpy as np
-
-import sre_parse
 
 

@@ -1,11 +1,12 @@
"""Tools to generate strings from regular expressions."""

import re
import sre_parse
Copy link
Member

@pvk-developer pvk-developer Jun 28, 2022

Choose a reason for hiding this comment

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

Why is this failing ? sre_parse it's from python's library, I don't think we have to remove it from here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It fails on windows and mac

@fealho fealho self-requested a review June 28, 2022 18:47
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.

Still looks good 👍

@amontanez24 amontanez24 merged commit 6939278 into master Jun 28, 2022
@amontanez24 amontanez24 deleted the issue-833-remove-handling-strategy branch June 28, 2022 19:02
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.

Remove handling_strategy parameter
5 participants