如果您从 R 中使用 igraph,请使用此选项
sample_sphere_volume {igraph} | R 文档 |
采样有限维向量,用作随机点积图中的潜在位置向量
sample_sphere_volume(dim, n = 1, radius = 1, positive = TRUE)
dim |
整数标量,随机向量的维度。 |
n |
整数标量,样本大小。 |
radius |
数值标量,球体采样的半径。 |
positive |
逻辑标量,是否从球体的正卦限采样。 |
sample_sphere_volume
从 S^{dim-1}
((dim-1)
-球面) 生成均匀样本,即样本的欧几里得范数小于或等于 radius
。
一个 dim
(sample_dirichlet
的 alpha
向量的长度) 乘以 n
的矩阵,其列是样本向量。
其他潜在位置向量采样器: sample_dirichlet()
, sample_sphere_surface()
lpvs.sph.vol <- sample_sphere_volume(dim=10, n=20, radius=1)
RDP.graph.4 <- sample_dot_product(lpvs.sph.vol)
vec.norm <- apply(lpvs.sph.vol, 2, function(x) { sum(x^2) })
vec.norm