Skip to content

Implement MLTransform One-Hot Encoding benchmark pipeline#38404

Merged
damccorm merged 3 commits into
apache:masterfrom
aIbrahiim:mltransform-onehot-benchmark
May 29, 2026
Merged

Implement MLTransform One-Hot Encoding benchmark pipeline#38404
damccorm merged 3 commits into
apache:masterfrom
aIbrahiim:mltransform-onehot-benchmark

Conversation

@aIbrahiim
Copy link
Copy Markdown
Contributor

Please add a meaningful description for your change here


Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new benchmark pipeline for categorical feature encoding using Apache Beam's MLTransform. The changes include the pipeline implementation, supporting test suites, and the necessary infrastructure to integrate performance tracking and cost estimation into the Beam website's performance dashboard.

Highlights

  • New MLTransform Pipeline: Implemented a categorical encoding pipeline using MLTransform's ComputeAndApplyVocabulary transform to convert categorical features into integer indices.
  • Testing and Benchmarking: Added comprehensive unit and integration tests, along with a new Dataflow benchmark to track throughput, latency, and cost metrics.
  • Documentation and Metrics: Updated the project website to include a new performance dashboard page and configured Looker metrics for the new benchmark.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: .github/workflows/** (2)
    • .github/workflows/beam_Inference_Python_Benchmarks_Dataflow.yml
    • .github/workflows/load-tests-pipeline-options/beam_Inference_Python_Benchmarks_Dataflow_MLTransform_One_Hot_Encoding_Batch.txt
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new example and benchmark for MLTransform One-Hot Encoding in the Python SDK, including performance tracking and documentation updates. Review feedback points out several issues: unit tests for a non-existent function that cause failures, the need for a filter to handle missing columns and prevent pipeline crashes, and opportunities to optimize synthetic data generation and improve logging for text-based inputs.

Comment thread sdks/python/apache_beam/examples/ml_transform/mltransform_one_hot_encoding.py Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 7, 2026

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Assigning reviewers:

R: @jrmccluskey for label python.
R: @damccorm for label build.
R: @Abacn for label website.

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

@github-actions
Copy link
Copy Markdown
Contributor

Reminder, please take a look at this pr: @jrmccluskey @damccorm @Abacn

@damccorm
Copy link
Copy Markdown
Contributor

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new example pipeline, mltransform_one_hot_encoding.py, which demonstrates categorical feature encoding using Apache Beam's MLTransform and ComputeAndApplyVocabulary. The PR also includes comprehensive unit tests, a performance benchmark for Dataflow, and updates to the performance documentation and metrics tracking. Review feedback identifies a critical issue where local temporary directories are used for artifacts, which would fail on distributed runners like Dataflow. Additionally, improvements were suggested regarding the serialization of lambdas and the removal of fixed sharding templates to prevent performance bottlenecks during output writing.

Comment thread sdks/python/apache_beam/examples/ml_transform/mltransform_one_hot_encoding.py Outdated
Copy link
Copy Markdown
Contributor

@damccorm damccorm left a comment

Choose a reason for hiding this comment

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

Thanks - just one comment from gemini that I think we should follow up on.

Comment thread sdks/python/apache_beam/examples/ml_transform/mltransform_one_hot_encoding.py Outdated
@github-actions
Copy link
Copy Markdown
Contributor

Assigning new set of reviewers because Pr has gone too long without review. If you would like to opt out of this review, comment assign to next reviewer:

R: @tvalentyn for label python.
R: @liferoad for label build.
R: @shunping for label website.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

@aIbrahiim aIbrahiim force-pushed the mltransform-onehot-benchmark branch from 57370b2 to 84e41f4 Compare May 27, 2026 13:40
@aIbrahiim aIbrahiim requested a review from damccorm May 29, 2026 13:15
@damccorm
Copy link
Copy Markdown
Contributor

damccorm commented May 29, 2026

FYI, this is another review where rebasing makes it much harder to review the PR. It would go faster if you did not rebase because then I could just use GitHub's changes since last review feature to see if the one change I requested was made (and nothing else).

As is, I need to start the review from scratch (which is why I haven't had time for it yet)

@damccorm
Copy link
Copy Markdown
Contributor

/gemini review

@aIbrahiim
Copy link
Copy Markdown
Contributor Author

FYI, this is another review where rebasing makes it much harder to review the PR. It would go faster if you did not rebase because then I could just use GitHub's changes since last review feature to see if the one change I requested was made (and nothing else).

As is, I need to start the review from scratch (which is why I haven't had time for it yet)

Ahh so sorry I wasn't intentionally rebased but just there was conflicts and i had to resolve them through github and i think it caused the rebase

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new categorical encoding pipeline example (mltransform_one_hot_encoding.py) using Apache Beam's MLTransform and ComputeAndApplyVocabulary, along with its corresponding tests, a performance benchmark, and documentation. Feedback on the changes includes: (1) addressing a potential failure on distributed runners when using a local temporary directory for artifacts by falling back to GCP's temp_location, (2) correcting non-existent Dataflow metric types in the benchmark to use PCollection-level metrics, (3) avoiding lambda functions inside beam.Map to prevent serialization issues, and (4) adding a missing title field in the performance YAML configuration.

Comment thread website/www/site/data/performance.yaml
Copy link
Copy Markdown
Contributor

@damccorm damccorm left a comment

Choose a reason for hiding this comment

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

Thanks

@damccorm
Copy link
Copy Markdown
Contributor

Ahh so sorry I wasn't intentionally rebased but just there was conflicts and i had to resolve them through github and i think it caused the rebase

You should be able to use a merge strategy instead of rebasing to avoid this

Copy link
Copy Markdown
Contributor

@damccorm damccorm left a comment

Choose a reason for hiding this comment

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

Thanks

@damccorm
Copy link
Copy Markdown
Contributor

I'll merge after test suites run

@aIbrahiim
Copy link
Copy Markdown
Contributor Author

Ahh so sorry I wasn't intentionally rebased but just there was conflicts and i had to resolve them through github and i think it caused the rebase

You should be able to use a merge strategy instead of rebasing to avoid this

Thanks and I will use a merge strategy instead next time

@damccorm damccorm merged commit 6fba3cb into apache:master May 29, 2026
102 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants