#NEWLINE# def compute_user_stats( self ) : #NEWLINE# #INDENT# simple_offsets = compute_offsets ( data_indices = self . data_set [ : , constants . MOVIE_INDEX ] , data_values = self . data_set [ : , constants . RATING_INDEX ] , averages = self . movie_averages ) #NEWLINE# ( simple_sum , simple_count ) = compute_simple_indexed_sum_and_count ( data_indices = self . data_set [ : , constants . USER_INDEX ] , data_values = simple_offsets ) #NEWLINE# user_offset_global_average = ( np . sum ( simple_sum ) / np . sum ( simple_count ) ) #NEWLINE# if ( user_offset_global_average == np . nan ) : #NEWLINE# #INDENT# raise Exception ( 'Error NaN in global average of offsets' ) #NEWLINE# #UNINDENT# self . user_offsets = compute_blended_indexed_averages ( simple_sum = simple_sum , simple_count = simple_count , global_average = user_offset_global_average ) #NEWLINE# self . user_offsets_sum = simple_sum #NEWLINE# self . user_rating_count = simple_count