Skip to content

naive_exponential_probabilistic_compression

Bases: naive_probabilistic_compression

An Exponential probabilistic compression class.

This class samples features using an Exponential distribution with a specified rate (lambda).

Methods:

Name Description
__init__

Initializes the Exponential probabilistic compression function.

Parameters:

Name Type Description Default
name str

Name of the transformation. Defaults to 'naive_exponential_probabilistic_compression'.

'naive_exponential_probabilistic_compression'
rate float

Rate parameter (lambda) of the Exponential distribution. Defaults to 0.5.

0.5
require_normalization bool

If True, normalizes the input tensor before sampling. Defaults to True.

True
Source code in tinybig/compression/probabilistic_compression.py
class naive_exponential_probabilistic_compression(naive_probabilistic_compression):
    """
        An Exponential probabilistic compression class.

        This class samples features using an Exponential distribution with a specified rate (lambda).

        Methods
        -------
        __init__(name='naive_exponential_probabilistic_compression', rate=0.5, require_normalization=True, ...)
            Initializes the Exponential probabilistic compression function.

        Parameters
        ----------
        name : str, optional
            Name of the transformation. Defaults to 'naive_exponential_probabilistic_compression'.
        rate : float, optional
            Rate parameter (lambda) of the Exponential distribution. Defaults to 0.5.
        require_normalization : bool, optional
            If True, normalizes the input tensor before sampling. Defaults to True.
    """
    def __init__(self, name: str = 'naive_exponential_probabilistic_compression', rate: float = 0.5, require_normalization: bool = True,  *args, **kwargs):
        """
            Initializes the Exponential probabilistic compression function.

            Parameters
            ----------
            name : str, optional
                Name of the transformation. Defaults to 'naive_exponential_probabilistic_compression'.
            rate : float, optional
                Rate parameter (lambda) of the Exponential distribution. Defaults to 0.5.
            require_normalization : bool, optional
                If True, normalizes the input tensor before sampling. Defaults to True.
        """
        distribution_function = torch.distributions.exponential.Exponential(rate=torch.tensor([rate]))
        super().__init__(name=name, distribution_function=distribution_function, require_normalization=True,  *args, **kwargs)

__init__(name='naive_exponential_probabilistic_compression', rate=0.5, require_normalization=True, *args, **kwargs)

Initializes the Exponential probabilistic compression function.

Parameters:

Name Type Description Default
name str

Name of the transformation. Defaults to 'naive_exponential_probabilistic_compression'.

'naive_exponential_probabilistic_compression'
rate float

Rate parameter (lambda) of the Exponential distribution. Defaults to 0.5.

0.5
require_normalization bool

If True, normalizes the input tensor before sampling. Defaults to True.

True
Source code in tinybig/compression/probabilistic_compression.py
def __init__(self, name: str = 'naive_exponential_probabilistic_compression', rate: float = 0.5, require_normalization: bool = True,  *args, **kwargs):
    """
        Initializes the Exponential probabilistic compression function.

        Parameters
        ----------
        name : str, optional
            Name of the transformation. Defaults to 'naive_exponential_probabilistic_compression'.
        rate : float, optional
            Rate parameter (lambda) of the Exponential distribution. Defaults to 0.5.
        require_normalization : bool, optional
            If True, normalizes the input tensor before sampling. Defaults to True.
    """
    distribution_function = torch.distributions.exponential.Exponential(rate=torch.tensor([rate]))
    super().__init__(name=name, distribution_function=distribution_function, require_normalization=True,  *args, **kwargs)