turicreate.recommender.item_content_recommender.ItemContentRecommender.evaluate_precision_recall

ItemContentRecommender.evaluate_precision_recall(dataset, cutoffs=[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 16, 21, 26, 31, 36, 41, 46], skip_set=None, exclude_known=True, verbose=True, **kwargs)

Compute a model’s precision and recall scores for a particular dataset.

Parameters:
dataset : SFrame

An SFrame in the same format as the one used during training. This will be compared to the model’s recommendations, which exclude the (user, item) pairs seen at training time.

cutoffs : list, optional

A list of cutoff values for which one wants to evaluate precision and recall, i.e. the value of k in “precision at k”.

skip_set : SFrame, optional

Passed to recommend() as exclude.

exclude_known : bool, optional

Passed to recommend() as exclude_known. If True, exclude training item from recommendation.

verbose : bool, optional

Enables verbose output. Default is verbose.

**kwargs

Additional keyword arguments are passed to the recommend function, whose returned recommendations are used for evaluating precision and recall of the model.

Returns:
out : dict

Contains the precision and recall at each cutoff value and each user in dataset.

Examples

>>> import turicreate as tc
>>> sf = tc.SFrame('https://static.turi.com/datasets/audioscrobbler')
>>> train, test = tc.recommender.util.random_split_by_user(sf)
>>> m = tc.recommender.create(train)
>>> m.evaluate_precision_recall(test)