我已经为蒙特卡罗模拟拟合了一系列的SciPy连续分布,并希望从这些分布中获取大量样本。但是,我希望能够获取相关样本,例如i第四样本从每个分布中获取第90个百分位数。
在这样做的过程中,我发现了SciPy性能中的一个怪癖:
# very fast way to many uncorrelated samples of length n
for shape, loc, scale, in distro_props:
sp.stats.norm.rvs(*shape, loc=loc, scale=scale, size=n)
# verrrrryyyyy slow way to take