def mean_recall_k(y_true, y_score, k=10):
    'Mean recall at rank k\n    Parameters\n    ----------\n    y_true : array-like, shape = [n_samples]\n        Ground truth (true relevance labels).\n    y_score : array-like, shape = [n_samples]\n        Predicted scores.\n    k : int\n        Rank.\n    Returns\n    -------\n    mean recall @k : float\n    '
    r_ks = []
    for (y_t, y_s) in zip(y_true, y_score):
        if np.sum((y_t == 1)):
            r_ks.append(ranking_recall_score(y_t, y_s, k=k))
    return np.mean(r_ks)
Mean recall at rank k
Parameters
----------
y_true : array-like, shape = [n_samples]
    Ground truth (true relevance labels).
y_score : array-like, shape = [n_samples]
    Predicted scores.
k : int
    Rank.
Returns
-------
mean recall @k : float
def mean_recall_k(y_true, y_score, k=10):
    'Mean recall at rank k\n    Parameters\n    ----------\n    y_true : array-like, shape = [n_samples]\n        Ground truth (true relevance labels).\n    y_score : array-like, shape = [n_samples]\n        Predicted scores.\n    k : int\n        Rank.\n    Returns\n    -------\n    mean recall @k : float\n    '
    r_ks = []
    for (y_t, y_s) in zip(y_true, y_score):
        if np.sum((y_t == 1)):
            r_ks.append(ranking_recall_score(y_t, y_s, k=k))
    return np.mean(r_ks)