[Experimental] Add FilterComponent for row-level example filtering#7868
Merged
Merged
Conversation
Contributor
|
Wow! Thank you for implementing this! Reviewed the code/approach and it is exactly what I imagined for the tf.train.Example case. Do you think this component would also work with tf.train.SequenceExample also? What I mean is that the filter criteria is still a non-sequence type, but the record itself can have sequences. For example, imagine a data quality threshold of some sort. Another scenario which I remember implementing in a likely hacky way was polygon based filtering, where you want to crop data using regions in space. Classic example would be filter data from the "ocean" in the taxicab dataset. In any case, super happy to see this get merged! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces an experimental
FilterComponentto TFX, addressing a long-standing feature request (Issue #6909) for row-level example filtering within pipelines.Currently, TFX has no built-in component to filter anomalous or unwanted examples after ingestion. The
Transformcomponent (TFT) is strictly map-only and does not support dropping rows. As a result, users have had to write custom Apache Beam code or perform out-of-band pre-processing. The newFilterComponentprovides a clean, native, and reusable way to filter datasets split-by-split using a user-defined Python function.Proposed Changes
component.py):FilterSpecandFilterComponent.Exampleschannel and a string import path to a Python filter function (filter_fn_path).filtered_examplesExampleschannel.executor.py):Examplesartifact (e.g.,train,eval).beam.Filter.component_test.py: Verifies component instantiation and spec parsing.executor_test.py: Runs a full integration test with simulatedtrainandevalsplits, executing the Beam filter pipeline and verifying correct output records.Usage Example