# tfma.extractors.SliceKeyExtractor

<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/slice_key_extractor.py#L32-L75) |

Creates an extractor for extracting slice keys.

    tfma.extractors.SliceKeyExtractor(
        slice_spec: Optional[List[slicer.SingleSliceSpec]] = None,
        eval_config: Optional[https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/EvalConfig] = None,
        materialize: Optional[bool] = True
    ) -> https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/extractors/Extractor

The incoming Extracts must contain features stored under tfma.FEATURES_KEY
and optionally under tfma.TRANSFORMED_FEATURES.

The extractor's PTransform yields a copy of the Extracts input with an
additional extract pointing at the list of SliceKeyType values keyed by
tfma.SLICE_KEY_TYPES_KEY. If materialize is True then a materialized version
of the slice keys will be added under the key tfma.SLICE_KEYS_KEY.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `slice_spec` | Deprecated (use EvalConfig). |
| `eval_config` | Optional EvalConfig containing slicing_specs specifying the slices to slice the data into. If slicing_specs are empty, defaults to overall slice. |
| `materialize` | True to add MaterializedColumn entries for the slice keys. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Extractor for slice keys. ||

<br />