Skip to contents

Formula: max MI(local h_v, global s)

Usage

Dgi(G, X, encoder = NULL, seed = 42)

Arguments

G

An n x n adjacency matrix.

X

An n x f node feature matrix.

encoder

An f x d weight matrix, or NULL.

seed

Seed of the deterministic stream.

Value

List with estimate, loss, h, s, pos_score, neg_score, n, d, method.

Details

One propagation step gives node summaries h = sigma(D^-1 A X W); the graph summary s is their mean passed through a sigmoid; the discriminator D(h, s) = sigmoid(h' M s) is trained to separate real node summaries from those of a corrupted graph whose feature rows are shuffled. The objective is the binary cross-entropy of that discriminator, so at M = 0 every score is 1/2 and the loss is exactly log 2 – the value that pins the sign convention.

References

Velickovic et al. (2019), Deep Graph Infomax, ICLR 2019.

Examples

set.seed(1)
G <- matrix(c(0, 1, 0, 1, 0, 1, 0, 1, 0), 3, 3, byrow = TRUE)
X <- matrix(rnorm(6), 3, 2)
Dgi(G, X)
#> $estimate
#> [1] 0.6931472
#> 
#> $loss
#> [1] 0.6931472
#> 
#> $h
#>           [,1]      [,2]
#> [1,] 0.6122652 0.5028279
#> [2,] 0.5644942 0.6480556
#> [3,] 0.6122652 0.5028279
#> 
#> $s
#> [1] 0.6448189 0.6344226
#> 
#> $pos_score
#> [1] 0.5 0.5 0.5
#> 
#> $neg_score
#> [1] 0.5 0.5 0.5
#> 
#> $n
#> [1] 3
#> 
#> $d
#> [1] 2
#> 
#> $method
#> [1] "Deep Graph Infomax objective"
#> 
#> attr(,"class")
#> [1] "morie_rich_result" "list"