evaluation/evaluate.py
def compute_prec(scores):
    """
    Compute the precision at k, where k is in the range of [1,max_k]
    """
    precs = []
    max_k = len(scores)
    for k in xrange(max_k):
        prec_at_k = round(len([s for s in scores if s<=k])/float(k+1), 4)*100
        precs.append(prec_at_k)
    return precs

    Compute the precision at k, where k is in the range of [1,max_k]
    
Compute the precision at k, where k is in the range of [1,max_k]
Compute the precision at k where k is in the range of [ 1 max_k ]
def compute_prec(scores):
    precs = []
    max_k = len(scores)
    for k in xrange(max_k):
        prec_at_k = round(len([s for s in scores if s<=k])/float(k+1), 4)*100
        precs.append(prec_at_k)
    return precs
def compute_prec ( scores ) : precs = [ ] max_k = len ( scores ) for k in xrange ( max_k ) : prec_at_k = round ( len ( [ s for s in scores if s <= k ] ) / float ( k + 1 ) , 4 ) * 100 precs . append ( prec_at_k ) return precs
Compute the precision at k, where k is in the range of [1,max_k]
Compute the precision at k where k is in the range of [ 1 max_k ]
"""
    Compute the precision at k, where k is in the range of [1,max_k]
    """
scores