Skip to content

Instantly share code, notes, and snippets.

@CVxTz
Created February 15, 2020 18:16
Show Gist options
  • Save CVxTz/532a48fbdd3fad7a47ccacab8851d27d to your computer and use it in GitHub Desktop.
Save CVxTz/532a48fbdd3fad7a47ccacab8851d27d to your computer and use it in GitHub Desktop.
def get_model(n_class=5):
inp = Input(shape=(187, 1))
x = Convolution1D(64, kernel_size=5, activation=activations.relu, padding="valid")(
inp
)
x = MaxPool1D(pool_size=4)(x)
x = Convolution1D(64, kernel_size=3, activation=activations.relu, padding="valid")(
x
)
x = MaxPool1D(pool_size=4)(x)
x = GlobalMaxPool1D()(x)
x = Dense(64, activation=activations.relu)(x)
x = Dense(n_class, activation=activations.softmax)(x)
model = models.Model(inputs=inp, outputs=x)
opt = optimizers.Adam(0.0001)
model.compile(optimizer=opt, loss=losses.categorical_crossentropy, metrics=["acc"])
model.summary()
return model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment