From 91feab0ce267634069fdfd5574d348b999da7d3c Mon Sep 17 00:00:00 2001 From: leufen1 <l.leufen@fz-juelich.de> Date: Fri, 18 Sep 2020 16:34:33 +0200 Subject: [PATCH] MyLittleModel consists now only on Dense layers, included bug fix /close #169 --- mlair/model_modules/model_class.py | 12 +++--------- mlair/run_modules/post_processing.py | 12 ++++-------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/mlair/model_modules/model_class.py b/mlair/model_modules/model_class.py index bba1d8bd..0e69d220 100644 --- a/mlair/model_modules/model_class.py +++ b/mlair/model_modules/model_class.py @@ -351,9 +351,8 @@ class AbstractModelClass(ABC): class MyLittleModel(AbstractModelClass): """ - A customised model with a 1x1 Conv, and 4 Dense layers (64, 32, 16, window_lead_time), where the last layer is the - output layer depending on the window_lead_time parameter. Dropout is used between the Convolution and the first - Dense layer. + A customised model 4 Dense layers (64, 32, 16, window_lead_time), where the last layer is the output layer depending + on the window_lead_time parameter. """ def __init__(self, shape_inputs: list, shape_outputs: list): @@ -382,13 +381,8 @@ class MyLittleModel(AbstractModelClass): """ Build the model. """ - - # add 1 to window_size to include current time step t0 x_input = keras.layers.Input(shape=self.shape_inputs) - x_in = keras.layers.Conv2D(32, (1, 1), padding='same', name='{}_Conv_1x1'.format("major"))(x_input) - x_in = self.activation(name='{}_conv_act'.format("major"))(x_in) - x_in = keras.layers.Flatten(name='{}'.format("major"))(x_in) - x_in = keras.layers.Dropout(self.dropout_rate, name='{}_Dropout_1'.format("major"))(x_in) + x_in = keras.layers.Flatten(name='{}'.format("major"))(x_input) x_in = keras.layers.Dense(64, name='{}_Dense_64'.format("major"))(x_in) x_in = self.activation()(x_in) x_in = keras.layers.Dense(32, name='{}_Dense_32'.format("major"))(x_in) diff --git a/mlair/run_modules/post_processing.py b/mlair/run_modules/post_processing.py index d4f409ec..b4af7a75 100644 --- a/mlair/run_modules/post_processing.py +++ b/mlair/run_modules/post_processing.py @@ -81,16 +81,12 @@ class PostProcessing(RunEnvironment): def _run(self): # ols model - with TimeTracking(): - self.train_ols_model() - logging.info("take a look on the next reported time measure. If this increases a lot, one should think to " - "skip train_ols_model() whenever it is possible to save time.") + self.train_ols_model() # forecasts - with TimeTracking(): - self.make_prediction() - logging.info("take a look on the next reported time measure. If this increases a lot, one should think to " - "skip make_prediction() whenever it is possible to save time.") + self.make_prediction() + + # skill scores on test data self.calculate_test_score() # bootstraps -- GitLab