Last active
November 9, 2017 13:14
-
-
Save manashmandal/87ca96da6f19ee92f81079c41e4bfdf4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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, Activation | |
from sklearn.datasets import load_digits | |
# Loading digits | |
x, y = load_digits(n_class=10, return_X_y=True) | |
# Convert to categorical | |
yhot = keras.utils.to_categorical(y, num_classes=10) | |
input_size = 64 | |
hidden_input_size = 32 | |
output_size = 10 | |
model.add(Dense(units=hidden_input_size, input_dim=input_size)) | |
model.add(Activation('relu')) | |
model.add(Dense(units=output_size, input_dim=hidden_input_size)) | |
model.add(Activation('softmax')) | |
model.compile(optimizer='rmsprop', | |
loss='categorical_crossentropy', | |
metrics=['accuracy']) | |
model.fit(x, y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment