sum_compression
Bases: metric_compression
The sum metric based compression function.
It performs the data compression based on provided sum metric.
...
Notes
Formally, given a data instance \(\mathbf{x} \in R^m\) and a provided metric \(\phi: {R}^m \to {R}^{d_{\phi}}\), which transforms it into a dense representation of length \(d_{\phi}\), we can represent the sum metric based compression function as follows:
\[ \begin{equation} \kappa(\mathbf{x}) = sum(\mathbf{x}) \in {R}^{d}. \end{equation} \]
For the sum metric studied in this project, the output is typically a scalar, i.e., the dimension \(d = d_{\phi} = 1\).
Attributes:
Name | Type | Description |
---|---|---|
metric |
Callable[[Tensor], Tensor]
|
The metric compression metric. |
name |
str, default = 'sum_compression'
|
Name of the sum compression function. |
Methods:
Name | Description |
---|---|
__init__ |
It performs the initialization of the sum compression function. |
calculate_D |
It calculates the compression space dimension d based on the input dimension parameter m. |
forward |
It implements the abstract forward method to define the compression function. |
Source code in tinybig/compression/metric_based_compression.py
__init__(name='sum_compression', *args, **kwargs)
The initialization method of the sum metric based compression function.
It initializes the compression function based on the provided sum metric.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the compression function. |
'sum_compression'
|
Returns:
Type | Description |
---|---|
transformation
|
The sum metric based compression function. |