Skip to content

kl_divergence_interdependence

Bases: statistical_kernel_based_interdependence

A statistical kernel-based interdependence class using the KL divergence kernel.

Notes

KL Divergence based Kernel:

$$ \begin{equation} \text{kernel}(\mathbf{x}, \mathbf{y}) = \sum_i \mathbf{x}(i) \log \left(\frac{\mathbf{x}(i)}{\mathbf{y}(i)} \right), \end{equation} $$ where \(\mb{x}\) and \(\mb{y}\) have been normalized.

Attributes:

Name Type Description
kernel Callable

The KL divergence kernel function.

Methods:

Name Description
__init__

Initializes the KL divergence interdependence function.

Source code in tinybig/interdependence/statistical_kernel_interdependence.py
class kl_divergence_interdependence(statistical_kernel_based_interdependence):
    r"""
        A statistical kernel-based interdependence class using the KL divergence kernel.

        Notes
        ----------
        __KL Divergence based Kernel:__

        $$
            \begin{equation}
            \text{kernel}(\mathbf{x}, \mathbf{y}) = \sum_i \mathbf{x}(i) \log \left(\frac{\mathbf{x}(i)}{\mathbf{y}(i)} \right),
            \end{equation}
        $$
        where $\mb{x}$ and $\mb{y}$ have been normalized.

        Attributes
        ----------
        kernel : Callable
            The KL divergence kernel function.

        Methods
        -------
        __init__(...)
            Initializes the KL divergence interdependence function.
    """
    def __init__(self, name: str = 'kl_divergence_interdependence', *args, **kwargs):
        """
            Initializes the KL divergence interdependence function.

            Parameters
            ----------
            name : str, optional
                Name of the interdependence function. Defaults to 'kl_divergence_interdependence'.
            *args : tuple
                Additional positional arguments for the parent class.
            **kwargs : dict
                Additional keyword arguments for the parent class.
        """
        super().__init__(kernel=batch_kl_divergence_kernel, name=name, *args, **kwargs)

__init__(name='kl_divergence_interdependence', *args, **kwargs)

Initializes the KL divergence interdependence function.

Parameters:

Name Type Description Default
name str

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

'kl_divergence_interdependence'
*args tuple

Additional positional arguments for the parent class.

()
**kwargs dict

Additional keyword arguments for the parent class.

{}
Source code in tinybig/interdependence/statistical_kernel_interdependence.py
def __init__(self, name: str = 'kl_divergence_interdependence', *args, **kwargs):
    """
        Initializes the KL divergence interdependence function.

        Parameters
        ----------
        name : str, optional
            Name of the interdependence function. Defaults to 'kl_divergence_interdependence'.
        *args : tuple
            Additional positional arguments for the parent class.
        **kwargs : dict
            Additional keyword arguments for the parent class.
    """
    super().__init__(kernel=batch_kl_divergence_kernel, name=name, *args, **kwargs)