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
BUG: Fix sklearn pipeline visualization can't print OneHotEncoder
#765
Conversation
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## main #765 +/- ##
=======================================
Coverage 99.60% 99.60%
=======================================
Files 111 111
Lines 1525 1526 +1
Branches 346 346
=======================================
+ Hits 1519 1520 +1
Misses 1 1
Partials 5 5
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
for more information, see https://pre-commit.ci
5e483af
to
b30da75
Compare
…ata-toolkit into bug/onehotencoder
This reverts commit 1515926.
This reverts commit 2e07ca3.
This reverts commit 84fa35f.
@@ -106,6 +106,9 @@ def __init__( | |||
) | |||
self.categories_with_parent = categories_with_parent | |||
|
|||
if not SKLEARN_GE_12: | |||
self.sparse_output = sparse_output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There don't have spare_output
in the lower sklearn version.
So there need to manually add into class attributes.
@@ -343,7 +344,7 @@ | |||
"metadata": {}, | |||
"outputs": [], | |||
"source": [ | |||
"df_x.replace({\"normal\": 1, \"important\": 2, \"strategic\": 3}, inplace=True)\n", | |||
"df_x = df_x.replace({\"normal\": 1, \"important\": 2, \"strategic\": 3})\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid SettingWithCopyWarning
/tmp/ipykernel_3108/3317886993.py:1: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
df_x.replace({"normal": 1, "important": 2, "strategic": 3}, inplace=True)
sparse_output
forOneHotEncoder
to compat with sklearn1.2 #726stack trace