Skip to content

minkowski_distance_interdependence

Bases: numerical_kernel_based_interdependence

A kernel-based interdependence class using a Minkowski distance kernel.

Notes

Minkowski Distance based Kernel:

\[
    \begin{equation}
    \text{kernel}(\mathbf{x}, \mathbf{y}) = 1- \left\| \mathbf{x} - \mathbf{y} \right\|_p.
    \end{equation}
\]

Attributes:

Name Type Description
kernel Callable

The Minkowski distance kernel function.

Methods:

Name Description
__init__

Initializes the Minkowski distance interdependence function.

Source code in tinybig/interdependence/numerical_kernel_interdependence.py
class minkowski_distance_interdependence(numerical_kernel_based_interdependence):
    r"""
        A kernel-based interdependence class using a Minkowski distance kernel.

        Notes
        ----------
        __Minkowski Distance based Kernel:__

        $$
            \begin{equation}
            \text{kernel}(\mathbf{x}, \mathbf{y}) = 1- \left\| \mathbf{x} - \mathbf{y} \right\|_p.
            \end{equation}
        $$

        Attributes
        ----------
        kernel : Callable
            The Minkowski distance kernel function.

        Methods
        -------
        __init__(...)
            Initializes the Minkowski distance interdependence function.
    """
    def __init__(self, p: Union[int, float, str, Any], name: str = 'minkowski_distance_interdependence', *args, **kwargs):
        """
            Initializes the Minkowski distance interdependence function.

            Parameters
            ----------
            p : Union[int, float, str, Any]
                The Minkowski distance parameter.
            name : str, optional
                Name of the interdependence function. Defaults to 'minkowski_distance_interdependence'.
            *args : tuple
                Additional positional arguments for the parent class.
            **kwargs : dict
                Additional keyword arguments for the parent class.
        """
        minkowski_kernel_func = functools.partial(minkowski_distance_kernel, p=p)
        super().__init__(kernel=minkowski_kernel_func, name=name, *args, **kwargs)

__init__(p, name='minkowski_distance_interdependence', *args, **kwargs)

Initializes the Minkowski distance interdependence function.

Parameters:

Name Type Description Default
p Union[int, float, str, Any]

The Minkowski distance parameter.

required
name str

Name of the interdependence function. Defaults to 'minkowski_distance_interdependence'.

'minkowski_distance_interdependence'
*args tuple

Additional positional arguments for the parent class.

()
**kwargs dict

Additional keyword arguments for the parent class.

{}
Source code in tinybig/interdependence/numerical_kernel_interdependence.py
def __init__(self, p: Union[int, float, str, Any], name: str = 'minkowski_distance_interdependence', *args, **kwargs):
    """
        Initializes the Minkowski distance interdependence function.

        Parameters
        ----------
        p : Union[int, float, str, Any]
            The Minkowski distance parameter.
        name : str, optional
            Name of the interdependence function. Defaults to 'minkowski_distance_interdependence'.
        *args : tuple
            Additional positional arguments for the parent class.
        **kwargs : dict
            Additional keyword arguments for the parent class.
    """
    minkowski_kernel_func = functools.partial(minkowski_distance_kernel, p=p)
    super().__init__(kernel=minkowski_kernel_func, name=name, *args, **kwargs)