Normalizers
Contains a collection of matrix normalizers, i.e., functions that take a matrix as input and return a normalized/stochastic matrix version of it.
normalization_same_eigenvec_centr(A)
Add a dummy node to the matrix and normalize it so that the row sums are equal to one. The dummy node is added in such a way that the first eigenvector of the normalized matrix is the same as the first eigenvector of the original matrix.
Parameters:
-
A
(ndarray
) –Matrix to be normalized.
Returns:
-
ndarray
–Normalized matrix.
Source code in pykda\normalizers.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
normalization_with_self_loops(A)
Add self-loops to each node so that the row sums of A are equal. Afterward apply standard row normalization.
Parameters:
-
A
(ndarray
) –Non-negative matrix to be normalized.
Returns:
-
ndarray
–Normalized matrix.
Source code in pykda\normalizers.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
standard_row_normalization(A)
Normalize the rows of a given matrix so that they sum up to one.
Parameters:
-
A
(ndarray
) –Non-negative matrix with positive row sums to be normalized.
Returns:
-
ndarray
–Normalized matrix.
Source code in pykda\normalizers.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|