tfma.extractors.InputExtractor
Stay organized with collections
Save and categorize content based on your preferences.
Creates an extractor for extracting features, labels, and example weights.
tfma.extractors.InputExtractor(
eval_config: tfma.EvalConfig
) -> tfma.extractors.Extractor
The extractor's PTransform parses tf.train.Example protos stored under the
tfma.INPUT_KEY in the incoming extracts and adds the resulting features,
labels, and example weights to the extracts under the keys tfma.FEATURES_KEY,
tfma.LABELS_KEY, and tfma.EXAMPLE_WEIGHTS_KEY. If the eval_config contains a
prediction_key and a corresponding key is found in the parse example, then
predictions will also be extracted and stored under the tfma.PREDICTIONS_KEY.
Any extracts that already exist will be merged with the values parsed by this
extractor with this extractor's values taking precedence when duplicate keys
are detected.
Note that the use of a prediction_key in an eval_config serves two use cases:
(1) as a key into the dict of predictions output by predict extractor
(2) as the key for a pre-computed prediction stored as a feature.
The InputExtractor can be used to handle case (2). These cases are meant to be
exclusive (i.e. if approach (2) is used then a predict extractor would not be
configured and if (1) is used then a key matching the predictons would not be
stored in the features). However, if a feature key happens to match the same
name as the prediction output key then both paths may be executed. In this
case, the value stored here will be replaced by the predict extractor (though
it will still be popped from the features).
Args |
eval_config
|
Eval config.
|
Returns |
Extractor for extracting features, labels, and example weights inputs.
|
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-04-26 UTC.
[null,null,["Last updated 2024-04-26 UTC."],[],[],null,["# tfma.extractors.InputExtractor\n\n\u003cbr /\u003e\n\n|-----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/extractors/legacy_input_extractor.py#L31-L64) |\n\nCreates an extractor for extracting features, labels, and example weights. \n\n tfma.extractors.InputExtractor(\n eval_config: ../../tfma/EvalConfig\n ) -\u003e ../../tfma/extractors/Extractor\n\nThe extractor's PTransform parses tf.train.Example protos stored under the\ntfma.INPUT_KEY in the incoming extracts and adds the resulting features,\nlabels, and example weights to the extracts under the keys tfma.FEATURES_KEY,\ntfma.LABELS_KEY, and tfma.EXAMPLE_WEIGHTS_KEY. If the eval_config contains a\nprediction_key and a corresponding key is found in the parse example, then\npredictions will also be extracted and stored under the tfma.PREDICTIONS_KEY.\nAny extracts that already exist will be merged with the values parsed by this\nextractor with this extractor's values taking precedence when duplicate keys\nare detected.\n\nNote that the use of a prediction_key in an eval_config serves two use cases:\n(1) as a key into the dict of predictions output by predict extractor\n(2) as the key for a pre-computed prediction stored as a feature.\nThe InputExtractor can be used to handle case (2). These cases are meant to be\nexclusive (i.e. if approach (2) is used then a predict extractor would not be\nconfigured and if (1) is used then a key matching the predictons would not be\nstored in the features). However, if a feature key happens to match the same\nname as the prediction output key then both paths may be executed. In this\ncase, the value stored here will be replaced by the predict extractor (though\nit will still be popped from the features).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|---------------|--------------|\n| `eval_config` | Eval config. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| Extractor for extracting features, labels, and example weights inputs. ||\n\n\u003cbr /\u003e"]]