Created
December 14, 2020 05:07
-
-
Save MoGaber/02438c69d92dc2018676c7352ffbc83f to your computer and use it in GitHub Desktop.
neural_network
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
from keras.models import Sequential | |
from keras.layers import Dense | |
from sklearn import datasets | |
from tensorflow import keras | |
# define the keras model | |
model = Sequential() | |
model.add(Dense(12, input_dim=12, activation='relu')) # 12 neurons and expecting 8 columns x | |
model.add(Dense(8, activation='relu'))#8 neurons with activation function rectified | |
model.add(Dense(8, activation='relu'))#8 neurons with activation function rectified | |
model.add(Dense(1, activation='sigmoid')) #1 neuron with sigmoid activation | |
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy']) | |
model.summary() | |
model.fit(x_train, y_train, epochs = 100) | |
model.evaluate(x_test, y_test, verbose = True)[1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment