Skip to contents

Principal Neighbourhood Aggregation (Corso et al. 2020, eq. 7)

Usage

PnaAgg(
  A,
  X,
  aggregators = c("mean", "std", "max", "min"),
  scalers = c("identity", "amplification", "attenuation")
)

Arguments

A

square adjacency matrix; a non-zero A[i, j] makes j a neighbour of i

X

node features (n x f)

aggregators

subset of c("mean", "std", "max", "min")

scalers

subset of c("identity", "amplification", "attenuation")

Value

list(out, aggregated, degree, delta, scale, n, n_features, n_columns)

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)
PnaAgg(A, X)
#> $out
#>            [,1]      [,2]        [,3]        [,4]       [,5]      [,6]
#> [1,]  0.1836433 0.3295078 0.003162278 0.003162278  0.1836433 0.3295078
#> [2,] -0.7310412 0.3874062 0.104635197 1.207878733 -0.6264538 1.5952808
#> [3,]  0.1836433 0.3295078 0.003162278 0.003162278  0.1836433 0.3295078
#>            [,7]       [,8]       [,9]     [,10]       [,11]       [,12]
#> [1,]  0.1836433  0.3295078  0.1536780 0.2757416 0.002646285 0.002646285
#> [2,] -0.8356286 -0.8204684 -0.9696109 0.5138333 0.138782090 1.602060688
#> [3,]  0.1836433  0.3295078  0.1536780 0.2757416 0.002646285 0.002646285
#>           [,13]     [,14]     [,15]      [,16]      [,17]     [,18]       [,19]
#> [1,]  0.1536780 0.2757416  0.153678  0.2757416  0.2194515 0.3937577 0.003778882
#> [2,] -0.8308922 2.1158884 -1.108330 -1.0882219 -0.5511708 0.2920861 0.078890038
#> [3,]  0.1536780 0.2757416  0.153678  0.2757416  0.2194515 0.3937577 0.003778882
#>            [,20]      [,21]     [,22]      [,23]      [,24]
#> [1,] 0.003778882  0.2194515 0.3937577  0.2194515  0.3937577
#> [2,] 0.910683998 -0.4723168 1.2027670 -0.6300248 -0.6185947
#> [3,] 0.003778882  0.2194515 0.3937577  0.2194515  0.3937577
#> 
#> $aggregated
#> $aggregated[[1]]
#> $aggregated[[1]][[1]]
#> [1] 0.1836433 0.3295078
#> 
#> $aggregated[[1]][[2]]
#> [1] 0.003162278 0.003162278
#> 
#> $aggregated[[1]][[3]]
#> [1] 0.1836433 0.3295078
#> 
#> $aggregated[[1]][[4]]
#> [1] 0.1836433 0.3295078
#> 
#> 
#> $aggregated[[2]]
#> $aggregated[[2]][[1]]
#> [1] -0.7310412  0.3874062
#> 
#> $aggregated[[2]][[2]]
#> [1] 0.1046352 1.2078787
#> 
#> $aggregated[[2]][[3]]
#> [1] -0.6264538  1.5952808
#> 
#> $aggregated[[2]][[4]]
#> [1] -0.8356286 -0.8204684
#> 
#> 
#> $aggregated[[3]]
#> $aggregated[[3]][[1]]
#> [1] 0.1836433 0.3295078
#> 
#> $aggregated[[3]][[2]]
#> [1] 0.003162278 0.003162278
#> 
#> $aggregated[[3]][[3]]
#> [1] 0.1836433 0.3295078
#> 
#> $aggregated[[3]][[4]]
#> [1] 0.1836433 0.3295078
#> 
#> 
#> 
#> $degree
#> [1] 1 2 1
#> 
#> $delta
#> [1] 0.8283022
#> 
#> $scale
#>      [,1]      [,2]      [,3]
#> [1,]    1 0.8368288 1.1949875
#> [2,]    1 1.3263423 0.7539532
#> [3,]    1 0.8368288 1.1949875
#> 
#> $aggregators
#> [1] "mean" "std"  "max"  "min" 
#> 
#> $scalers
#> [1] "identity"      "amplification" "attenuation"  
#> 
#> $n
#> [1] 3
#> 
#> $n_features
#> [1] 2
#> 
#> $n_columns
#> [1] 24
#> 
#> $method
#> [1] "Corso et al. (2020) PNA, eq. (7) of arXiv:2004.05718"
#>