inverse_approx_multihop_chain_interdependence
Bases: chain_interdependence
An approximate multihop chain interdependence function using matrix inversion.
Notes
To further optimize the computations, we propose approximating the accumulative interdependence function using Taylor's polynomial expansion series. Considering the Taylor's expansions of the reciprocal function \(\frac{1}{1-x}\):
\[ \begin{equation} \frac{1}{1-x} = 1 + x + x^2 + x^3 + \cdots = \sum_{h=0}^{\infty} x^h. \end{equation} \]
Based on them, we define the reciprocal structural interdependence function and exponential structural interdependence function for approximating the above multi-hop chain-structured topological interdependence relationships as:
\[ \begin{equation} \xi(\mathbf{x}) = (\mathbf{I} - \mathbf{A})^{-1} \in R^{m \times m} \text{, and } \xi(\mathbf{x}) = \exp(\mathbf{A}) \in R^{m \times m}. \end{equation} \]
Methods:
Name | Description |
---|---|
__init__ |
Initializes the approximate multihop chain interdependence function. |
calculate_A |
Computes the approximate multihop interdependence matrix. |
Source code in tinybig/interdependence/topological_interdependence.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
|
__init__(name='inverse_approx_multihop_chain_interdependence', normalization=False, normalization_mode='row', *args, **kwargs)
Initializes the approximate multihop chain interdependence function using matrix inversion.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the interdependence function. Defaults to 'inverse_approx_multihop_chain_interdependence'. |
'inverse_approx_multihop_chain_interdependence'
|
normalization
|
bool
|
Whether to normalize the interdependence matrix. Defaults to False. |
False
|
normalization_mode
|
str
|
The mode of normalization ('row', 'column', etc.). Defaults to 'row'. |
'row'
|
*args
|
tuple
|
Additional positional arguments. |
()
|
**kwargs
|
dict
|
Additional keyword arguments. |
{}
|
Source code in tinybig/interdependence/topological_interdependence.py
calculate_A(x=None, w=None, device='cpu', *args, **kwargs)
Computes the approximate multihop interdependence matrix using matrix inversion.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
Tensor
|
Input tensor of shape |
None
|
w
|
Parameter
|
Parameter tensor. Defaults to None. |
None
|
device
|
str
|
Device for computation ('cpu', 'cuda'). Defaults to 'cpu'. |
'cpu'
|
*args
|
tuple
|
Additional positional arguments. |
()
|
**kwargs
|
dict
|
Additional keyword arguments. |
{}
|
Returns:
Type | Description |
---|---|
Tensor
|
The computed approximate multihop interdependence matrix. |
Raises:
Type | Description |
---|---|
AssertionError
|
If the computed matrix shape is invalid. |