item_counts { : for in itemsfor (user,item,rating,timestampin self training_ratingsitem_counts[item+ items_sorted sorted((item_counts[ ],ifor in itemstop_items items_sorted[-num_items:set_top_items set(item for (countitemin top_items users {user for (user,item,rating,timestampin self training_ratingsuser_counts { : for in usersfor (user,item,rating,timestampin self training_ratingsif item in set_top_itemsuser_counts[user+ users_sorted sorted((user_counts[ ],ufor in userstop_users users_sorted[-num_users:set_top_users set(user for (countuserin top_usersused_ratings (user,item,rating,timestampfor (user,item,rating,timestampin self training_ratings if user in set_top_users and item in set_top_itemsreturn used_ratings movielens rating_set(learner cf_learner(movielensnum_properties #learner learn( learner plot_predictions(examples "training"learner plot_predictions(examples "test"#learner plot_property( #movielens_subset movielens create_top_subset(num_items num_users #learner_s cf_learner(movielensrating_subset=movielens_subsettest_subset=[]num_properties= #learner_s learn( #learner_s plot_property( ,plot_all=trueversion june