User:Sivaji12331/sandbox

In statistics, an empirical distribution function is the distribution function associated with the empirical measure of a sample. This cumulative distribution function is a step function that jumps up by 1/n at each of the n data points. Its value at any specified value of the measured variable is the fraction of observations of the measured variable that are less terhan or equal to the specified value.

The empirical distribution function is an estimate of the cumulative distribution function that generated the points in the sample. It converges with probability 1 to that underlying distribution, according to the Glivenko–Cantelli theorem. A number of results exist to quantify the rate of convergence of the empirical distribution function to the underlying cumulative distribution function.

Situations following Bernoulli Distribution

 * 1) Coin toss: To record number of coins landing heads and number of coins landing tails. For a unbiased coin the probability of landing head (success) is equal to 0.5 which is also the case for landing tails (failure)
 * 2) Dice roll: Probability of a dice rolling 6 and probability of not rolling 6. Here success is rolling 1  which is at a probability 1/6 and failure is not rolling 6, which the probability is 5/6.
 * 3) Child birth: A newborn child can be either a male or a female.
 * 4) A dart thrown at circular dartboard can land randomly at any point over its area. It can land either closer to the center than to the edge or not.

Applications
1. Logistic Regression

Logistic regression is one of the supervised machine learning algorithm used widely for classification tasks. It takes into consideration of the Bernoulli probability and used when the dependent variable takes only two possible values. Here we assume a linear relationship between the predicted variables, and the log-odds of the event that $$Y = 1$$.

2. Multivariate Bernoulli Distribution

Multivariate Bernoulli distribution can be able to estimate the structure of graphs with binary nodes. This distribution also belongs to the exponential family. This model can estimate the main effects and pairwise interactions among the nodes and also is capable of modeling higher order interactions, allowing for the existence of complex clique effects. This distribution has independence and uncorrelatedness of the component random variables are equivalent. Both the marginal and conditional distributions of a subset of variables in the multivariate Bernoulli distribution still follow the multivariate Bernoulli distribution.

Bernoulli random variables
1. Microsoft Excel:

"RAND" function is excel generate a uniformly distributed random variable between 0 and 1. Using " =IF(RAND>0.6,1,0)" in excel cell generates a value 0 with a probability 0.4 and it generates a value 1 with a probability 0.6. This can be correlated to Bernoulli random variable as success = 1, failure = 0 and probability is 0.6.

2. R Software: Density, distribution function, quantile function and random generation for the Bernoulli distribution with parameter.

3. Python Software using SciPy framework: 4. Python using TensorFlow:

5. Python using Pytorch:



6. Mathworks:  = binornd generates random numbers from the binomial distribution specified by the number of trials   and the probability of success for each trial.

and  can be vectors, matrices, or multidimensional arrays of the same size. Alternatively, one or more arguments can be scalars. The  function expands scalar inputs to constant arrays with the same dimensions as the other inputs. The function returns a vector, matrix, or multidimensional array  of the same size as   and.

7. C++: .

3. Python Software using SciPy framework: 4. Python using TensorFlow:

Args:

 *  : An N-D  representing the log-odds of a   event. Each entry in the   parametrizes an independent Bernoulli distribution where the probability of an event is sigmoid(logits). Only one of   or   should be passed in.
 *  : An N-D  representing the probability of a   event. Each entry in the   parameterizes an independent Bernoulli distribution. Only one of   or   should be passed in.
 *  : The type of the event samples. Default:.
 *  : Python, default  . When   distribution parameters are checked for validity despite possibly degrading runtime performance. When   invalid inputs may silently render incorrect outputs.
 *  : Python, default  . When  , statistics (e.g., mean, mode, variance) use the value " " to indicate the result is undefined. When  , an exception is raised if one or more of the statistic's batch members are undefined.
 *  : Python  name prefixed to Ops created by this class.

Raises:

 *  : If p and logits are passed, or if neither are passed.

5. Python using Pytorch:


 * Parameters
 * probs (Number, Tensor) – the probability of sampling
 * logits (Number, Tensor) – the log-odds of sampling

6. Mathworks:  = binornd generates random numbers from the binomial distribution specified by the number of trials   and the probability of success for each trial.

and  can be vectors, matrices, or multidimensional arrays of the same size. Alternatively, one or more arguments can be scalars. The  function expands scalar inputs to constant arrays with the same dimensions as the other inputs. The function returns a vector, matrix, or multidimensional array  of the same size as   and.

7. C++: