# tfma.metrics.StandardMetricInputs

<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/metrics/metric_types.py#L909-L943) |

Standard inputs used by most metric computations.

    tfma.metrics.StandardMetricInputs(
        extracts: Optional[https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/types/Extracts] = None,
        **kwargs
    )

StandardMetricInputs is a wrapper around Extracts where only the extracts keys
used by one or more ExtractsPreprocessors will be present.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `extracts` | Reference to existing extracts to use. |
| `**kwargs` | Name/value pairs to create new extracts from. Only one of either extracts or kwargs should be used. |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `attributions` | <br /> <br /> |
| `combined_features` | <br /> <br /> |
| `example_weight` | Same as example_weights (DEPRECATED - use example_weights). |
| `example_weights` | <br /> <br /> |
| `features` | <br /> <br /> |
| `inputs` | <br /> <br /> |
| `label` | Same as labels (DEPRECATED - use labels). |
| `labels` | <br /> <br /> |
| `prediction` | Same as predictions (DEPRECATED - use predictions). |
| `predictions` | <br /> <br /> |
| `transformed_features` | <br /> <br /> |

<br />

## Methods

### `clear`

    clear()

D.clear() -\> None. Remove all items from D.

### `get`

    get(
        key, default=None
    )

Retrieve the corresponding layout by the string key.

When there isn't an exact match, all the existing keys in the layout map
will be treated as a regex and map against the input key again. The
first match will be returned, based on the key insertion order. Return
None if there isn't any match found.

<br />

<br />

<br />

| Args ||
|---|---|
| `key` | the string key as the query for the layout. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| Corresponding layout based on the query. ||

<br />

### `get_attributions`

[View source](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/utils/util.py#L1188-L1194)

    get_attributions(
        model_name: Optional[str] = None, output_name: Optional[str] = None
    ) -> Optional[https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/types/DictOfTensorValueMaybeDict]

Returns tfma.ATTRIBUTIONS_KEY extract.

### `get_by_key`

[View source](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/metrics/metric_types.py#L931-L943)

    get_by_key(
        key: str,
        model_name: Optional[str] = None,
        output_name: Optional[str] = None
    ) -> Any

Returns item for key possibly filtered by model and/or output names.

### `get_combined_features`

[View source](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/utils/util.py#L1168-L1182)

    get_combined_features(
        model_name: Optional[str] = None
    ) -> Mapping[str, Any]

Returns a combined extract of transformed features and features.

In case of name collision, transformed features is looked up first and
the value is returned when found.

<br />

<br />

<br />

| Args ||
|---|---|
| `model_name` | Optionally, the model name assosicated to the transformed feature. This has no effect on the raw features extract. |

<br />

### `get_example_weights`

[View source](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/utils/util.py#L1136-L1143)

    get_example_weights(
        model_name: Optional[str] = None, output_name: Optional[str] = None
    ) -> Optional[types.TensorValueMaybeMultiLevelDict]

Returns tfma.EXAMPLE_WEIGHTS_KEY extract.

### `get_features`

[View source](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/utils/util.py#L1149-L1151)

    get_features() -> Optional[https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/types/DictOfTensorValueMaybeDict]

Returns tfma.FEATURES_KEY extract.

### `get_inputs`

[View source](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/utils/util.py#L1048-L1050)

    get_inputs() -> Any

Returns tfma.INPUT_KEY extract.

### `get_labels`

[View source](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/utils/util.py#L1086-L1092)

    get_labels(
        model_name: Optional[str] = None, output_name: Optional[str] = None
    ) -> Optional[types.TensorValueMaybeMultiLevelDict]

Returns tfma.LABELS_KEY extract.

### `get_model_and_output_names`

[View source](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/utils/util.py#L1056-L1084)

    get_model_and_output_names(
        eval_config: https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/EvalConfig
    ) -> List[Tuple[Optional[str], Optional[str]]]

Returns a list of model_name-output_name tuples present in extracts.

### `get_predictions`

[View source](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/utils/util.py#L1111-L1117)

    get_predictions(
        model_name: Optional[str] = None, output_name: Optional[str] = None
    ) -> Optional[types.TensorValueMaybeMultiLevelDict]

Returns tfma.PREDICTIONS_KEY extract.

### `get_transformed_features`

[View source](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/utils/util.py#L1157-L1162)

    get_transformed_features(
        model_name: Optional[str] = None
    ) -> Optional[https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/types/DictOfTensorValueMaybeDict]

Returns tfma.TRANSFORMED_FEATURES_KEY extract.

### `items`

    items()

D.items() -\> a set-like object providing a view on D's items

### `keys`

    keys()

D.keys() -\> a set-like object providing a view on D's keys

### `pop`

    pop(
        key, default=__marker
    )

D.pop(k\[,d\]) -\> v, remove specified key and return the corresponding value.
If key is not found, d is returned if given, otherwise KeyError is raised.

### `popitem`

    popitem()

D.popitem() -\> (k, v), remove and return some (key, value) pair as a 2-tuple; but raise KeyError if D is empty.

### `set_labels`

[View source](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/utils/util.py#L1098-L1109)

    set_labels(
        labels: https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/types/TensorValueMaybeMultiLevelDict,
        model_name: Optional[str] = None,
        output_name: Optional[str] = None
    ) -> Optional[types.TensorValueMaybeMultiLevelDict]

Sets tfma.LABELS_KEY extract for a given model and output.

### `set_predictions`

[View source](https://github.com/tensorflow/model-analysis/blob/v0.46.0/tensorflow_model_analysis/utils/util.py#L1119-L1130)

    set_predictions(
        predictions: https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/types/TensorValueMaybeMultiLevelDict,
        model_name: Optional[str] = None,
        output_name: Optional[str] = None
    ) -> Optional[types.TensorValueMaybeMultiLevelDict]

Sets tfma.PREDICTIONS_KEY extract for a given model and output.

### `setdefault`

    setdefault(
        key, default=None
    )

D.setdefault(k\[,d\]) -\> D.get(k,d), also set D\[k\]=d if k not in D

### `update`

    update(
        other, /, **kwds
    )

D.update(\[E, \]\*\*F) -\> None. Update D from mapping/iterable E and F.
If E present and has a .keys() method, does: for k in E: D\[k\] = E\[k\]
If E present and lacks .keys() method, does: for (k, v) in E: D\[k\] = v
In either case, this is followed by: for k, v in F.items(): D\[k\] = v

### `values`

    values()

D.values() -\> an object providing a view on D's values