Skip to content

Instantly share code, notes, and snippets.

@rish-16
Last active November 21, 2017 03:20
Show Gist options
  • Save rish-16/2d48bae2d6cfe645d23b9e7f0453dc31 to your computer and use it in GitHub Desktop.
Save rish-16/2d48bae2d6cfe645d23b9e7f0453dc31 to your computer and use it in GitHub Desktop.
import tflearn
from tflearn.layers.core import input_data, fully_connected
from tflearn.layers.estimator import regression
import tflearn.datasets.mnist as mnist
X_train, y_train, X_test, y_test = mnist.load_data(one_hot=True)
X_train = X_train.reshape([-1, 1])
X_test = X_test.reshape([-1, 1])
net = tflearn.input_data(shape=[None, 784])
net = tflearn.fully_connected(net, 500, activation='relu')
net = tflearn.fully_connected(net, 500, activation='relu')
net = tflearn.fully_connected(net, 10, activation='softmax')
net = tflearn.regression(net, optimizer='adam', loss='categorical_crossentropy')
model = tflearn.DNN(net)
model.fit(X_train, y_train)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment