mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Ensemble: Edit: Add Binomial distribution and minor change.
This commit is contained in:
1 parent
cadffe40d6
commit
f19ab9455a
6 files changed
+67
-94
No files matched your search
@@ -195,6 +195,27 @@ class Normal(Distribution):
|
||||
return np.random.normal(*lst)
|
||||
|
||||
|
||||
class Binomial(Distribution):
|
||||
_sub_classes = []
|
||||
|
||||
def __init__(self, id: int = -1,
|
||||
name: str = "binomial", script: str = "",
|
||||
status=None):
|
||||
super(Binomial, self).__init__(
|
||||
id=id, status=status,
|
||||
name=name, script=script
|
||||
)
|
||||
|
||||
self._labels = ["binomial_n", "binomial_p"]
|
||||
self._default_values = [100.0, 0.3]
|
||||
|
||||
def random(self, params, nb):
|
||||
lst = params.copy()
|
||||
lst.append(nb)
|
||||
|
||||
return np.random.binomial(*lst)
|
||||
|
||||
|
||||
class Poisson(Distribution):
|
||||
_sub_classes = []
|
||||
|
||||
@@ -206,7 +227,7 @@ class Poisson(Distribution):
|
||||
name=name, script=script
|
||||
)
|
||||
|
||||
self._labels = ["lam"]
|
||||
self._labels = ["poisson_lam"]
|
||||
self._default_values = [5.0]
|
||||
|
||||
def random(self, params, nb):
|
||||
|
||||
Reference in new issue
Block a user