# tfma.metrics.MultiLabelConfusionMatrixPlot

<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/multi_label_confusion_matrix_plot.py#L29-L95) |

Multi-label confusion matrix.

Inherits From: [`Metric`](https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/Metric)

    tfma.metrics.MultiLabelConfusionMatrixPlot(
        thresholds: Optional[List[float]] = None,
        num_thresholds: Optional[int] = None,
        name: str = MULTI_LABEL_CONFUSION_MATRIX_PLOT_NAME
    )

For each actual class (positive label) a confusion matrix is computed for each
class based on the associated predicted values such that:

TP = positive_prediction_class_label \& positive_prediction
TN = negative_prediction_class_label \& negative_prediction
FP = negative_prediction_class_label \& positive_prediction
FN = positive_prediction_class_label \& negative_prediction

For example, given classes 0, 1 and a given threshold, the following matrices
will be computed:

Actual: class_0
Predicted: class_0
TP = is_class_0 \& is_class_0 \& predict_class_0
TN = is_class_0 \& not_class_0 \& predict_not_class_0
FN = is_class_0 \& is_class_0 \& predict_not_class_0
FP = is_class_0 \& not_class_0 \& predict_class_0
Actual: class_0
Predicted: class_1
TP = is_class_0 \& is_class_1 \& predict_class_1
TN = is_class_0 \& not_class_1 \& predict_not_class_1
FN = is_class_0 \& is_class_1 \& predict_not_class_1
FP = is_class_0 \& not_class_1 \& predict_class_1
Actual: class_1
Predicted: class_0
TP = is_class_1 \& is_class_0 \& predict_class_0
TN = is_class_1 \& not_class_0 \& predict_not_class_0
FN = is_class_1 \& is_class_0 \& predict_not_class_0
FP = is_class_1 \& not_class_0 \& predict_class_0
Actual: class_1
Predicted: class_1
TP = is_class_1 \& is_class_1 \& predict_class_1
TN = is_class_1 \& not_class_1 \& predict_not_class_1
FN = is_class_1 \& is_class_1 \& predict_not_class_1
FP = is_class_1 \& not_class_1 \& predict_class_1

Note that unlike the multi-class confusion matrix, the inputs are assumed to
be multi-label whereby the predictions may not necessarily sum to 1.0 and
multiple classes can be true as the same time.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `thresholds` | Optional thresholds. Only one of either thresholds or num_thresholds should be used. If both are unset, then \[0.5\] will be assumed. |
| `num_thresholds` | Number of thresholds to use. The thresholds will be evenly spaced between 0.0 and 1.0 and inclusive of the boundaries (i.e. to configure the thresholds to \[0.0, 0.25, 0.5, 0.75, 1.0\], the parameter should be set to 5). Only one of either thresholds or num_thresholds should be used. |
| `name` | Metric name. |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `compute_confidence_interval` | Whether to compute confidence intervals for this metric. <br /> Note that this may not completely remove the computational overhead involved in computing a given metric. This is only respected by the jackknife confidence interval method. |

<br />

## Methods

### `computations`

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

    computations(
        eval_config: Optional[https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/EvalConfig] = None,
        schema: Optional[schema_pb2.Schema] = None,
        model_names: Optional[List[str]] = None,
        output_names: Optional[List[str]] = None,
        sub_keys: Optional[List[Optional[SubKey]]] = None,
        aggregation_type: Optional[AggregationType] = None,
        class_weights: Optional[Dict[int, float]] = None,
        example_weighted: bool = False,
        query_key: Optional[str] = None
    ) -> https://www.tensorflow.org/tfx/model_analysis/api_docs/python/tfma/metrics/MetricComputations

Creates computations associated with metric.

### `from_config`

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

    @classmethod
    from_config(
        config: Dict[str, Any]
    ) -> 'Metric'

### `get_config`

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

    get_config() -> Dict[str, Any]

Returns serializable config.