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

fix: ONNX conversion for Spark OneHotEncoder model #552

Merged
merged 5 commits into from
May 27, 2022
Merged

Conversation

memoryz
Copy link
Contributor

@memoryz memoryz commented May 21, 2022

Fixing issue #551.

@lgtm-com
Copy link

lgtm-com bot commented May 21, 2022

This pull request introduces 1 alert and fixes 1 when merging 0112e2d into f87e306 - view on LGTM.com

new alerts:

  • 1 for Unused import

fixed alerts:

  • 1 for Unused local variable

Signed-off-by: Jason Wang <jasowang@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented May 21, 2022

This pull request fixes 1 alert when merging 446b7a9 into f87e306 - view on LGTM.com

fixed alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented May 21, 2022

This pull request fixes 1 alert when merging bcabd14 into f87e306 - view on LGTM.com

fixed alerts:

  • 1 for Unused local variable

@lgtm-com
Copy link

lgtm-com bot commented May 21, 2022

This pull request fixes 1 alert when merging f40b4ec into f87e306 - view on LGTM.com

fixed alerts:

  • 1 for Unused local variable

memoryz added 3 commits May 21, 2022 02:05
Signed-off-by: Jason Wang <jasowang@microsoft.com>
Signed-off-by: Jason Wang <jasowang@microsoft.com>
… converter

Signed-off-by: Jason Wang <jasowang@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented May 21, 2022

This pull request fixes 1 alert when merging e297f6e into f87e306 - view on LGTM.com

fixed alerts:

  • 1 for Unused local variable

@@ -19,4 +19,4 @@ pytest-spark
scikit-learn
scipy
wheel
xgboost
xgboost==1.5.2
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you need this?

Copy link
Contributor Author

@memoryz memoryz May 25, 2022

Choose a reason for hiding this comment

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

The latest xgboost version breaks some unit tests in the xgboost unit tests, which has nothing to do with my changes, so I'm pinning it to the older version that works.

shape_variable_name = scope.get_unique_variable_name("shape_at_" + str(i))
container.add_initializer(shape_variable_name, onnx_proto.TensorProto.INT64, [2], [N, len(categories[i])])

container.add_node(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why switch to an output per category and not concatenate them into one single output?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is to match the behavior of the Spark OneHotEncoderModel. In Spark, if the OHEModel has multiple outputCols (one per category), the model does not concat the outputs into a vector. Instead you use a vector assembler to concat them, and the vector assembler will be translated into a concat ONNX operator.

Signed-off-by: Jason Wang <jasowang@microsoft.com>
@lgtm-com
Copy link

lgtm-com bot commented May 26, 2022

This pull request fixes 1 alert when merging c27c453 into f87e306 - view on LGTM.com

fixed alerts:

  • 1 for Unused local variable

@memoryz
Copy link
Contributor Author

memoryz commented May 27, 2022

@xadupre can you merge the change?

@xadupre xadupre merged commit 19a0ddf into onnx:main May 27, 2022
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.

2 participants