两个隐藏层,每个隐藏层256个神经元,784行输入,1个输出。
It is interesting the first time I train the model with the learning rate 0.01, the accuracy is 0.9721 !!!
Amazing !!!
However, with the same paremeters, the second is 0.8251. This phenomenon indicates that the result is various at most times. Moreover, appropriate learning rate is of great importance as well.
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 4 11:14:12 2020
@author: Melinda
"""
import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
learning_rate = 0.001
training_epoch = 25
batch_size = 10
display_step = 1
n_hidden_1 = 256
n_hidden_2 = 256
n_input = 784
n_classes = 10
x = tf.placeholder("float", [None, n_input])
y = tf.placeholder("float", [None, n_classes])
weights = {
'h1': tf.Variable(tf.random_normal([n_input, n_hidden_1