def hit_rate(y_true, y_pred):
    """
    Computes the hit rate i.e. how many samples are classified to the correct

    Parameters:
        y_true = one-hot multilabel ground truths (N, m)
        y_pred = one-hot class belonging predictions (N, m)
    Returns:
        hit rate = hits / # of samples
    """
    hits = 0
    for true, pred in zip(y_true, y_pred):
        # if a single true at positive index passed threshold, then it's a hit
        # o/w total miss
        # if there are no positive labels, then automatic hit regardless of classification
        if not true.any() or pred[true.astype(bool)].any():
            hits += 1

    return hits / len(y_true)