コード例 #1
0
 def __init__(self, 
            samplefile,
            output_file,
            use_event=0,
            afternbatches=-1,
            on_epoch_end=False):
     
     self.callback = PredictCallback(
         samplefile=samplefile,
         function_to_apply=self.make_plot, #needs to be function(counter,[model_input], [predict_output], [truth])
              after_n_batches=afternbatches,
              on_epoch_end=on_epoch_end,
              use_event=-1,
              decay_function=None)
コード例 #2
0
ファイル: tools.py プロジェクト: riga/HGCalML
    def __init__(self,
                 samplefile,
                 output_file,
                 use_event=0,
                 x_index=5,
                 y_index=6,
                 z_index=7,
                 e_index=0,
                 cut_z=None,
                 plotter=None,
                 plotfunc=None,
                 afternbatches=-1,
                 on_epoch_end=True,
                 decay_function=None):

        self.x_index = x_index
        self.y_index = y_index
        self.z_index = z_index
        self.e_index = e_index
        self.cut_z = cut_z
        if self.cut_z is not None:
            if 'pos' in self.cut_z:
                self.cut_z = 1.
            elif 'neg' in self.cut_z:
                self.cut_z = -1.

        self.decay_function = decay_function
        self.callback = PredictCallback(
            samplefile=samplefile,
            function_to_apply=self.
            make_plot,  #needs to be function(counter,[model_input], [predict_output], [truth])
            after_n_batches=afternbatches,
            on_epoch_end=on_epoch_end,
            use_event=use_event,
            decay_function=self.decay_function)

        self.output_file = output_file
        if plotter is not None:
            self.plotter = plotter
        else:
            self.plotter = plotter_fraction_colors(output_file=output_file)
            self.plotter.gray_noise = False
        if plotfunc is not None:
            self.plotfunc = plotfunc
        else:
            self.plotfunc = None
コード例 #3
0
ファイル: new_stage_depth.py プロジェクト: jkiesele/CaloGran
    train.compileModel(learningrate=0.001,
                       loss=['mean_squared_error'],)
                       #metrics=usemetrics)

print(train.keras_model.summary())
#exit()

from tools import offset_plotter

pltr = offset_plotter(train,relative=True)
from DeepJetCore.training.DeepJet_callbacks import PredictCallback

predcb=PredictCallback(samplefile=train.val_data.getSamplePath(train.val_data.samples[0]),
                       function_to_apply=pltr.make_plot,  
                       after_n_batches=-1, #1000, 
                       batchsize=10000,
                       on_epoch_end=True,
                       use_event=-1)

from training_scheduler import scheduled_training, Learning_sched

learn=[]

learn.append(Learning_sched(lr=1e-4,     
                            nepochs=1,   
                            batchsize=256,#128
                            #loss=[binned_global_correction_loss_random]))
                            loss=[huber_loss_calo]))

learn.append(Learning_sched(lr=1e-4,     
                            nepochs=19,