Last active
June 17, 2019 10:37
-
-
Save KhyatiMahendru/312a6d0f2cfe03e9f0f3964bf2e54460 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
# importing requirements | |
from keras.layers import Dense | |
from keras.models import Sequential | |
from keras.optimizers import adam | |
# alpha = 0.001 as given in the lr parameter in adam() optimizer | |
# build the model | |
model_alpha1 = Sequential() | |
model_alpha1.add(Dense(50, input_dim=2, activation='relu')) | |
model_alpha1.add(Dense(3, activation='softmax')) | |
# compile the model | |
opt_alpha1 = adam(lr=0.001) | |
model_alpha1.compile(loss='categorical_crossentropy', optimizer=opt_alpha1, metrics=['accuracy']) | |
# fit the model | |
# dummy_Y is the one-hot encoded | |
# history_alpha1 is used to score the validation and accuracy scores for plotting | |
history_alpha1 = model_alpha1.fit(dataX, dummy_Y, validation_data=(dataX, dummy_Y), epochs=200, verbose=0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment