turicreate.recommender.item_content_recommender.ItemContentRecommender.recommend_from_interactions

ItemContentRecommender.recommend_from_interactions(observed_items, k=10, exclude=None, items=None, new_user_data=None, new_item_data=None, exclude_known=True, diversity=0, random_seed=None, verbose=True)

Recommend the k highest scored items based on the interactions given in observed_items.

Parameters:
observed_items : SArray, SFrame, or list

A list/SArray of items to use to make recommendations, or an SFrame of items and optionally ratings and/or other interaction data. The model will then recommend the most similar items to those given. If observed_items has a user column, then it must be only one user, and the additional interaction data stored in the model is also used to make recommendations.

k : int, optional

The number of recommendations to generate.

items : SArray, SFrame, or list, optional

Restricts the items from which recommendations can be made. items must be an SArray, list, or SFrame with a single column containing items, and all recommendations will be made from this pool of items. This can be used, for example, to restrict the recommendations to items within a particular category or genre. By default, recommendations are made from all items present when the model was trained.

new_user_data : SFrame, optional

new_user_data may give additional user data to the model. If present, scoring is done with reference to this new information. If there is any overlap with the side information present at training time, then this new side data is preferred. Must be in the same format as the user data passed to create.

new_item_data : SFrame, optional

new_item_data may give additional item data to the model. If present, scoring is done with reference to this new information. If there is any overlap with the side information present at training time, then this new side data is preferred. Must be in the same format as the item data passed to create.

exclude : SFrame, optional

An SFrame of items or user / item pairs. The column names must be equal to the user and item columns of the main data, and it provides the model with user/item pairs to exclude from the recommendations. These user-item-pairs are always excluded from the predictions, even if exclude_known is False.

exclude_known : bool, optional

By default, all user-item interactions previously seen in the training data, or in any new data provided using new_observation_data.., are excluded from the recommendations. Passing in exclude_known = False overrides this behavior.

diversity : non-negative float, optional

If given, then the recommend function attempts chooses a set of k items that are both highly scored and different from other items in that set. It does this by first retrieving k*(1+diversity) recommended items, then randomly choosing a diverse set from these items. Suggested values for diversity are between 1 and 3.

random_seed : int, optional

If diversity is larger than 0, then some randomness is used; this controls the random seed to use for randomization. If None, then it will be different each time.

verbose : bool, optional

If True, print the progress of generating recommendation.

Returns:
out : SFrame

A SFrame with the top ranked items for each user. The columns are: item_id, score, and rank, where user_id and item_id match the user and item column names specified at training time. The rank column is between 1 and k and gives the relative score of that item. The value of score depends on the method used for recommendations.

observed_items: list, SArray, or SFrame