DL4J中文文档/模型/激活

什么是激活?

在一个简单的层次上,激活函数有助于决定神经元是否应该被激活。这有助于确定神经元接收的信息是否与输入相关。激活函数是在输入信号上发生的非线性变换,并且变换后的输出被发送到下一个神经元。

用法

使用激活的推荐方法是在你的神经网络中添加激活层,并配置所需的激活:

GraphBuilder graphBuilder = new NeuralNetConfiguration.Builder()
	// 添加超参数和其他层
	.addLayer("softmax", new ActivationLayer(Activation.SOFTMAX), "previous_input")
	// 添加更多的层和输出
	.build();

可用的激活


ActivationSoftSign

[源码]


f_i(x) = x_i / (1+x_i)


ActivationCube



[源码]

f(x) = x^3


ActivationRectifiedTanh

[源码]

整流正切

本质上是  max(0, tanh(x))

底层实现是在本地代码中


ActivationThresholdedReLU

[源码]

门槛的 RELU

f(x) = x for x > theta, f(x) = 0 otherwise. theta defaults to 1.0


ActivationIdentity

[源码]

f(x) = x


ActivationReLU6

[源码]

f(x) = min(max(input, cutoff), 6)


ActivationPReLU

[源码]

参数化整流线性单元 (PReLU)

f(x) = alpha x 对于 x < 0, f(x) = x 对于 x >= 0

Alpha的形状与X相同,是一个学习得来的参数。


ActivationSoftmax

[源码]

f_i(x) = exp(x_i - shift) / sum_j exp(x_j - shift) where shift = max_i(x_i)


ActivationSwish

[源码]

f(x) = x sigmoid(x)


ActivationTanH

[源码]

f(x) = (exp(x) - exp(-x)) / (exp(x) + exp(-x))


ActivationSoftPlus

[源码]

f(x) = log(1+e^x)


ActivationHardSigmoid

[源码]

f(x) = min(1, max(0, 0.2x + 0.5))


ActivationRReLU

[源码]

f(x) = max(0,x) + alpha min(0, x)

alpha在训练期间从uniform(l,u)中提取,在测试L中被设为 l+u/2,I和U默认为1/8和1/3。

卷积网络中整流激活的经验评估


ActivationReLU

[源码]

f(x) = max(0, x)


ActivationHardTanH

[源码]

⎧ 1, if x > 1 f(x) = ⎨ -1, if x < -1 ⎩ x, otherwise


ActivationRationalTanh

[源码]

来自 https://arxiv.org/pdf/1508.01292v3 理性正切近似

f(x) = 1.7159 tanh(2x/3) 正切是如下近似 tanh(y) ~ sgn(y) { 1 - 1/(1+|y|+y^2+1.41645y^4)}

底层实现是在本地代码中


ActivationSELU

[源码]

https://arxiv.org/pdf/1706.02515.pdf


ActivationELU

[源码]

f(x) = alpha (exp(x) - 1.0); x < 0 = x ; x>= 0

如果没有指定 alpha 默认为 1


ActivationSigmoid

[源码]

f(x) = 1 / (1 + exp(-x))


ActivationLReLU

[源码]

Leaky RELU f(x) = max(0, x) + alpha min(0, x) alpha 默认为 0.01

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值