Bases: parameterized_bilinear_interdependence
Source code in tinybig/interdependence/parameterized_bilinear_interdependence.py
| class hm_parameterized_bilinear_interdependence(parameterized_bilinear_interdependence):
def __init__(self, p: int, q: int = None, name: str = 'hm_parameterized_bilinear_interdependence', *args, **kwargs):
super().__init__(name=name, *args, **kwargs)
self.p = p
self.q = q if q is not None else p
if self.interdependence_type in ['row', 'left', 'instance', 'instance_interdependence']:
d, d_prime = self.m, self.calculate_m_prime()
elif self.interdependence_type in ['column', 'right', 'attribute', 'attribute_interdependence']:
d, d_prime = self.b, self.calculate_b_prime()
else:
raise ValueError(f'Interdependence type {self.interdependence_type} not supported')
assert d % self.p == 0 and d_prime % self.q == 0
self.parameter_fabrication = hm_reconciliation(p=self.p, q=self.q)
|