constant_c_interdependence
Bases: constant_interdependence
A class for constant interdependence with a scalar multiplier.
This class defines an interdependence matrix as a scalar (c
) multiplied by a matrix of ones.
Notes
Formally, based on the (optional) input data batch \(\mathbf{X} \in {R}^{b \times m}\), we define the constant interdependence function as: $$ \begin{equation} \xi(\mathbf{X}) = c \times \mathbf{1} \in {R}^{m \times m}, \text{ or } \xi(\mathbf{X}) = c \times \mathbf{1} \in {R}^{b \times b}, \end{equation} $$ where \(c\) is the provided constant factor and \(\mathbf{1}\) is a matrix of ones.
Methods:
Name | Description |
---|---|
__init__ |
Initializes the constant-c interdependence function. |
Source code in tinybig/interdependence/basic_interdependence.py
__init__(b, m, b_prime=None, m_prime=None, c=1.0, name='constant_c_interdependence', interdependence_type='attribute', device='cpu', *args, **kwargs)
Initializes the constant-c interdependence function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
b
|
int
|
Number of rows in the input tensor. |
required |
m
|
int
|
Number of columns in the input tensor. |
required |
b_prime
|
int
|
Number of rows in the output tensor for row-based interdependence. Required for row-based interdependence types. |
None
|
m_prime
|
int
|
Number of columns in the output tensor for column-based interdependence. Required for column-based interdependence types. |
None
|
c
|
float or int
|
Scalar multiplier for the interdependence matrix. Defaults to 1.0. |
1.0
|
name
|
str
|
Name of the interdependence function. Defaults to 'constant_c_interdependence'. |
'constant_c_interdependence'
|
interdependence_type
|
str
|
Type of interdependence ('attribute', 'instance', etc.). Defaults to 'attribute'. |
'attribute'
|
device
|
str
|
Device for computation. Defaults to 'cpu'. |
'cpu'
|
*args
|
tuple
|
Additional positional arguments for the parent |
()
|
**kwargs
|
dict
|
Additional keyword arguments for the parent |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
If the interdependence type is not supported. |