-
Notifications
You must be signed in to change notification settings - Fork 1
Keras Models
Peter Fackeldey edited this page Oct 26, 2017
·
2 revisions
The neural network models are stored in the KerasModels class in model.py. Until now they are initialized with the number of training features, number of classes and the learning rate. If you want to add a new model, just copy&paste:
def MSSM_HWW_model(self):
"""
First simple model
"""
model = Sequential()
model.add(Dense(128, init='glorot_normal',
activation='relu', input_dim=self.n_features))
model.add(Dropout(0.1))
model.add(Dense(32, activation='relu', input_dim=128))
model.add(Dropout(0.1))
model.add(Dense(self.n_classes, activation='softmax'))
# Compile the model:
model.compile(loss='categorical_crossentropy', optimizer=Adam(
lr=self.learning_rate), metrics=['accuracy'])
model.summary()
model.save("MSSM_HWW_model.h5")in the KerasModel class. Modify the general structure of the neural network (e.g.: number of layers), the loss, the optimizer and metrics for your analysis. Finally give the model a reasonable name, here: "MSSM_HWW_model.h5". The trained model is saved in the .h5 format. This allows to access the trained network later without running the full training step again.