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 label encoder component to EvalML #2853

Merged
merged 16 commits into from
Sep 30, 2021
Merged

Add label encoder component to EvalML #2853

merged 16 commits into from
Sep 30, 2021

Conversation

angela97lin
Copy link
Contributor

Closes #2852

@angela97lin angela97lin self-assigned this Sep 28, 2021
@codecov
Copy link

codecov bot commented Sep 28, 2021

Codecov Report

Merging #2853 (47c3889) into main (d0a051f) will increase coverage by 0.1%.
The diff coverage is 97.1%.

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #2853     +/-   ##
=======================================
+ Coverage   99.8%   99.8%   +0.1%     
=======================================
  Files        303     305      +2     
  Lines      28226   28353    +127     
=======================================
+ Hits       28145   28272    +127     
  Misses        81      81             
Impacted Files Coverage Δ
evalml/pipelines/components/__init__.py 100.0% <ø> (ø)
evalml/tests/component_tests/test_utils.py 95.3% <33.4%> (ø)
...alml/pipelines/components/transformers/__init__.py 100.0% <100.0%> (ø)
...lines/components/transformers/encoders/__init__.py 100.0% <100.0%> (ø)
.../components/transformers/encoders/label_encoder.py 100.0% <100.0%> (ø)
evalml/tests/component_tests/test_components.py 99.3% <100.0%> (+0.1%) ⬆️
evalml/tests/component_tests/test_label_encoder.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 d0a051f...47c3889. 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.

Looks good to me @angela97lin !

y_ww = infer_feature_types(y)
y_t = self._component_obj.transform(y_ww)
y_t = pd.Series(y_t, index=y_ww.index)
return X, ww.init_series(y_t)
Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense to use init_series. This transformation would almost always change the schema.

Copy link
Contributor

@eccabay eccabay left a comment

Choose a reason for hiding this comment

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

Nice, LGTM!

y_t = pd.Series(y_t, index=y_ww.index)
return X, ww.init_series(y_t)

def fit_transform(self, X, y):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason we don't just use the parent Transformer's implementation for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think nope, except we want a different docstring 😅 (which was incorrect, updating!)

@angela97lin angela97lin merged commit 7353fa6 into main Sep 30, 2021
@angela97lin angela97lin deleted the 2852_label_encoder branch September 30, 2021 17:13
@chukarsten chukarsten mentioned this pull request Oct 1, 2021
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.

Add label encoder component to EvalML
3 participants