#NEWLINE# def candidate_items( self , user_id , data_model , **params ) : #NEWLINE# #INDENT# preferences = data_model . items_from_user ( user_id ) #NEWLINE# possible_items = np . array ( [ ] ) #NEWLINE# for item_id in preferences : #NEWLINE# #INDENT# item_preferences = data_model . preferences_for_item ( item_id ) #NEWLINE# if data_model . has_preference_values ( ) : #NEWLINE# #INDENT# for ( user_id , score ) in item_preferences : #NEWLINE# #INDENT# possible_items = np . append ( possible_items , data_model . items_from_user ( user_id ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# for user_id in item_preferences : #NEWLINE# #INDENT# possible_items = np . append ( possible_items , data_model . items_from_user ( user_id ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# possible_items = np . unique ( self ) #NEWLINE# return np . setdiff1d ( possible_items , preferences , assume_unique = True )