Skip to content

Wiener

src.geostat.kernel.Wiener

Bases: Kernel

Wiener kernel class for Gaussian Processes (GPs).

The Wiener class defines a kernel that represents a Wiener process (or Brownian motion) in one dimension. It models the covariance based on the minimum distance along a specified axis of integration, starting from a given point.

Parameters:

  • axis (int) –

    The axis along which the Wiener process operates (e.g., 0 for x-axis, 1 for y-axis).

  • start (float) –

    The starting point of the Wiener process along the specified axis.

Examples:

Creating and using a Wiener kernel:

from geostat.kernel import Wiener

# Create a Wiener kernel operating along the x-axis starting from 0.0
wiener_kernel = Wiener(axis=0, start=0.0)

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

Notes:

  • The call method computes the covariance matrix using the Wiener process formula, which is based on the minimum distance along the specified axis from the start point.
  • The vars method returns an empty dictionary since the Wiener kernel does not have tunable parameters.
  • The Wiener kernel is suitable for modeling processes that evolve with time or any other ordered dimension, representing a type of random walk or Brownian motion.
Source code in src/geostat/kernel.py
class Wiener(Kernel):
    """
    Wiener kernel class for Gaussian Processes (GPs).

    The `Wiener` class defines a kernel that represents a Wiener process (or Brownian motion) in one dimension.
    It models the covariance based on the minimum distance along a specified axis of integration, starting 
    from a given point.

    Parameters:
        axis (int):
            The axis along which the Wiener process operates (e.g., 0 for x-axis, 1 for y-axis).
        start (float):
            The starting point of the Wiener process along the specified axis.

    Examples:
        Creating and using a `Wiener` kernel:

        ```python
        from geostat.kernel import Wiener

        # Create a Wiener kernel operating along the x-axis starting from 0.0
        wiener_kernel = Wiener(axis=0, start=0.0)

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

    Examples: Notes:
        - The `call` method computes the covariance matrix using the Wiener process formula, which is based 
            on the minimum distance along the specified `axis` from the `start` point.
        - The `vars` method returns an empty dictionary since the Wiener kernel does not have tunable parameters.
        - The `Wiener` kernel is suitable for modeling processes that evolve with time or any other 
            ordered dimension, representing a type of random walk or Brownian motion.
    """

    def __init__(self, axis, start):

        self.axis = axis
        self.start = start

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

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

    def vars(self):
        return {}

    def call(self, e):
        x1 = e['locs1'][..., self.axis]
        x2 = e['locs2'][..., self.axis]
        k = tf.maximum(0., tf.minimum(ed(x1, 1), ed(x2, 0)) - self.start)
        return k