Skip to content

Commit ff01703

Browse files
committed
Removed duplicated definition of class Bernoulli in distributions module
1 parent e93f50a commit ff01703

1 file changed

Lines changed: 0 additions & 44 deletions

File tree

content/distributions.py

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -142,50 +142,6 @@ def sample(self, size=None):
142142
"""
143143
return self.rand.exponential(self.mean, size=size)
144144

145-
146-
class Bernoulli:
147-
"""
148-
Convenience class for the Bernoulli distribution.
149-
packages up distribution parameters, seed and random generator.
150-
151-
The Bernoulli distribution is a special case of the binomial distribution
152-
where a single trial is conducted
153-
154-
Use the Bernoulli distribution to sample success or failure.
155-
"""
156-
157-
def __init__(self, p, random_seed=None):
158-
"""
159-
Constructor
160-
161-
Params:
162-
------
163-
p: float
164-
probability of drawing a 1
165-
166-
random_seed: int | SeedSequence, optional (default=None)
167-
A random seed to reproduce samples. If set to none then a unique
168-
sample is created.
169-
"""
170-
self.rand = np.random.default_rng(seed=random_seed)
171-
self.p = p
172-
173-
def sample(self, size=None):
174-
"""
175-
Generate a sample from the exponential distribution
176-
177-
Params:
178-
-------
179-
size: int, optional (default=None)
180-
the number of samples to return. If size=None then a single
181-
sample is returned.
182-
183-
Returns:
184-
-------
185-
float or np.ndarray (if size >=1)
186-
"""
187-
return self.rand.binomial(n=1, p=self.p, size=size)
188-
189145
class DiscreteEmpirical:
190146
"""
191147
DiscreteEmpirical distribution implementation.

0 commit comments

Comments
 (0)