示例#1
0
 def update_params(self, loc=0.0, scale=1.0, use="scipy", **params):
     self.__update_params__(
         loc,
         scale,
         use,
         mu=make_float(params.get("mu", params.get("loc", self.mu))),
         sigma=make_float(
             params.get("sigma", params.get("scale", self.sigma))))
示例#2
0
 def __init__(self, **params):
     self.type = ProbabilityDistributionTypes.NORMAL
     self.scipy_name = "norm"
     self.numpy_name = ProbabilityDistributionTypes.NORMAL
     self.mu = make_float(params.get("mu", params.get("loc", 0.0)))
     self.sigma = make_float(
         make_float(params.get("sigma", params.get("scale", 1.0))))
     self.constraint_string = "sigma > 0"
     self.__update_params__(mu=self.mu, sigma=self.sigma)
 def update_params(self, loc=0.0, scale=1.0, use="scipy", **params):
     self.__update_params__(
         loc,
         scale,
         use,
         alpha=make_float(params.get("alpha", params.get("a", self.alpha))),
         beta=make_float(params.get("beta", params.get("b", self.beta))))
     self.a = self.alpha
     self.b = self.beta
 def __init__(self, **params):
     self.type = ProbabilityDistributionTypes.BETA
     self.scipy_name = ProbabilityDistributionTypes.BETA
     self.numpy_name = ProbabilityDistributionTypes.BETA
     self.constraint_string = "alpha > 0 and beta > 0"
     self.alpha = make_float(params.get("alpha", params.get("a", 2.0)))
     self.beta = make_float(params.get("beta", params.get("b", 2.0)))
     self.a = self.alpha
     self.b = self.beta
     self.__update_params__(alpha=self.alpha, beta=self.beta)
 def update_params(self, loc=0.0, scale=1.0, use="scipy", **params):
     self.__update_params__(
         loc,
         scale,
         use,
         mu=make_float(
             params.get("mu", np.log(params.get("scale",
                                                np.exp(self.mu))))),
         sigma=make_float(
             params.get("sigma", params.get("shape", self.shape))))
     self.shape = self.sigma
 def __init__(self, **params):
     self.type = ProbabilityDistributionTypes.GAMMA
     self.scipy_name = ProbabilityDistributionTypes.GAMMA
     self.numpy_name = ProbabilityDistributionTypes.GAMMA
     self.constraint_string = "alpha > 0 and beta > 0"
     self.alpha = make_float(
         params.get("alpha", params.get("k", params.get("shape", 2.0))))
     self.beta = make_float(
         params.get(
             "beta",
             params.get("rate", 1.0 /
                        params.get("theta", params.get("scale", 0.5)))))
     self.k = self.alpha
     self.theta = 1.0 / self.beta
     self.__update_params__(alpha=self.alpha, theta=self.theta)
 def update_params(self, loc=0.0, scale=1.0, use="scipy", **params):
     self.__update_params__(
         loc,
         scale,
         use,
         a=make_float(
             params.get("a", params.get("low", params.get("loc", self.a)))),
         b=make_float(
             params.get(
                 "b",
                 params.get("high",
                            params.get("scale", self.b - self.a) +
                            self.a))))
     self.low = self.a
     self.high = self.b
示例#8
0
 def __init__(self, **params):
     self.type = ProbabilityDistributionTypes.BERNOULLI
     self.scipy_name = ProbabilityDistributionTypes.BERNOULLI
     self.numpy_name = ""
     self.constraint_string = "0 < p < 1"
     self.p = make_float(params.get("p", 0.5))
     self.__update_params__(p=self.p)
 def update_params(self, loc=0.0, scale=1.0, use="scipy", **params):
     self.__update_params__(
         loc,
         scale,
         use,
         alpha=make_float(
             params.get("alpha",
                        params.get("k", params.get("shape", self.alpha)))),
         beta=make_float(
             params.get(
                 "beta", 1.0 / params.get(
                     "theta",
                     params.get("scale", params.get("rate",
                                                    1.0 / self.beta))))))
     self.k = self.alpha
     self.theta = 1.0 / self.beta
示例#10
0
 def __init__(self, **params):
     self.type = ProbabilityDistributionTypes.EXPONENTIAL
     self.scipy_name = "expon"
     self.numpy_name = ProbabilityDistributionTypes.EXPONENTIAL
     self.constraint_string = "scale > 0"
     self.lamda = make_float(params.get("lamda", params.get("rate", 1.0 / params.get("scale", 1.0))))
     self.rate = self.lamda
     self.__update_params__(lamda=self.lamda)
示例#11
0
 def __init__(self, **params):
     self.type = ProbabilityDistributionTypes.BINOMIAL
     self.scipy_name = "binom"
     self.numpy_name = ProbabilityDistributionTypes.BINOMIAL
     self.constraint_string = "n > 0 and 0 < p < 1"
     self.n = make_int(params.get("n", 1))
     self.p = make_float(params.get("p", 0.5))
     self.__update_params__(n=self.n, p=self.p)
示例#12
0
 def __init__(self, **params):
     self.type = ProbabilityDistributionTypes.POISSON
     self.scipy_name = ProbabilityDistributionTypes.POISSON
     self.numpy_name = ProbabilityDistributionTypes.POISSON
     self.lamda = make_float(
         params.get("lamda", params.get("lam", params.get("mu", 0.5))))
     self.constraint_string = "0 < lamda < 1"
     self.__update_params__(lamda=self.lamda)
     self.mu = self.lamda
 def __init__(self, **params):
     self.type = ProbabilityDistributionTypes.UNIFORM
     self.scipy_name = ProbabilityDistributionTypes.UNIFORM
     self.numpy_name = ProbabilityDistributionTypes.UNIFORM
     self.constraint_string = "a < b"
     self.a = make_float(
         params.get("a",
                    params.get("low", params.get("loc",
                                                 DEFAULT_LOW_VALUE))))
     self.b = make_float(
         params.get(
             "b",
             params.get(
                 "high",
                 params.get("scale", 2.0 * DEFAULT_HIGH_VALUE) -
                 DEFAULT_HIGH_VALUE)))
     self.__update_params__(a=self.a, b=self.b)
     self.low = self.a
     self.high = self.b
示例#14
0
 def update_params(self, loc=0.0, scale=1.0, use="scipy", **params):
     self.__update_params__(loc,
                            scale,
                            use,
                            lamda=make_float(
                                params.get(
                                    "lamda",
                                    params.get("lam",
                                               params.get("mu",
                                                          self.lamda)))))
     self.mu = self.lamda
示例#15
0
 def update_params(self, loc=0.0, scale=1.0, use="scipy", **params):
     self.__update_params__(loc,
                            scale,
                            use,
                            n=make_int(params.get("n", self.n)),
                            p=make_float(params.get("p", self.p)))
示例#16
0
 def _update_params(self, use="scipy", **params):
     self.loc = make_float(params.pop("loc", self.loc))
     self.scale = make_float(params.pop("scale", self.scale))
     self.update_params(self.loc, self.scale, use=use, **params)
     return self
示例#17
0
 def update_params(self, loc=0.0, scale=1.0, use="scipy", **params):
     self.__update_params__(loc, scale, use,
                            lamda=make_float(params.get("lamda", params.get("rate", 1.0 / params.get("scale",
                                                                                                     1.0 / self.lamda)))))
     self.rate = self.lamda