Putting it all together

Putting all that code together, all that's left is to compile our Keras model, specifying binary_crossentrophy as our loss function and accuracy as a metric we'd like to monitor through the training process. We will use the following code to compile our Keras model:

def build_network(input_features=None):
inputs = Input(shape=(input_features,), name="input")
x = Dense(128, activation='relu', name="hidden1")(inputs)
x = Dense(64, activation='relu', name="hidden2")(x)
x = Dense(64, activation='relu', name="hidden3")(x)
x = Dense(32, activation='relu', name="hidden4")(x)
x = Dense(16, activation='relu', name="hidden5")(x)
prediction = Dense(1, activation='sigmoid', name="final")(x)
model = Model(inputs=inputs, outputs=prediction)
model.compile(optimizer='adam', loss='binary_crossentropy',
metrics=["accuracy"])
return model
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.195.225