How to develop Top-N recommendation for evaluating my system
Discounted cumulative gain (DCG) is one of the most common metrics for ranking quality. The gain is accumulated from the top of the result list to the bottom, with the gain of each subsequent result logarithmic discounted.

The DCG accumulated at a particular rank position n is defined as



Since search result lists vary in length, normalized DCG is used. It is normalized by the ideal ranking, sorting all relevant documents in the corpus by their relative relevance and producing the maximum possible DCG: