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