#NEWLINE# def predict_single( self , line ) : #NEWLINE# #INDENT# '\n        Predict the label on a data row\n        :param line: a data row\n        :return:\n        ' #NEWLINE# prob_list = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for claz in self . class_list : #NEWLINE# #INDENT# prob_list [ line ] = 1 #NEWLINE# #UNINDENT# for col in self . cat_cols : #NEWLINE# #INDENT# val = line [ col ] #NEWLINE# for claz in self . class_list : #NEWLINE# #INDENT# prob_list [ claz ] *= self . prob_hub [ col ] [ claz ] [ val ] #NEWLINE# #UNINDENT# #UNINDENT# for col in self . num_cols : #NEWLINE# #INDENT# val = line [ col ] #NEWLINE# for claz in self . class_list : #NEWLINE# #INDENT# ( mean , std ) = self . prob_hub [ col ] [ claz ] #NEWLINE# prob_list [ claz ] *= calculate_prob ( val , mean , std ) #NEWLINE# #UNINDENT# #UNINDENT# return max ( prob_list . items ( ) , key = operator . itemgetter ( 1 ) ) [ 0 ]