#NEWLINE# def plot_pred_log_likelihood( results , names , results_dir , outname = 'pred_ll_vs_time.pdf' , smooth = True ) : #NEWLINE# #INDENT# plt . figure ( figsize = ( 3 , 3.2 ) ) #NEWLINE# for ( i , ( result , name ) ) in enumerate ( zip ( results , names ) ) : #NEWLINE# #INDENT# if ( result . pred_lls . ndim == 2 ) : #NEWLINE# #INDENT# pred_ll = result . pred_lls [ : , 0 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# pred_ll = result . pred_lls #NEWLINE# #UNINDENT# if smooth : #NEWLINE# #INDENT# win = 10 #NEWLINE# pad_pred_ll = np . concatenate ( ( ( pred_ll [ 0 ] * np . ones ( win ) ) , pred_ll ) ) #NEWLINE# smooth_pred_ll = np . array ( [ ( logsumexp ( pad_pred_ll [ ( j - win ) : ( j + 1 ) ] ) - np . log ( win ) ) for j in xrange ( win , pad_pred_ll . size ) ] ) #NEWLINE# plt . plot ( np . clip ( result . timestamps , 0.001 , np . inf ) , smooth_pred_ll , lw = 2 , color = colors [ i ] , label = name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# plt . plot ( np . clip ( result . timestamps , 0.001 , np . inf ) , result . pred_lls , lw = 2 , color = colors [ i ] , label = name ) #NEWLINE# #UNINDENT# #UNINDENT# plt . xlabel ( 'Time (s)' ) #NEWLINE# plt . xscale ( 'log' ) #NEWLINE# plt . ylabel ( 'Pred. Log Likelihood' ) #NEWLINE# plt . savefig ( os . path . join ( results_dir , results_dir ) ) #NEWLINE# plt . tight_layout ( )