expected_edges {fastRG} | R Documentation |
Calculate the expected edges in Poisson RDPG graph
Description
These calculations are conditional on the latent factors
X
and Y
.
Usage
expected_edges(factor_model, ...)
expected_degree(factor_model, ...)
expected_in_degree(factor_model, ...)
expected_out_degree(factor_model, ...)
expected_density(factor_model, ...)
expected_degrees(factor_model, ...)
Arguments
factor_model |
|
... |
Ignored. Do not use. |
Details
Note that the runtime of the fastRG
algorithm is proportional to
the expected number of edges in the graph. Expected edge count will be
an underestimate of expected number of edges for Bernoulli
graphs. See the Rohe et al for details.
Value
Expected edge counts, or graph densities.
References
Rohe, Karl, Jun Tao, Xintian Han, and Norbert Binkiewicz. 2017. "A Note on Quickly Sampling a Sparse Matrix with Low Rank Expectation." Journal of Machine Learning Research; 19(77):1-13, 2018. https://www.jmlr.org/papers/v19/17-128.html
Examples
##### an undirected blockmodel example
n <- 1000
pop <- n / 2
a <- .1
b <- .05
B <- matrix(c(a,b,b,a), nrow = 2)
b_model <- fastRG::sbm(n = n, k = 2, B = B, poisson_edges = FALSE)
b_model
A <- sample_sparse(b_model)
# compare
mean(rowSums(triu(A)))
pop * a + pop * b # analytical average degree
##### more generic examples
n <- 10000
k <- 5
X <- matrix(rpois(n = n * k, 1), nrow = n)
S <- matrix(runif(n = k * k, 0, .1), nrow = k)
ufm <- undirected_factor_model(X, S)
expected_edges(ufm)
expected_degree(ufm)
eigs_sym(ufm)
n <- 10000
d <- 1000
k1 <- 5
k2 <- 3
X <- matrix(rpois(n = n * k1, 1), nrow = n)
Y <- matrix(rpois(n = d * k2, 1), nrow = d)
S <- matrix(runif(n = k1 * k2, 0, .1), nrow = k1)
dfm <- directed_factor_model(X = X, S = S, Y = Y)
expected_edges(dfm)
expected_in_degree(dfm)
expected_out_degree(dfm)
svds(dfm)
[Package fastRG version 0.3.2 Index]