MyMediaLite  3.11
Static Public Member Functions | List of all members
PrecisionAndRecall Class Reference

Precision and recall at different positions in the list More...

Static Public Member Functions

static double AP (IList< int > ranked_items, ICollection< int > correct_items)
 Compute the average precision (AP) of a list of ranked items More...
 
static int HitsAt (IList< int > ranked_items, ICollection< int > correct_items, int n)
 Compute the number of hits until position N of a list of ranked items More...
 
static Dictionary< int, double > PrecisionAt (IList< int > ranked_items, ICollection< int > correct_items, IList< int > ns)
 Compute the precision at N of a list of ranked items at several N More...
 
static double PrecisionAt (IList< int > ranked_items, ICollection< int > correct_items, int n)
 Compute the precision at N of a list of ranked items More...
 
static Dictionary< int, double > RecallAt (IList< int > ranked_items, ICollection< int > correct_items, IList< int > ns)
 Compute the recall at N of a list of ranked items at several N More...
 
static double RecallAt (IList< int > ranked_items, ICollection< int > correct_items, int n)
 Compute the recall at N of a list of ranked items More...
 

Detailed Description

Precision and recall at different positions in the list

Precision and recall are classical evaluation measures from information retrieval.

This class contains methods for computing precision and recall up to different positions in the recommendation list, and the average precision (AP).

The mean of the AP over different users is called mean average precision (MAP)

Member Function Documentation

static double AP ( IList< int >  ranked_items,
ICollection< int >  correct_items 
)
inlinestatic

Compute the average precision (AP) of a list of ranked items

See p. 147 of Introduction to Information Retrieval by Manning, Raghavan, Schütze.

Parameters
ranked_itemsa list of ranked item IDs, the highest-ranking item first
correct_itemsa collection of positive/correct item IDs
Returns
the AP for the given list
static int HitsAt ( IList< int >  ranked_items,
ICollection< int >  correct_items,
int  n 
)
inlinestatic

Compute the number of hits until position N of a list of ranked items

Parameters
ranked_itemsa list of ranked item IDs, the highest-ranking item first
correct_itemsa collection of positive/correct item IDs
nthe cutoff position in the list
Returns
the hits at N for the given data
static Dictionary<int, double> PrecisionAt ( IList< int >  ranked_items,
ICollection< int >  correct_items,
IList< int >  ns 
)
inlinestatic

Compute the precision at N of a list of ranked items at several N

Parameters
ranked_itemsa list of ranked item IDs, the highest-ranking item first
correct_itemsa collection of positive/correct item IDs
nsthe cutoff positions in the list
Returns
the precision at N for the given data at the different positions N
static double PrecisionAt ( IList< int >  ranked_items,
ICollection< int >  correct_items,
int  n 
)
inlinestatic

Compute the precision at N of a list of ranked items

Parameters
ranked_itemsa list of ranked item IDs, the highest-ranking item first
correct_itemsa collection of positive/correct item IDs
nthe cutoff position in the list
Returns
the precision at N for the given data
static Dictionary<int, double> RecallAt ( IList< int >  ranked_items,
ICollection< int >  correct_items,
IList< int >  ns 
)
inlinestatic

Compute the recall at N of a list of ranked items at several N

Parameters
ranked_itemsa list of ranked item IDs, the highest-ranking item first
correct_itemsa collection of positive/correct item IDs
nsthe cutoff positions in the list
Returns
the recall at N for the given data at the different positions N
static double RecallAt ( IList< int >  ranked_items,
ICollection< int >  correct_items,
int  n 
)
inlinestatic

Compute the recall at N of a list of ranked items

Parameters
ranked_itemsa list of ranked item IDs, the highest-ranking item first
correct_itemsa collection of positive/correct item IDs
nthe cutoff position in the list
Returns
the recall at N for the given data

The documentation for this class was generated from the following file: