text_plain_output_1.png
from keras.utils.np_utils import to_categorical

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

import tensorflow as tf

import tflearn

df_trn = pd.read_csv('../input/train.csv')
df_tst = pd.read_csv('../input/test.csv')
x_trn = df_trn.ix[:, 1:].values
y_trn = df_trn.ix[:, 0].values
y_trn_cat = to_categorical(y_trn)

tf.reset_default_graph()
net = tflearn.input_data([None, 784])
net = tflearn.fully_connected(net, 256, activation='ReLU')
net = tflearn.fully_connected(net, 128, activation='ReLU')
net = tflearn.fully_connected(net, 64, activation='ReLU')
net = tflearn.fully_connected(net, 10, activation='softmax')
net = tflearn.regression(net, optimizer='sgd', learning_rate=0.1, loss='categorical_crossentropy')
model = tflearn.DNN(net)

model.fit(x_trn, y_trn_cat, validation_set=0, show_metric=True, batch_size=1000, n_epoch=100)