跳到内容

采样有限维向量以用作随机点积图中的潜在位置向量

用法

sample_dirichlet(n, alpha)

参数

n

整数标量,样本大小。

alpha

数值向量,狄利克雷分布的 \(\alpha\) 参数向量。

一个 dimsample_dirichlet()alpha 向量的长度)乘以 n 的矩阵,其列是样本向量。

详细信息

sample_dirichlet() 从给定 \(\alpha\) 参数的狄利克雷分布中生成样本。样本从 length(alpha)-1-单纯形中抽取。

参见

其他潜在位置向量采样器:sample_sphere_surface(), sample_sphere_volume()

示例

lpvs.dir <- sample_dirichlet(n = 20, alpha = rep(1, 10))
RDP.graph.2 <- sample_dot_product(lpvs.dir)
colSums(lpvs.dir)
#>  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1