Skip to content

IntExponential

src.geostat.kernel.IntExponential

Bases: Kernel

Integrated Exponential (IntExponential) kernel class for Gaussian Processes (GPs).

The IntExponential class defines a kernel that integrates the Exponential kernel along a specified axis. This kernel is useful for modeling processes with exponential decay along one dimension, starting from a given point.

Parameters:

  • axis (int) –

    The axis along which the integration is performed (e.g., 0 for x-axis, 1 for y-axis).

  • start (float) –

    The starting point of the integration along the specified axis.

  • range (float or Variable) –

    The length scale parameter that controls how quickly the covariance decreases with distance.

Examples:

Creating and using an IntExponential kernel:

from geostat.kernel import IntExponential

# Create an IntExponential kernel integrating along the x-axis starting from 0.0 with a range of 2.0
int_exp_kernel = IntExponential(axis=0, start=0.0, range=2.0)

locs1 = np.array([[0.0], [1.0], [2.0]])
locs2 = np.array([[0.0], [1.0], [2.0]])
covariance_matrix = int_exp_kernel({'locs1': locs1, 'locs2': locs2, 'range': 2.0})

Notes:

  • The call method computes the integrated exponential covariance matrix based on the specified axis, starting point, and range.
  • The vars method returns the parameter dictionary for range using the ppp function.
  • The IntExponential kernel is suitable for modeling processes with exponential decay along one dimension with integrated covariance structures.
Source code in src/geostat/kernel.py
class IntExponential(Kernel):
    """
    Integrated Exponential (IntExponential) kernel class for Gaussian Processes (GPs).

    The `IntExponential` class defines a kernel that integrates the Exponential kernel
    along a specified axis. This kernel is useful for modeling processes with exponential 
    decay along one dimension, starting from a given point.

    Parameters:
        axis (int):
            The axis along which the integration is performed (e.g., 0 for x-axis, 1 for y-axis).
        start (float):
            The starting point of the integration along the specified axis.
        range (float or tf.Variable):
            The length scale parameter that controls how quickly the covariance decreases with distance.

    Examples:
        Creating and using an `IntExponential` kernel:

        ```python
        from geostat.kernel import IntExponential

        # Create an IntExponential kernel integrating along the x-axis starting from 0.0 with a range of 2.0
        int_exp_kernel = IntExponential(axis=0, start=0.0, range=2.0)

        locs1 = np.array([[0.0], [1.0], [2.0]])
        locs2 = np.array([[0.0], [1.0], [2.0]])
        covariance_matrix = int_exp_kernel({'locs1': locs1, 'locs2': locs2, 'range': 2.0})
        ```

    Examples: Notes:
        - The `call` method computes the integrated exponential covariance matrix based on the 
            specified axis, starting point, and range.
        - The `vars` method returns the parameter dictionary for `range` using the `ppp` function.
        - The `IntExponential` kernel is suitable for modeling processes with exponential decay 
            along one dimension with integrated covariance structures.
    """

    def __init__(self, axis, start, range):

        self.axis = axis
        self.start = start

        # Include the element of scale corresponding to the axis of
        # integration as an explicit formal argument.
        fa = dict(range=range)

        super().__init__(fa, dict(locs1='locs1', locs2='locs2'))

    def vars(self):
        return ppp(self.fa['range'])

    def call(self, e):
        x1 = tf.pad(e['locs1'][..., self.axis] - self.start, [[1, 0]])
        x2 = tf.pad(e['locs2'][..., self.axis] - self.start, [[1, 0]])

        r = e['range']
        sdiff = tf.abs(ed(x1, 1) - ed(x2, 0)) / r
        k = -tf.square(r) * (sdiff + tf.exp(-sdiff))
        k -= k[0:1, :]
        k -= k[:, 0:1]
        k = k[1:, 1:]
        k = tf.maximum(0., k)

        return k