Skip to content

openavmkit.synthetic.generate

exponential_decrease

exponential_decrease(d, alpha=5)

Exponential decrease: f(d) = exp(-alpha * d)

Parameters: d : normalized distance in [0, 1] alpha : decay constant (default 5)

Source code in openavmkit/synthetic/generate.py
817
818
819
820
821
822
823
824
825
826
def exponential_decrease(d, alpha=5):
    """
    Exponential decrease:
    f(d) = exp(-alpha * d)

    Parameters:
      d     : normalized distance in [0, 1]
      alpha : decay constant (default 5)
    """
    return math.exp(-alpha * d)

inverse_square_decrease

inverse_square_decrease(d)

Inverse-square-like decrease: f(d) = 1 / (1 + d^2) This avoids a singularity at d = 0 and decreases the value with the square of d.

Source code in openavmkit/synthetic/generate.py
808
809
810
811
812
813
814
def inverse_square_decrease(d):
    """
    Inverse-square-like decrease:
    f(d) = 1 / (1 + d^2)
    This avoids a singularity at d = 0 and decreases the value with the square of d.
    """
    return 1.0 / (1 + d**2)

linear_decrease

linear_decrease(d)

Linear decrease: f(d) = 1 - d for 0 <= d <= 1. Beyond d = 1, the value is 0.

Source code in openavmkit/synthetic/generate.py
800
801
802
803
804
805
def linear_decrease(d):
    """
    Linear decrease: f(d) = 1 - d for 0 <= d <= 1.
    Beyond d = 1, the value is 0.
    """
    return max(0.0, 1 - d)