# Mean Average Precision python code

How do you compute MAP in python for evaluating recommender system effectiveness? Is there any library in sklearn or code in python for it?

I would like to compute the effectiveness of my Recommender System by computing Mean Average Precision.

This library called Metrics provides most of metrics for Machine Learning including MAP for Recommendation systems. If you only interested in metrics for recommendation systems, perhaps you can see this library.

• Can i get proper implementation with python code.I am not able to get any references for it? – SARTHAK Jan 30 at 7:17
• That library I recommended has all python implementation, what do you mean? have you checked those github pages? Click on "Metrics", or 'this library" and you see. – TwinPenguins Jan 30 at 16:58

You can use the ml_metrics library. For install this library use:

pip install ml_metrics

import ml_metrics

ml_metrics.mapk(actual, predicted, k)