Skip to content

Instantly share code, notes, and snippets.

@ahmadmustafaanis
Created August 17, 2020 01:28
Show Gist options
  • Save ahmadmustafaanis/9589fe42183ab37ef5167c6497978fcd to your computer and use it in GitHub Desktop.
Save ahmadmustafaanis/9589fe42183ab37ef5167c6497978fcd to your computer and use it in GitHub Desktop.
model2 = Sequential([
Dense(512, activation='tanh', input_shape = X_train[0].shape, kernel_regularizer='l1'), #Only change is here where we add kernel_regularizer
Dense(512//2, activation='tanh'),
Dense(512//4, activation='tanh'),
Dense(512//8, activation='tanh'),
Dense(32, activation='relu'),
Dense(3, activation='softmax')
])
model2.compile(optimizer='sgd',loss='categorical_crossentropy', metrics=['acc', 'mse'])
hist2 = model2.fit(X_train, y_train, epochs=350, batch_size=128, validation_data=(X_test,y_test))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment