Skip to content

Instantly share code, notes, and snippets.

@outtoin
Created June 21, 2017 12:33
Show Gist options
  • Save outtoin/4a732220eb5389fbdc2356353c29de68 to your computer and use it in GitHub Desktop.
Save outtoin/4a732220eb5389fbdc2356353c29de68 to your computer and use it in GitHub Desktop.
# with sigmoid function -> accuracy : 0.9108
W1 = tf.Variable(tf.random_normal([784, neurons]), name='weight1')
b1 = tf.Variable(tf.random_normal([neurons]), name='bias1')
logits1 = tf.matmul(X, W1) + b1
layer1 = tf.sigmoid(logits1)
W2 = tf.Variable(tf.random_normal([neurons, neurons]), name='weight2')
b2 = tf.Variable(tf.random_normal([neurons]), name='bias3')
logits2 = tf.matmul(layer1, W2) + b2
layer2 = tf.sigmoid(logits2)
W3 = tf.Variable(tf.random_normal([neurons, neurons]), name='weight3')
b3 = tf.Variable(tf.random_normal([neurons]), name='bias3')
logits3 = tf.matmul(layer2, W3) + b3
layer3 = tf.sigmoid(logits3)
W4 = tf.Variable(tf.random_normal([neurons, nb_classes]), name='weight4')
b4 = tf.Variable(tf.random_normal([nb_classes]), name='bias4')
logits4 = tf.matmul(layer3, W4) + b4
hypothesis = tf.nn.softmax(logits4)
# with softmax function -> accuracy : 0.488
W1 = tf.Variable(tf.random_normal([784, neurons]), name='weight1')
b1 = tf.Variable(tf.random_normal([neurons]), name='bias1')
logits1 = tf.matmul(X, W1) + b1
layer1 = tf.nn.softmax(logits1)
W2 = tf.Variable(tf.random_normal([neurons, neurons]), name='weight2')
b2 = tf.Variable(tf.random_normal([neurons]), name='bias3')
logits2 = tf.matmul(layer1, W2) + b2
layer2 = tf.nn.softmax(logits2)
W3 = tf.Variable(tf.random_normal([neurons, neurons]), name='weight3')
b3 = tf.Variable(tf.random_normal([neurons]), name='bias3')
logits3 = tf.matmul(layer2, W3) + b3
layer3 = tf.nn.softmax(logits3)
W4 = tf.Variable(tf.random_normal([neurons, nb_classes]), name='weight4')
b4 = tf.Variable(tf.random_normal([nb_classes]), name='bias4')
logits4 = tf.matmul(layer3, W4) + b4
hypothesis = tf.nn.softmax(logits4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment