def mapk(actual, predicted, k=10):
 return np.mean([apk(a, p, k) for (a, p) in zip(actual, predicted)])

def mapk ( actual , predicted , k = 10 ) : return np . mean ( [ apk ( a , p , k ) for ( a , p ) in zip ( actual , predicted ) ] )
computes the mean average precision at k .