Commit e35890fa authored by mihaivanea's avatar mihaivanea
Browse files

Creating some models to test some functionalities of the Sequential class models

parent 91fc5291
#!/vol/bitbucket/mv1315/urop/venv/bin/python3.5
import numpy as np
from keras.models import Sequential
from keras.layers import Dense, Activation
from keras.utils import to_categorical
model = Sequential()
model.add(Dense(32, input_dim=(100)))
model.add(Activation('relu'))
model.add(Dense(10))
model.add(Activation('softmax'))
model.compile(optimizer='rmsprop',
loss='categorical_crossentropy',
metrics=['accuracy'])
# generate dummy data
data = np.random.random((1000, 100))
labels = np.random.randint(10, size=(1000,1))
# convert labels to categorical one-hot encoding
one_hot_labels = to_categorical(labels, num_classes=10)
# train the model: batches of 32 samples
model.fit(data, one_hot_labels, epochs=1000, batch_size=32)
print("DONE")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment