@@ -66,8 +66,7 @@ def diffusion_kernel(graph: nx.Graph, sigma2: float = 1, normalized: bool = True
6666
6767
6868def inverse_cosine_kernel (graph : nx .Graph ) -> Matrix :
69- """Compute the inverse cosine kernel, which is based on a cosine transform
70- on the spectrum of the normalized Laplacian matrix.
69+ """Compute the inverse cosine kernel, which is based on a cosine transform on the spectrum of the normalized LM.
7170
7271 Quoting [Smola, 2003]: the inverse cosine kernel treats lower complexity
7372 functions almost equally, with a significant reduction in the upper end of the spectrum.
@@ -80,15 +79,14 @@ def inverse_cosine_kernel(graph: nx.Graph) -> Matrix:
8079 # Decompose matrix (Singular Value Decomposition)
8180 laplacian = LaplacianMatrix (graph , normalized = True )
8281 # Decompose matrix (Singular Value Decomposition)
83- U , S , _ = np .linalg .svd (laplacian .mat * (pi / 4 ))
84- laplacian .mat = np .matmul (np .matmul (U , np .diag (np .cos (S ))), np .transpose (U ))
82+ u , s , _ = np .linalg .svd (laplacian .mat * (pi / 4 ))
83+ laplacian .mat = np .matmul (np .matmul (u , np .diag (np .cos (s ))), np .transpose (u ))
8584
8685 return laplacian
8786
8887
8988def p_step_kernel (graph : nx .Graph , a : int = 2 , p : int = 5 ) -> Matrix :
90- """Compute the inverse cosine kernel, which is based on a cosine transform on the spectrum of the normalized
91- Laplacian matrix.
89+ """Compute the inverse cosine kernel, which is based on a cosine transform on the spectrum of the normalized LM.
9290
9391 This kernel is more focused on local properties of the nodes, because random walks
9492 are limited in terms of length. Therefore, if p is small, only a fraction of the values K(x1,x2)
0 commit comments