Bernoulli process是什么?
时间: 2023-11-26 15:04:10 浏览: 41
Bernoulli process是一系列独立同分布的随机变量构成的序列,每个随机变量只有两个可能的取值,通常为0或1。这个过程是以瑞士数学家雅各布·伯努利的名字命名的,他在17世纪研究了它。Bernoulli process通常用于建模二元结果,例如在一系列试验中单个试验的成功或失败。每次试验中成功的概率用p表示,失败的概率用q=1-p表示。Bernoulli process是更复杂的随机过程(如二项式过程和泊松过程)的重要组成部分。
相关问题
是Bernoulli Binary Generator吗
抱歉,我的回答有误。在 Simulink 库中,Boolean 类型的信源模块名字是“Bernoulli Binary Generator”,而非“Boolean Source”。Bernoulli Binary Generator 模块可以生成随机的二进制比特序列,你可以在模块的参数设置界面中设置比特序列长度、比特概率、随机数生成器种子等参数。
torch.bernoulli
torch.bernoulli is a function in PyTorch that generates samples from a Bernoulli distribution with a given probability of success (or "1" outcome). The function takes a tensor of probabilities as input and returns a tensor of binary values (0 or 1) sampled according to the Bernoulli distribution with the given probabilities.
For example, if we wanted to generate a tensor of 10 binary values with a probability of success of 0.7, we could use the following code:
```
import torch
probs = torch.tensor([0.7]) # probability of success
samples = torch.bernoulli(probs.repeat(10)) # generate 10 samples
print(samples)
```
This would output a tensor of 10 binary values sampled from a Bernoulli distribution with a probability of success of 0.7:
```
tensor([1., 1., 1., 0., 1., 0., 1., 1., 1., 1.])
```