首页 > 其他 > 详细

Keras学习笔记。

时间:2019-03-09 19:25:02      阅读:176      评论:0      收藏:0      [点我收藏+]

1. keras.layers.Dense

(Fully Connected Neural NetWork),所实现的运算是output = activation(dot(input, kernel)+bias)

keras.layers.Dense(units,               // 该层的neuron的个数
           activation=None,          // 该层的激活函数。如果不指定该参数,将不会使用任何激活函数(即使用线性激活函数:a(x)=x)
           use_bias=True,            // 是否添加偏置项
           kernel_initializer=‘glorot_uniform‘,    // 权重初始化方法
           bias_initializer=‘zeros‘,         // 偏置值初始化方法
           kernel_regularizer=None,         // 权重正则化方化
           bias_regularizer=None,          // 偏置值正则化方法
           activity_regularizer=None,      // Output的正则化方法
           kernel_constraint=None,         // 权重变化限制函数
           bias_constraint=None)         // 偏置值变化限制函数

除了input layer须指定input_dim之外,所有hidden layer和ouput layer的input_dim默认都是上一层的output_dim。

 

在keras中,数据是以张量的形式表示的,张量的形状称之为shape,表示从最外层向量逐步到达最底层向量的降维解包过程。比如,一个一阶的张量[1,2,3]的shape是(3,);一个二阶的张量[[1,2,3],[4,5,6]]的shape是(2,3);一个三阶的张量[[[1],[2],[3]],[[4],[5],[6]]]的shape是(2,3,1)。

input_shape就是指输入张量的shape。例如,input_dim=784,说明输入是一个784维的向量,这相当于一个一阶的张量,它的shape就是(784,)。因此,input_shape=(784,)。

input_dim = input_shape(input_dim,)

input_dim, input_length = input_shape(input_length, input_dim)

 

REFERENCE:

https://blog.csdn.net/weixin_42499236/article/details/84624195

https://blog.csdn.net/gjq246/article/details/72638343/

https://blog.csdn.net/x_ym/article/details/77728732

https://www.cnblogs.com/yqtm/p/6924939.html

Keras学习笔记。

原文:https://www.cnblogs.com/boceng/p/10502562.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!