Sigmoid Bell

class pumas.desirability.sigmoid_bell.SigmoidBell(params: Dict[str, Any] | None = None)[source]
compute_numeric(x: float) float[source]

Compute the sigmoid bell desirability for a numeric input.

Parameters:

x (float) – The input value.

Returns:

The computed desirability value.

Return type:

float

Raises:
  • InvalidParameterTypeError – If the input is not a float.

  • ParameterValueNotSet – If any required parameter is not set.

compute_ufloat(x: AffineScalarFunc) AffineScalarFunc[source]

Compute the sigmoid bell desirability for an uncertain float input.

Parameters:

x (UFloat) – The uncertain float input value.

Returns:

The computed desirability value with uncertainty.

Return type:

UFloat

Raises:
  • InvalidParameterTypeError – If the input is not a UFloat.

  • ParameterValueNotSet – If any required parameter is not set.

name: ClassVar[str] = 'sigmoid_bell'

Sigmoid Bell desirability function implementation.

This class implements a sigmoid bell desirability function with adjustable parameters. It provides methods to compute the desirability for both numeric and uncertain float inputs.

Mathematical Definition: The sigmoid bell function is defined as the difference of two sigmoid functions:

\[D(x) = S_1(x) - S_2(x)\]

where:

\[ \begin{align}\begin{aligned}S_1(x) = \frac{1}{1 + base^{-k \cdot (x - x_1)/(x_2 - x_1)}}\\S_2(x) = \frac{1}{1 + base^{-k \cdot (x - x_3)/(x_4 - x_3)}}\end{aligned}\end{align} \]

If invert is True, the function becomes:

\[D_{inverted}(x) = 1 - D(x)\]

Finally, the shift is applied:

\[D_{final}(x) = D(x) \cdot (1 - shift) + shift\]
Parameters:

params (Optional[Dict[str, Any]]) – Initial parameters for the sigmoid bell function.

x1, x2, x3, x4

Shape parameters defining the bell curve.

Type:

float

k

Slope coefficient, range [1.0, inf), default 1.0.

Type:

float

base

Base of the exponential function, range (1.0, 10.0], default 10.0.

Type:

float

invert

Whether to invert the result, default False.

Type:

bool

shift

Vertical shift of the curve, range [0.0, 1.0], default 0.0.

Type:

float

Raises:
  • InvalidBoundaryError – If shape parameters are invalid or base <= 1.

  • InvalidParameterTypeError – If any parameter is of an invalid type.

  • ParameterValueNotSet – If any required parameter is not set.

Usage Example:

>>> from pumas.desirability import desirability_catalogue
>>> desirability_class = desirability_catalogue.get("sigmoid_bell")
>>> params = {"x1": 20.0, "x4": 80.0, "x2": 45.0, "x3": 60.0, "k": 1.0, "base": 10.0, "invert": False, "shift": 0.0}
>>> desirability = desirability_class(params=params)
>>> print(desirability.get_parameters_values())
{'x1': 20.0, 'x2': 45.0, 'x3': 60.0, 'x4': 80.0, 'k': 1.0, 'base': 10.0, 'invert': False, 'shift': 0.0}
>>> result = desirability.compute_numeric(x=50.0)
>>> print(f"{result:.2f}")
1.00
>>> result = desirability(x=50.0) # Same as compute_numeric
>>> print(f"{result:.2f}")
1.00
>>> from uncertainties import ufloat
>>> result = desirability.compute_ufloat(x=ufloat(50.0, 20.0))
>>> print(result)
0.9999999+/-0.0000018
class pumas.desirability.sigmoid_bell.sigmoid_bell(x: float | ~uncertainties.core.AffineScalarFunc, x1: float, x2: float, x3: float, x4: float, k: float = 1.0, base: float = 10.0, invert: bool = False, shift: float = 0.0, math_module: ~types.ModuleType = <module 'math' from '/home/docs/.asdf/installs/python/3.12.10/lib/python3.12/lib-dynload/math.cpython-312-x86_64-linux-gnu.so'>)[source]

Calculate the sigmoid bell function value for a given input.

This function combines two sigmoid functions to create a bell-shaped curve.

Parameters:
  • x (Union[float, UFloat]) – The input value.

  • x1 (float) – Shape parameters defining the bell curve.

  • x2 (float) – Shape parameters defining the bell curve.

  • x3 (float) – Shape parameters defining the bell curve.

  • x4 (float) – Shape parameters defining the bell curve.

  • k (float) – Slope coefficient. Default is 1.0.

  • base (float) – Base of the exponential function. Default is 10.0.

  • invert (bool) – Whether to invert the result. Default is False.

  • shift (float) – Vertical shift of the curve. Default is 0.0.

  • math_module (ModuleType) – Math module to use. Default is math.

Returns:

The calculated sigmoid bell value.

Return type:

Union[float, UFloat]

Raises:

InvalidBoundaryError – If shape parameters are invalid or base <= 1.

Parameter Analysis

(Source code, png, hires.png, pdf)

../../_images/sigmoid_bell-1.png