application_vnd.jupyter.stderr_output_1.png
from keras.layers import Dense, Activation, Dropout

from keras.models import Sequential

from keras.optimizers import RMSprop

from keras.utils.np_utils import to_categorical

from sklearn.cross_validation import train_test_split

import numpy as np # linear algebra

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

training_data = pd.read_csv('../input/fashion-mnist_train.csv')
testing_data = pd.read_csv('../input/fashion-mnist_test.csv')

X = np.array(training_data.iloc[:, 1:])
y = to_categorical(np.array(training_data.iloc[:, 0]))
X_train, X_validate, y_train, y_validate = train_test_split(X, y)

model = Sequential()
model.add(Dense(400, input_dim=784, activation='relu'))
model.add(Dropout(0.4))
model.add(Dense(200, activation='relu'))
model.add(Dropout(0.3))
model.add(Dense(300, activation='sigmoid'))
model.add(Dropout(0.2))
model.add(Dense(10, activation='softmax'))
model.compile(optimizer=RMSprop(), loss='categorical_crossentropy', metrics=['accuracy'])

epochs = 50
batch_size = 128
model.fit(X_train, y_train, batch_size=batch_size, epochs=epochs, verbose=1)
score = model.evaluate(X_validate, y_validate, batch_size=32)

model2 = Sequential()
model2.add(Dense(400, input_dim=784, activation='relu'))
model.add(Dropout(0.4))
model2.add(Dense(200, activation='relu'))
model.add(Dropout(0.3))
model2.add(Dense(100, activation='relu'))
model.add(Dropout(0.2))
model2.add(Dense(50, activation='relu'))
model2.add(Dense(10, activation='softmax'))
model2.compile(optimizer=RMSprop(), loss='categorical_crossentropy', metrics=['accuracy'])

epochs = 20
batch_size = 128
model2.fit(X_train, y_train, batch_size=batch_size, epochs=epochs, verbose=1)
score = model2.evaluate(X_validate, y_validate, batch_size=32)

model3 = Sequential()
model3.add(Dense(400, input_dim=784, activation='relu'))
model.add(Dropout(0.4))
model3.add(Dense(200, activation='sigmoid'))
model.add(Dropout(0.3))
model3.add(Dense(100, activation='sigmoid'))
model.add(Dropout(0.2))
model3.add(Dense(50, activation='sigmoid'))
model3.add(Dense(10, activation='softmax'))
model3.compile(optimizer=RMSprop(), loss='categorical_crossentropy', metrics=['accuracy'])

epochs = 20
batch_size = 128
model3.fit(X_train, y_train, batch_size=batch_size, epochs=epochs, verbose=1)
score = model3.evaluate(X_validate, y_validate, batch_size=32)

X_test = np.array(testing_data.iloc[:, 1:])
y_test = to_categorical(np.array(testing_data.iloc[:, 0]))

score3 = model3.evaluate(X_test, y_test, batch_size=32)
print("Network three's test score [loss, accuracy]: {0}".format(score3))