def precision_series(y_true, y_score, k=None):
    """
    Returns series of length k whose i-th entry is the precision in the top i
    TODO: extrapolate here
    """
    y_true, y_score = to_float(y_true, y_score)
    top = _argsort(y_score, k)

    n = np.nan_to_num(y_true[top]).cumsum()  # fill missing labels with 0
    d = (~np.isnan(y_true[top])).cumsum()    # count number of labels
    return pd.Series(n/d, index=np.arange(1, len(n)+1))
def precision_series ( y_true , y_score , k = None ) : y_true , y_score = to_float ( y_true , y_score ) top = _argsort ( y_score , k ) n = np . nan_to_num ( y_true [ top ] ) . cumsum ( ) d = ( ~ np . isnan ( y_true [ top ] ) ) . cumsum ( ) return pd . Series ( n / d , index = np . arange ( 1 , len ( n ) + 1 ) )
Returns series of length k whose i-th entry is the precision in the top i
    TODO: extrapolate here