-
-
Save sgsg704/ac9940710558d7f408cd3b34e26abfc8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
early_stopping = callbacks.EarlyStopping( | |
min_delta=0.001, # minimium amount of change to count as an improvement | |
patience=20, # how many epochs to wait before stopping | |
restore_best_weights=True, | |
) | |
# Initialising the NN | |
model = Sequential() | |
# layers | |
model.add(Dense(units = 32, kernel_initializer = 'uniform', activation = 'relu', input_dim = 26)) | |
model.add(Dense(units = 32, kernel_initializer = 'uniform', activation = 'relu')) | |
model.add(Dense(units = 16, kernel_initializer = 'uniform', activation = 'relu')) | |
model.add(Dropout(0.25)) | |
model.add(Dense(units = 8, kernel_initializer = 'uniform', activation = 'relu')) | |
model.add(Dropout(0.5)) | |
model.add(Dense(units = 1, kernel_initializer = 'uniform', activation = 'sigmoid')) | |
# Compiling the ANN | |
opt = Adam(learning_rate=0.00009) | |
model.compile(optimizer = opt, loss = 'binary_crossentropy', metrics = ['accuracy']) | |
# Train the ANN | |
history = model.fit(X_train, y_train, batch_size = 32, epochs = 150, callbacks=[early_stopping], validation_split=0.2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment