#NEWLINE# def train( self , train_points , stats , epochs = 1 ) : #NEWLINE# #INDENT# self . set_train_points ( train_points = train_points ) #NEWLINE# self . set_stats ( stats = stats ) #NEWLINE# self . initialize_users_and_movies ( ) #NEWLINE# for epoch in range ( epochs ) : #NEWLINE# #INDENT# if self . debug : #NEWLINE# #INDENT# print ( 'Epoch {}' . format ( ( epoch + 1 ) ) ) #NEWLINE# print ( 'movies: {}' . format ( self . movies ) ) #NEWLINE# print ( 'users: {}' . format ( self . users ) ) #NEWLINE# #UNINDENT# if ( np . isnan ( np . sum ( self . movies ) ) or np . isnan ( np . sum ( self . users ) ) ) : #NEWLINE# #INDENT# print ( 'So, I found a NaN..' ) #NEWLINE# import pdb #NEWLINE# pdb . set_trace ( ) #NEWLINE# #UNINDENT# if self . run_c : #NEWLINE# #INDENT# self . train_epoch_in_c ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . train_epoch ( )