What value should a step gate return exactly at its threshold?

heaviside returns zero for a negative input and one for a positive input. Its second argument defines the value at zero.

numpy.heaviside in practice

For threshold offsets minus one, zero and one, a half-weight boundary gives zero, one half and one. Set the tie value to match the intended decision rule.

import numpy as np
np.heaviside([-1,0,1],0.5)

Result [0.0, 0.5, 1.0]

中文

阶跃门控在恰好命中阈值时取什么值?

heaviside 对负输入返回零、正输入返回一,在输入为零时采用调用者提供的第二个参数。

numpy.heaviside 算例

离阈值差分别为 -1、0、1,选半权边界就得到 0、0.5、1。这个边界值是显式约定,应与系统的决策规则一致。

import numpy as np
np.heaviside([-1,0,1],0.5)

结果 [0.0, 0.5, 1.0]

References / 参考来源

Keep reading / 继续阅读