min_compression
Bases: metric_compression
The min metric based compression function.
It performs the data compression based on provided min 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 min metric based compression function as follows:
\[ \begin{equation} \kappa(\mathbf{x}) = min(\mathbf{x}) \in {R}^{d}. \end{equation} \]
For the min 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 = 'min_compression'
|
Name of the min compression function. |
Methods:
Name | Description |
---|---|
__init__ |
It performs the initialization of the min 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='min_compression', *args, **kwargs)
The initialization method of the min metric based compression function.
It initializes the compression function based on the provided min metric.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the compression function. |
'min_compression'
|
Returns:
Type | Description |
---|---|
transformation
|
The min metric based compression function. |