Skip to content
Snippets Groups Projects
Commit 658f4ddf authored by Felix Kleinert's avatar Felix Kleinert
Browse files

first draft of callback

parent e914db41
No related branches found
No related tags found
6 merge requests!319add all changes of dev into release v1.4.0 branch,!318Resolve "release v1.4.0",!317enabled window_lead_time=1,!308Felix issue312 callback track epoch runtime,!307Resolve "Implement Callback to track epoch-runtime",!259Draft: Resolve "WRF-Datahandler should inherit from SingleStationDatahandler"
Pipeline #72161 passed
......@@ -8,6 +8,7 @@ import math
import pickle
from typing import Union, List
from typing_extensions import TypedDict
from time import time
import numpy as np
from keras import backend as K
......@@ -111,6 +112,19 @@ class LearningRateDecay(History):
return K.get_value(self.model.optimizer.lr)
class TimingCallback(Callback):
def __init__(self):
self.logs = []
self.starttime = None
super().__init__()
def on_epoch_begin(self, logs={}):
self.starttime = time()
def on_epoch_end(self, logs={}):
self.logs.append(time()-self.starttime)
class ModelCheckpointAdvanced(ModelCheckpoint):
"""
Enhance the standard ModelCheckpoint class by additional saves of given callbacks.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment