Skip to content

Instantly share code, notes, and snippets.

@petrosDemetrakopoulos
Last active December 17, 2022 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save petrosDemetrakopoulos/d7ba674c9583c353c41d8e638954ed94 to your computer and use it in GitHub Desktop.
Save petrosDemetrakopoulos/d7ba674c9583c353c41d8e638954ed94 to your computer and use it in GitHub Desktop.
Precipitation prediction model
def create_model():
model = Sequential()
model.add(ConvLSTM2D(filters=64, kernel_size=(7, 7),
input_shape=(18,344,315,1),
padding='same',activation=LeakyReLU(alpha=0.01), return_sequences=True))
model.add(BatchNormalization())
model.add(ConvLSTM2D(filters=64, kernel_size=(5, 5),
padding='same',activation=LeakyReLU(alpha=0.01), return_sequences=True))
model.add(BatchNormalization())
model.add(ConvLSTM2D(filters=64, kernel_size=(3, 3),
padding='same',activation=LeakyReLU(alpha=0.01), return_sequences=True))
model.add(BatchNormalization())
model.add(ConvLSTM2D(filters=64, kernel_size=(1, 1),
padding='same',activation=LeakyReLU(alpha=0.01), return_sequences=True))
model.add(Conv3D(filters=1, kernel_size=(3, 3, 3),
activation='sigmoid',
padding='same', data_format='channels_last'))
return model
model = create_model()
model.compile(loss='binary_crossentropy', optimizer='adadelta')
keras.utils.plot_model(model, to_file="model.png", show_dtype=True, show_layer_activations=True, show_shapes=True)
print(model.summary())
epochs = 25
batch_size = 1
#Fit the model
model.fit(
X_train,
y_train,
batch_size=batch_size,
epochs=epochs,
validation_data=(X_val, y_val),
verbose=1,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment