深度学习-学习笔记-1

本文深入讲解神经网络的基本结构,包括输入层、隐藏层和输出层,并详细解释神经网络如何通过大量数据样本进行训练。文中还介绍了激励函数的作用、梯度下降法及成本函数的概念,并通过实例说明了初始化权重矩阵对模型精度的影响。

神经网络

  • input layer
  • hidden layer
  • output layer

怎样被训练的?
需要很多数据样本进行训练,对比预测答案和真实答案的差别,改变模型一点点;

激励函数

梯度下降

这个个优化问题(optimization)
cost function,就是误差方程。
Cost = ( predicted - real) 2 = ( Wx - y ) 2

神经网络求得的局部最优解已足够优秀

  • 局部最优
  • 全局最优

卷积神经网络(tensorflow)

kernel/filter

初始化
在初始化共享权重矩阵(kernel/filter)时,一开始将stddev设置成了1(stddev=1),导致模型训练后的精度仍低至0.1;自己核对代码,将stddev调整至0.1后(stddev=0.1)后,训练后的模型精度就提高至0.99了。

def weight_variable(shape):
    initial = tf.truncated_normal(shape, stddev=0.1)
    return tf.Variable(initial)

tf.truncated_normal 截尾正态分布
Outputs random values from a truncated normal distribution.

The generated values follow a normal distribution with specified mean and standard deviation, except that values whose magnitude is more than 2 standard deviations from the mean are dropped and re-picked.

就是生成一个指定均值和标准差的正太分布,然后只截取均值左右两个标准差之内的值。

Args:
shape: A 1-D integer Tensor or Python array. The shape of the output tensor.
mean: A 0-D Tensor or Python value of type dtype. The mean of the truncated normal distribution.
stddev: A 0-D Tensor or Python value of type dtype. The standard deviation of the normal distribution, before truncation.
dtype: The type of the output.
seed: A Python integer. Used to create a random seed for the distribution. See tf.set_random_seed for behavior.
name: A name for the operation (optional).

Returns:
A tensor of the specified shape filled with random truncated normal values.

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值