def precision_recall_fbeta_support(
    outputs: torch.Tensor,
    targets: torch.Tensor,
    beta: float = 1,
    eps: float = 1e-6,
    argmax_dim: int = -1,
    num_classes: Optional[int] = None,
    zero_division: int = 0,
) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:
    """
    Counts precision_val, recall, fbeta_score.

    Args:
        outputs: A list of predicted elements
        targets:  A list of elements that are to be predicted
        beta: beta param for f_score
        eps: epsilon to avoid zero division
        argmax_dim: int, that specifies dimension for argmax transformation
            in case of scores/probabilities in ``outputs``
        num_classes: int, that specifies number of classes if it known.
        zero_division: int value, should be one of 0 or 1;
            used for precision_val and recall computation

    Returns:
        tuple of precision_val, recall, fbeta_score

    Examples:

    .. code-block:: python

        import torch
        from catalyst import metrics
        metrics.precision_recall_fbeta_support(
            outputs=torch.tensor([
                [1, 0, 0],
                [0, 1, 0],
                [0, 0, 1],
            ]),
            targets=torch.tensor([0, 1, 2]),
            beta=1,
        )
        # (
        #     tensor([1., 1., 1.]),  # per class precision
        #     tensor([1., 1., 1.]),  # per class recall
        #     tensor([1., 1., 1.]),  # per class fbeta
        #     tensor([1., 1., 1.]),  # per class support
        # )

    .. code-block:: python

        import torch
        from catalyst import metrics
        metrics.precision_recall_fbeta_support(
            outputs=torch.tensor([[0, 0, 1, 1, 0, 1, 0, 1]]),
            targets=torch.tensor([[0, 1, 0, 1, 0, 0, 1, 1]]),
            beta=1,
        )
        # (
        #     tensor([0.5000, 0.5000]),  # per class precision
        #     tensor([0.5000, 0.5000]),  # per class recall
        #     tensor([0.5000, 0.5000]),  # per class fbeta
        #     tensor([4., 4.]),          # per class support
        # )
    """
    tn, fp, fn, tp, support, _ = get_multiclass_statistics(
        outputs=outputs, targets=targets, argmax_dim=argmax_dim, num_classes=num_classes
    )
    # @TODO: sync between metrics
    # precision_val = _precision(tp=tp, fp=fp, eps=eps, zero_division=zero_division)
    precision_val = (tp + eps) / (fp + tp + eps)
    recall_val = (tp + eps) / (fn + tp + eps)
    numerator = (1 + beta ** 2) * precision_val * recall_val
    denominator = beta ** 2 * precision_val + recall_val
    fbeta = numerator / denominator

    return precision_val, recall_val, fbeta, support

    Counts precision_val, recall, fbeta_score.

    Args:
        outputs: A list of predicted elements
        targets:  A list of elements that are to be predicted
        beta: beta param for f_score
        eps: epsilon to avoid zero division
        argmax_dim: int, that specifies dimension for argmax transformation
            in case of scores/probabilities in ``outputs``
        num_classes: int, that specifies number of classes if it known.
        zero_division: int value, should be one of 0 or 1;
            used for precision_val and recall computation

    Returns:
        tuple of precision_val, recall, fbeta_score

    Examples:

    .. code-block:: python

        import torch
        from catalyst import metrics
        metrics.precision_recall_fbeta_support(
            outputs=torch.tensor([
                [1, 0, 0],
                [0, 1, 0],
                [0, 0, 1],
            ]),
            targets=torch.tensor([0, 1, 2]),
            beta=1,
        )
        # (
        #     tensor([1., 1., 1.]),  # per class precision
        #     tensor([1., 1., 1.]),  # per class recall
        #     tensor([1., 1., 1.]),  # per class fbeta
        #     tensor([1., 1., 1.]),  # per class support
        # )

    .. code-block:: python

        import torch
        from catalyst import metrics
        metrics.precision_recall_fbeta_support(
            outputs=torch.tensor([[0, 0, 1, 1, 0, 1, 0, 1]]),
            targets=torch.tensor([[0, 1, 0, 1, 0, 0, 1, 1]]),
            beta=1,
        )
        # (
        #     tensor([0.5000, 0.5000]),  # per class precision
        #     tensor([0.5000, 0.5000]),  # per class recall
        #     tensor([0.5000, 0.5000]),  # per class fbeta
        #     tensor([4., 4.]),          # per class support
        # )
    
catalyst/metrics/functional/_classification.py