Skip to content

Instantly share code, notes, and snippets.

@L-Lewis
Last active October 2, 2019 12:13
Show Gist options
  • Save L-Lewis/8ced87ef8742cec921759d4d7348b2a5 to your computer and use it in GitHub Desktop.
Save L-Lewis/8ced87ef8742cec921759d4d7348b2a5 to your computer and use it in GitHub Desktop.
from keras.models import Sequential
from keras.layers.core import Dense
def create_mlp(dim, regularizer=None):
"""Creates a simple two-layer MLP with inputs of the given dimension"""
model = Sequential()
model.add(Dense(8, input_dim=dim, activation="relu", kernel_regularizer=regularizer))
model.add(Dense(4, activation="relu", kernel_regularizer=regularizer))
return model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment