Skip to content

Nullable Types: Make Pipeline (Reloaded) - #3129

Merged
chukarsten merged 10 commits into
mainfrom
nt_make_pipeline_rebased
Dec 9, 2021
Merged

chukarsten merged 10 commits into
mainfrom
nt_make_pipeline_rebased

Conversation

@chukarsten

@chukarsten chukarsten commented Dec 7, 2021 •

Copy link
Copy Markdown
Contributor

Addresses: #3124

This PR should update make_pipeline() such that it now appropriately addresses the presence of AgeNullable, BooleanNullable, and IntegerNullable dtypes in Woodwork dataframes and adds them into the preprocessing pipelines of these. Added a new integration test file with the intent of adding more integration testing in addition to what's in here.

@codecov

codecov Bot commented Dec 7, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #3129 (b157a3d) into main (389d4f6) will increase coverage by 0.1%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #3129     +/-   ##
=======================================
+ Coverage   99.7%   99.7%   +0.1%     
=======================================
  Files        317     318      +1     
  Lines      30711   30756     +45     
=======================================
+ Hits       30607   30652     +45     
  Misses       104     104             
Impacted Files Coverage Δ
...valml/automl/automl_algorithm/default_algorithm.py 100.0% <100.0%> (ø)
...lml/automl/automl_algorithm/iterative_algorithm.py 100.0% <100.0%> (ø)
evalml/automl/automl_search.py 99.9% <100.0%> (ø)
evalml/pipelines/utils.py 99.7% <100.0%> (+0.1%) ⬆️
evalml/tests/conftest.py 96.2% <100.0%> (+0.2%) ⬆️
...lml/tests/integration_tests/test_nullable_types.py 100.0% <100.0%> (ø)
evalml/tests/pipeline_tests/test_pipeline_utils.py 99.7% <100.0%> (-<0.1%) ⬇️

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 389d4f6...b157a3d. Read the comment docs.

Comment thread evalml/pipelines/utils.py Resolved
@gsheni
gsheni removed their request for review December 8, 2021 16:13

@tamargrey tamargrey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks good to me from a Woodwork perspective

Comment thread evalml/tests/conftest.py Outdated
if "int_null" in column_names:
logical_types.update({"int_null": "integer_nullable"})
if "age_null" in column_names:
logical_types.update({"age_null": "integer_nullable"})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be "age_nullable"?

Comment thread evalml/tests/conftest.py
Comment on lines +102 to +110
"int_null": [0, 1, 2, np.nan, 4, np.nan, 6] * 2,
"age_null": [0, 1, 2, np.nan, 4, np.nan, 6] * 2,
"bool_null": [True, None, False, True, False, None, True] * 2,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think these will have dtypes of either float64 for the integer columns or object for the boolean column when you create this dataframe.

Do you also need to make sure to handle the case where these columns might have the Int64 or boolean dtype, particularly when testing with the pandas version of the input?

"int_null": pd.Series([0, 1, 2, np.nan, 4, np.nan, 6] * 2, dtype="Int64"),
"age_null": pd.Series([0, 1, 2, np.nan, 4, np.nan, 6] * 2, dtype="Int64"),
"bool_null": pd.Series([True, None, False, True, False, None, True] * 2, dtype="boolean"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it'll be worthwhile to eventually add coverage for pandas dataframes with nullable types that don't have ww initialized (which I think is what this change will give us) but I'm satisfied with the coverage we have now because it covers the most frequent cases we'll run into regarding nullable types I think. Most of our users with nullable types already initialized woodwork on their dataframe.

@chukarsten
chukarsten force-pushed the nt_make_pipeline_rebased branch from 60c66d1 to 678c415 Compare December 9, 2021 18:09

@freddyaboulton freddyaboulton left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for this @chukarsten ! Looks good to me. I think the integration test you have in place is easy to extend as we progress through the epic, which is neat.

Comment thread evalml/tests/conftest.py
Comment on lines +102 to +110
"int_null": [0, 1, 2, np.nan, 4, np.nan, 6] * 2,
"age_null": [0, 1, 2, np.nan, 4, np.nan, 6] * 2,
"bool_null": [True, None, False, True, False, None, True] * 2,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think it'll be worthwhile to eventually add coverage for pandas dataframes with nullable types that don't have ww initialized (which I think is what this change will give us) but I'm satisfied with the coverage we have now because it covers the most frequent cases we'll run into regarding nullable types I think. Most of our users with nullable types already initialized woodwork on their dataframe.

sampler_name=self.sampler_name,
extra_components=feature_selector,
extra_components_position="after_preprocessing",
parameters=self._pipeline_params,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was this a previous bug?

@jeremyliweishih jeremyliweishih Dec 9, 2021 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@freddyaboulton the pipeline parameters should have been passed in through line 201 where it's added in _transform_parameters().

@chukarsten did you notice that the pipeline parameters were not passing in? This should behave the same way as the first batch in IterativeAlgorithm where:

if self._batch_number == 0:
            next_batch = [
                pipeline.new(
                    parameters=self._transform_parameters(pipeline, {}),
                    random_seed=self.random_seed,
                )
                for pipeline in self.allowed_pipelines
            ]

@chukarsten
chukarsten merged commit e31c88f into main Dec 9, 2021
@freddyaboulton
freddyaboulton deleted the nt_make_pipeline_rebased branch May 13, 2022 15:23
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.

5 participants