【问题标题】:The right way to calculate the derivative of sigmoid function in PythonPython中计算sigmoid函数导数的正确方法
【发布时间】:2018-06-06 12:54:37
【问题描述】:

我正在穿过this article。在代码中,作者提到以下函数求导数:

# convert output of sigmoid function to its derivative
def sigmoid_output_to_derivative(output):
    return output*(1-output)

我真的无法理解如何在这里找到衍生物。使用SymPy 查找导数会是更好的选择吗?在文章中显示的示例中我该怎么做,尤其是output将是一个类似于以下的列表:

[[ 0.44856632  0.51939863  0.45968497  0.59156505]
 [ 0.28639589  0.32350963  0.31236398  0.51538526]
 [ 0.40795614  0.62674606  0.23841622  0.49377636]
 [ 0.25371248  0.42628115  0.14321233  0.41732254]]

所以,底线是:

  • 原始文章中的导数是如何计算的?代码里的公式我看懂了,有没有理论依据?
  • 我们可以用另一种方法来求导数吗?也许有更清晰的方法?

谢谢。

【问题讨论】:

    标签: python math sympy derivative sigmoid


    【解决方案1】:

    sigmoid 函数之所以有用主要是因为它的导数很容易根据其输出计算;导数是f(x)*(1-f(x))

    因此,没有必要使用基于 sigmoid 函数的库来查找导数,因为数学导数(上图)是已知的。推导见this

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-05
      • 2017-10-08
      • 1970-01-01
      • 1970-01-01
      • 2015-07-19
      • 2017-11-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多