#NEWLINE# def set_preference( self , user_id , item_id , value = None ) : #NEWLINE# #INDENT# '\n        Returns\n        --------\n        self\n            Sets a particular preference (item plus rating) for a user.\n        ' #NEWLINE# user_id_loc = np . where ( ( self . _user_ids == value ) ) #NEWLINE# if ( not user_id_loc [ 0 ] . size ) : #NEWLINE# #INDENT# raise UserNotFoundError ( 'user_id in the model not found' ) #NEWLINE# #UNINDENT# self . dataset [ user_id ] . append ( item_id ) #NEWLINE# self . build_model ( )