Skip to content

naive_normal_probabilistic_compression

Bases: naive_probabilistic_compression

A normal probabilistic compression class.

This class samples features using a normal distribution with a specified mean and standard deviation.

Methods:

Name Description
__init__

Initializes the normal probabilistic compression function.

Parameters:

Name Type Description Default
name str

Name of the transformation. Defaults to 'naive_normal_probabilistic_compression'.

'naive_normal_probabilistic_compression'
mean float

Mean of the normal distribution. Defaults to 0.0.

0.0
std float

Standard deviation of the normal distribution. Defaults to 1.0.

1.0
Source code in tinybig/compression/probabilistic_compression.py
class naive_normal_probabilistic_compression(naive_probabilistic_compression):
    """
        A normal probabilistic compression class.

        This class samples features using a normal distribution with a specified mean and standard deviation.

        Methods
        -------
        __init__(name='naive_normal_probabilistic_compression', mean=0.0, std=1.0, ...)
            Initializes the normal probabilistic compression function.

        Parameters
        ----------
        name : str, optional
            Name of the transformation. Defaults to 'naive_normal_probabilistic_compression'.
        mean : float, optional
            Mean of the normal distribution. Defaults to 0.0.
        std : float, optional
            Standard deviation of the normal distribution. Defaults to 1.0.
    """
    def __init__(self, name: str = 'naive_normal_probabilistic_compression', mean: float = 0.0, std: float = 1.0, *args, **kwargs):
        """
            Initializes the normal probabilistic compression function.

            Parameters
            ----------
            name : str, optional
                Name of the transformation. Defaults to 'naive_normal_probabilistic_compression'.
            mean : float, optional
                Mean of the normal distribution. Defaults to 0.0.
            std : float, optional
                Standard deviation of the normal distribution. Defaults to 1.0.
        """
        distribution_function = torch.distributions.normal.Normal(torch.tensor([mean]), torch.tensor([std]))
        super().__init__(name=name, distribution_function=distribution_function, *args, **kwargs)

__init__(name='naive_normal_probabilistic_compression', mean=0.0, std=1.0, *args, **kwargs)

Initializes the normal probabilistic compression function.

Parameters:

Name Type Description Default
name str

Name of the transformation. Defaults to 'naive_normal_probabilistic_compression'.

'naive_normal_probabilistic_compression'
mean float

Mean of the normal distribution. Defaults to 0.0.

0.0
std float

Standard deviation of the normal distribution. Defaults to 1.0.

1.0
Source code in tinybig/compression/probabilistic_compression.py
def __init__(self, name: str = 'naive_normal_probabilistic_compression', mean: float = 0.0, std: float = 1.0, *args, **kwargs):
    """
        Initializes the normal probabilistic compression function.

        Parameters
        ----------
        name : str, optional
            Name of the transformation. Defaults to 'naive_normal_probabilistic_compression'.
        mean : float, optional
            Mean of the normal distribution. Defaults to 0.0.
        std : float, optional
            Standard deviation of the normal distribution. Defaults to 1.0.
    """
    distribution_function = torch.distributions.normal.Normal(torch.tensor([mean]), torch.tensor([std]))
    super().__init__(name=name, distribution_function=distribution_function, *args, **kwargs)