Formula: S = softmax(GNN_pool); H' = S^T H
Details
The assignment matrix S is soft and learned, so the coarsened graph A' = S' A S and features H' = S' H are differentiable in it. Every row of S sums to one by construction; when S is one-hot, A'_rs is exactly the number of edges between cluster r and cluster s. The auxiliary link prediction loss is ||A - S S'||_F / n.
References
Ying et al. (2018), Hierarchical Graph Representation Learning with Differentiable Pooling, NeurIPS 31:4800-4810.
Examples
set.seed(1)
A <- matrix(c(0, 1, 0, 1, 0, 1, 0, 1, 0), 3, 3, byrow = TRUE)
X <- matrix(rnorm(6), 3, 2)
DiffP(A, X, K_clusters = 2)
#> $estimate
#> [1] 0.5220367
#>
#> $S
#> [,1] [,2]
#> [1,] 0.7869447 0.2130553
#> [2,] 0.7656613 0.2343387
#> [3,] 0.6678407 0.3321593
#>
#> $A_pool
#> [,1] [,2]
#> [1,] 2.2277459 0.7583622
#> [2,] 0.7583622 0.2555297
#>
#> $H_pool
#> [,1] [,2]
#> [1,] -0.9104427 0.9597469
#> [2,] -0.3679964 0.1445733
#>
#> $link_loss
#> [1] 0.5220367
#>
#> $entropy_loss
#> [1] 0.5660466
#>
#> $n
#> [1] 3
#>
#> $K
#> [1] 2
#>
#> $method
#> [1] "DiffPool differentiable graph pooling"
#>
#> attr(,"class")
#> [1] "morie_rich_result" "list"
