【问题标题】:Sigmoid scale and inverse with custom range带有自定义范围的 Sigmoid 比例和逆
【发布时间】:2019-03-29 01:20:14
【问题描述】:

我正在思考如何使用 Sigmoid 在自定义范围内缩放变量,然后逆向缩放。

例如,下面的 Python 脚本在 0 和顶部之间缩放变量 x,然后反转该缩放。

import math

# apply Sigmoid to x on scale between 0 and top:
def sigmoid(x, top):
    y = top / (1 + math.exp(-x))
    return y

# and to inverse:
def invSigmoid(y, top):
    x = np.log(y/(top-y))
    return x

我想做的是也设置底部,以便 x 在底部顶部之间缩放,例如(10-100)。然后也得到逆。

【问题讨论】:

    标签: math inverse sigmoid


    【解决方案1】:

    在我看来,你所追求的是:

    y = bottom + (top - bottom) / (1 + math.exp(-x))
    

    x = np.log((y - bottom) / (top - y))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-11-03
      • 1970-01-01
      • 2016-11-14
      • 1970-01-01
      • 2010-12-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多