def get_multilabel_thresholds(
    scores: np.ndarray, labels: np.ndarray, objective: METRIC_FN
):
    """Finds best thresholds for multilabel classification task.

    Args:
        scores: estimated per-class scores/probabilities predicted by the model,
            numpy array with shape [num_examples, num_classes]
        labels: ground truth labels, numpy array with shape [num_examples, num_classes]
        objective: callable function, metric which we want to maximize

    Returns:
        tuple with best found objective score and per-class thresholds
    """
    num_classes = labels.shape[1]
    metrics = [0.0] * num_classes
    thresholds = [0.0] * num_classes

    for class_index in range(num_classes):
        best_metric, best_threshold = get_binary_threshold(
            labels=labels[:, class_index],
            scores=scores[:, class_index],
            objective=objective,
        )
        metrics[class_index] = best_metric
        thresholds[class_index] = best_threshold

    return metrics, thresholds
Finds best thresholds for multilabel classification task.

    Args:
        scores: estimated per-class scores/probabilities predicted by the model,
            numpy array with shape [num_examples, num_classes]
        labels: ground truth labels, numpy array with shape [num_examples, num_classes]
        objective: callable function, metric which we want to maximize

    Returns:
        tuple with best found objective score and per-class thresholds
    
catalyst/contrib/utils/thresholds.py