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

Codegen support for bool #1524

Merged
merged 7 commits into from
Dec 8, 2020
Merged

Codegen support for bool #1524

merged 7 commits into from
Dec 8, 2020

Conversation

bchen1116
Copy link
Contributor

@bchen1116 bchen1116 commented Dec 8, 2020

fix #1495

Add support for pythonic types that JSON doesn't normally support, like boolean and None values.

I didn't add in support/tests for Python objects (like Datetime) or tuples (which get converted to lists by json.dumps and remains a list after json.loads) since these seem to be edge cases and are unlikely to be params in pipelines/pipeline hyperparameters. Certainly down to discuss this if it is otherwise important to have support for these/other cases!

@bchen1116 bchen1116 self-assigned this Dec 8, 2020
@codecov
Copy link

codecov bot commented Dec 8, 2020

Codecov Report

Merging #1524 (70302fc) into main (cc2e0ae) will increase coverage by 0.1%.
The diff coverage is 100.0%.

Impacted file tree graph

@@            Coverage Diff            @@
##             main    #1524     +/-   ##
=========================================
+ Coverage   100.0%   100.0%   +0.1%     
=========================================
  Files         228      228             
  Lines       15629    15658     +29     
=========================================
+ Hits        15621    15650     +29     
  Misses          8        8             
Impacted Files Coverage Δ
evalml/pipelines/utils.py 100.0% <100.0%> (ø)
evalml/tests/pipeline_tests/test_pipelines.py 100.0% <100.0%> (ø)

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 cc2e0ae...70302fc. Read the comment docs.

Copy link
Contributor

@freddyaboulton freddyaboulton left a comment

Choose a reason for hiding this comment

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

@bchen1116 I think this is great! Thanks for making the fix. I left a couple of non-blocking comments about testing and handling non-json-serializable types.

evalml/pipelines/utils.py Show resolved Hide resolved
evalml/pipelines/utils.py Show resolved Hide resolved
Copy link
Collaborator

@jeremyliweishih jeremyliweishih 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 !

@bchen1116 bchen1116 merged commit d6c3f8e into main Dec 8, 2020
try:
json.dumps(v)
except TypeError:
raise TypeError(f"Value {v} of type {type(v)} cannot be JSON-serialized")
Copy link
Contributor

Choose a reason for hiding this comment

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

@bchen1116 for what types does this error occur? Should we add test coverage of those cases?

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 errors out for lots of python-specific types. I can add more coverage of that in the tests

@dsherry dsherry mentioned this pull request Dec 29, 2020
@freddyaboulton freddyaboulton deleted the bc_1495_codegen branch May 13, 2022 15:17
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.

Code generation can't handle booleans in the parameters dict
4 participants