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) ...

Get Deep Learning Quick Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.