目录
神经网络的起源:线性回归
什么是线性回归
线性回归是指用线性关系来描述输入到输出的映射关系。
线性回归的优化方法:梯度下降
梯度下降的步骤
梯度下降的总结
常见的非线性激励函数
Sigmoid函数
tahn函数
ReLU函数
神经网络的构建
tensorflow构建简单的神经网络
#get the mnist data
# wget http://deeplearning.net/data/mnist/mnist.pkl.gz
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets(".", one_hot=True)
import tensorflow as tf
# Parameters
learning_rate = 0.001
training_epochs = 30
batch_size = 100
display_step = 1
# Network Parameters
n_hidden_1 = 256 # 1st layer number of features
n_hidden_2 = 512 # 2nd layer number of features
n_input = 784 # MNIST data input (img shape: 28*28)
n_classes = 10 # MNIST total classes (0-9 digits)
# tf Graph input
x = tf.placeholder("float",