#NEWLINE# def fit( self , data ) : #NEWLINE# #INDENT# '\n        Train the model\n        ' #NEWLINE# data_array = data [ [ 'user' , 'item' ] ] #NEWLINE# items = data . item . unique ( ) #NEWLINE# for iter in range ( self . _n_iter ) : #NEWLINE# #INDENT# for ( idx , row ) in data_array . iterrows ( ) : #NEWLINE# #INDENT# self . _additiveupdate ( row , data )