# tfma.extractors.PredictionsExtractor

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/extractors/predictions_extractor.py#L31-L84) |

Creates an extractor for performing predictions over a batch.

    tfma.extractors.PredictionsExtractor(
        eval_config: https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/EvalConfig,
        eval_shared_model: Optional[https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/types/EvalSharedModel] = None,
        output_keypath: Sequence[str] = (constants.PREDICTIONS_KEY,)
    ) -> https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/extractors/Extractor

The extractor's PTransform loads and runs the serving saved_model(s) against
every Extracts yielding a copy of the incoming Extracts with an additional
Extracts added for the predictions keyed by tfma.PREDICTIONS_KEY. The model
inputs are searched for under tfma.FEATURES_KEY (keras only) or tfma.INPUT_KEY
(if tfma.FEATURES_KEY is not set or the model is non-keras). If multiple
models are used the predictions will be stored in a dict keyed by model name.

Note that the prediction_key in the ModelSpecs also serves as a key into the
dict of the prediction's output.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `eval_config` | Eval config. |
| `eval_shared_model` | Shared model (single-model evaluation) or list of shared models (multi-model evaluation) or None (predictions obtained from features). |
| `output_keypath` | A sequence of keys to be used as the path to traverse and insert the outputs in the extract. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Extractor for extracting predictions. ||

<br />