pagerank_multihop_graph_interdependence
Bases: graph_interdependence
A multihop graph-based interdependence function using the PageRank algorithm.
Notes
In addition to these formulas that calculate powers of matrix \(\mathbf{A}\), existing graph studies also offer other approaches to calculate long-distance dependency relationships among data instances, such as the PageRank algorithm. Without delving into the step-wise derivation of PageRank updating equations, we define the PageRank multi-hop graph interdependence function as follows:
\[ \begin{equation} \xi(\mathbf{x}) = \alpha \cdot \left( \mathbf{I} - (1- \alpha) \cdot {\mathbf{A}} \right)^{-1} \in R^{m \times m}. \end{equation} \]
Here, \(\alpha \in [0, 1]\) is a hyper-parameter of the function, typically set to \(0.15\) by default. Usually, matrix \(\mathbf{A}\) is normalized before being used in this formula.
Attributes:
Name | Type | Description |
---|---|---|
c |
float
|
Damping factor for the PageRank algorithm. |
Methods:
Name | Description |
---|---|
__init__ |
Initializes the PageRank multihop graph interdependence function. |
calculate_A |
Computes the interdependence matrix using the PageRank algorithm. |
Source code in tinybig/interdependence/topological_interdependence.py
832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 |
|
__init__(c=0.15, name='pagerank_multihop_graph_interdependence', *args, **kwargs)
Initializes the PageRank multihop graph interdependence function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
c
|
float
|
Damping factor for the PageRank algorithm. Defaults to 0.15. |
0.15
|
name
|
str
|
Name of the interdependence function. Defaults to 'pagerank_multihop_graph_interdependence'. |
'pagerank_multihop_graph_interdependence'
|
*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 interdependence matrix using the PageRank algorithm.
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 interdependence matrix using the PageRank algorithm. |
Raises:
Type | Description |
---|---|
AssertionError
|
If the computed matrix shape is invalid. |