hbmep.functional#

hbmep.functional.rectified_logistic(x, a, b, g, h, v, eps: float = 0.0)[source]#

Rectified-logistic function.

\[\mathcal{f}\left(x; a, b, g, h, v\right) \;=\; g \;+\; \max\left\{0, \;-v + \frac{h + v}{1 + \left(\frac{h}{v}\right)e^{-b\left(x-a\right)}} \right\}\]

If eps > 0, replace the outer \(\max(0,\cdot)\) with a smooth maximum \(\text{smoothmax}(\cdot,\varepsilon)\) with bandwidth \(\varepsilon\), given by

\[\text{smoothmax}(t; \varepsilon) \;=\; t \;+\; \frac{\varepsilon}{\ln 2}\cdot \ln\left(1 + e^{-(t\ln 2)/\varepsilon}\right)\]
Parameters:
  • x (Array) – Input.

  • a (Array or float) – Threshold parameter.

  • b (Array or float) – Controls growth rate.

  • g (Array or float) – Lower offset, or baseline.

  • h (Array or float) – Vertical distance to upper asymptote from offset. Upper asymptote is \(g+h\).

  • v (Array or float) – Controls the location of inflection point.

  • eps (float, optional) – If eps > 0, use smooth maximum for the rectifier with bandwidth \(\varepsilon\); default to 0 (hard ReLU).

Returns:

\(f(x; a,b,g,h,v)\).

Return type:

Array

Notes

  • With eps = 0 the function is non-differentiable at \(x=a\); with eps > 0 it is everywhere smooth.

  • This is equivalent to applying a rectifier to a shifted and scaled logistic function.

hbmep.functional.logistic5(x, a, b, g, h, v)[source]#

Logistic-5 function.

\[f(x; a, b, g, h, v) \;=\; g \;+\; \frac{h}{\left\{1 + \left(2^v - 1\right)e^{-b\left(x-a\right)}\right\}^{\frac1{v}}}\]
Parameters:
  • x (Array or float) – Input.

  • a (Array or float) – \(\text{S}_{50}\) parameter.

  • b (Array or float) – Controls growth rate.

  • g (Array or float) – Lower offset, or baseline.

  • h (Array or float) – Vertical distance to upper asymptote from offset. Upper asymptote is \(g+h\).

  • v (Array or float) – Controls asymmetry. \(v=1\) reduces to the 4-parameter logistic.

Returns:

\(f(x; a,b,g,h,v)\).

Return type:

Array

hbmep.functional.logistic4(x, a, b, g, h)[source]#

Logistic-4 (4-parameter logistic).

\[f(x; a, b, g, h) \;=\; g \;+\; \frac{h}{1 + e^{-b\left(x-a\right)}}\]
Parameters:
  • x (Array or float) – Input.

  • a (Array or float) – \(\text{S}_{50}\) parameter (inflection occurs at \(x=a\)).

  • b (Array or float) – Controls growth rate.

  • g (Array or float) – Lower offset, or baseline.

  • h (Array or float) – Vertical distance to upper asymptote from offset. Upper asymptote is \(g+h\).

Returns:

\(f(x; a,b,g,h)\).

Return type:

Array

hbmep.functional.rectified_linear(x, a, b, g)[source]#

Rectified-linear function.

\[f(x; a,b,g) \;=\; g \;+\; \max\left\{0,\; b\left(x - a\right)\right\}\]

If eps > 0, replace the outer \(\max(0,\cdot)\) with a smooth maximum \(\text{smoothmax}(\cdot,\varepsilon)\) with bandwidth \(\varepsilon\), given by

\[\text{smoothmax}(t; \varepsilon) \;=\; t \;+\; \frac{\varepsilon}{\ln 2}\cdot \ln\left(1 + e^{-(t\ln 2)/\varepsilon}\right)\]
Parameters:
  • x (Array or float) – Input.

  • a (Array or float) – Threshold parameter.

  • b (Array or float) – Controls growth rate.

  • g (Array or float) – Lower offset, or baseline.

  • eps (float, optional) – If > 0, use smooth maximum for the rectifier with bandwidth \(\varepsilon\); default 0.0 (hard ReLU).

Returns:

\(f(x; a,b,g)\).

Return type:

Array

Notes

  • With eps = 0 the function is non-differentiable at \(x=a\); with eps > 0 it is everywhere smooth.