python - 在 tensorflow 中自定义 Softmax 激活函数
问题描述
我在 tensorflow 中构建了一个神经网络,它应该可以预测事件发生的概率。因此,作为输出函数,我通过了 softmax。我尝试自定义 softmax 函数,使所有(三个)类的概率总和为 1.05,最小(最大)概率为 0.02(0.99)。到目前为止,我有以下代码,但我不确定这是否正确
def custom_activation(x):
return K.softmax(x)*(1 + 0.05)
有谁知道如何实现这个?
解决方案
推荐阅读
- javascript - django表单实时选择值字段
- php - 如何验证段落内的“文件”字段是否填写在drupal表单中?
- c# - 通过异常类型捕获没有实体数据库错误
- ruby - Ruby 解释器在 :key_down 上崩溃
- r - 多个 .txt 导入中的小数分隔符
- python-3.x - Python:在 Pandas 中按行计算
- git - 如何跟踪嵌套在未跟踪文件夹中的文件?
- string - Beckhoff - 从另一个查询的结果构建查询
- c# - 最新的 VS Mac 更新导致 Xamarin Android 中的 SetContentView(resourceid) 出现 SIGSEGV
- python - 在 Python 中直接从内存中保存多个对象以压缩