Python中的离散随机分布示例

时间:2015-01-30 08:33:11

标签: python-3.x distribution discrete-space

我希望知道scipy中是否有一个命令可以从离散的随机分布中选择一个数据元素。即,

例如,我有一个离散的分布x = (0.5, 0.3, 0.2),我想从y = (1, 2, 3)中抽样...

>>> sample(x, y)
2
>>> sample(x, y)
3
>>> sample(x, y)
3
>>> sample(x, y)
1

希望我的问题很明确。感谢。

0 个答案:

没有答案
相关问题