tfdv.DetectFeatureSkew
Stay organized with collections Save and categorize content based on your preferences.
API for detecting feature skew between training and serving examples.
tfdv.DetectFeatureSkew( identifier_features: List[types.FeatureName], features_to_ignore: Optional[List[types.FeatureName]] = None, sample_size: int = 0, float_round_ndigits: Optional[int] = None, allow_duplicate_identifiers: bool = False ) -> None
Example:
with beam.Pipeline(runner=...) as p: training_examples = p | 'ReadTrainingData' >> beam.io.ReadFromTFRecord( training_filepaths, coder=beam.coders.ProtoCoder(tf.train.Example)) serving_examples = p | 'ReadServingData' >> beam.io.ReadFromTFRecord( serving_filepaths, coder=beam.coders.ProtoCoder(tf.train.Example)) _ = ((training_examples, serving_examples) | 'DetectFeatureSkew' >> DetectFeatureSkew(identifier_features=['id1'], sample_size=5) | 'WriteFeatureSkewResultsOutput' >> tfdv.WriteFeatureSkewResultsToTFRecord(output_path) | 'WriteFeatureSkwePairsOutput' >> tfdv.WriteFeatureSkewPairsToTFRecord(output_path))
See the documentation for DetectFeatureSkewImpl for more detail about feature skew detection.
Args |
identifier_features | Names of features to use as identifiers. |
features_to_ignore | Names of features for which no feature skew detection is done. |
sample_size | Size of the sample of training-serving example pairs that exhibit skew to include in the skew results. |
float_round_ndigits | Number of digits precision after the decimal point to which to round float values before comparing them. |
allow_duplicate_identifiers | If set, skew detection will be done on examples for which there are duplicate identifier feature values. In this case, the counts in the FeatureSkew result are based on each training-serving example pair analyzed. Examples with given identifier feature values must all fit in memory. |
Class Variables |
pipeline | None |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-18 UTC."],[],[],null,["# tfdv.DetectFeatureSkew\n\n\u003cbr /\u003e\n\n|------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/data-validation/blob/v1.16.1/tensorflow_data_validation/api/validation_api.py#L752-L817) |\n\nAPI for detecting feature skew between training and serving examples. \n\n tfdv.DetectFeatureSkew(\n identifier_features: List[types.FeatureName],\n features_to_ignore: Optional[List[types.FeatureName]] = None,\n sample_size: int = 0,\n float_round_ndigits: Optional[int] = None,\n allow_duplicate_identifiers: bool = False\n ) -\u003e None\n\n#### Example:\n\n with beam.Pipeline(runner=...) as p:\n training_examples = p | 'ReadTrainingData' \u003e\u003e\n beam.io.ReadFromTFRecord(\n training_filepaths, coder=beam.coders.ProtoCoder(tf.train.Example))\n serving_examples = p | 'ReadServingData' \u003e\u003e\n beam.io.ReadFromTFRecord(\n serving_filepaths, coder=beam.coders.ProtoCoder(tf.train.Example))\n _ = ((training_examples, serving_examples) | 'DetectFeatureSkew' \u003e\u003e\n DetectFeatureSkew(identifier_features=['id1'], sample_size=5)\n | 'WriteFeatureSkewResultsOutput' \u003e\u003e\n tfdv.WriteFeatureSkewResultsToTFRecord(output_path)\n | 'WriteFeatureSkwePairsOutput' \u003e\u003e\n tfdv.WriteFeatureSkewPairsToTFRecord(output_path))\n\nSee the documentation for DetectFeatureSkewImpl for more detail about feature\nskew detection.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|-------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `identifier_features` | Names of features to use as identifiers. |\n| `features_to_ignore` | Names of features for which no feature skew detection is done. |\n| `sample_size` | Size of the sample of training-serving example pairs that exhibit skew to include in the skew results. |\n| `float_round_ndigits` | Number of digits precision after the decimal point to which to round float values before comparing them. |\n| `allow_duplicate_identifiers` | If set, skew detection will be done on examples for which there are duplicate identifier feature values. In this case, the counts in the FeatureSkew result are based on each training-serving example pair analyzed. Examples with given identifier feature values must all fit in memory. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Class Variables --------------- ||\n|----------|--------|\n| pipeline | `None` |\n\n\u003cbr /\u003e"]]