View source: R/distributions-bernoulli.R
distr_bernoulli | R Documentation |
probs
or logits
(but not both).
Samples are binary (0 or 1). They take the value 1
with probability p
and 0
with probability 1 - p
.Creates a Bernoulli distribution parameterized by probs
or logits
(but not both).
Samples are binary (0 or 1). They take the value 1
with probability p
and 0
with probability 1 - p
.
distr_bernoulli(probs = NULL, logits = NULL, validate_args = NULL)
probs |
(numeric or torch_tensor): the probability of sampling |
logits |
(numeric or torch_tensor): the log-odds of sampling |
validate_args |
whether to validate arguments or not. |
Distribution for details on the available methods.
Other distributions:
distr_chi2()
,
distr_gamma()
,
distr_multivariate_normal()
,
distr_normal()
,
distr_poisson()
if (torch_is_installed()) {
m <- distr_bernoulli(0.3)
m$sample() # 30% chance 1; 70% chance 0
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.