Exemplo n.º 1
0
 def check(mu, sigma):
     _value_check(
         len(mu) == len(sigma.col(0)),
         "Size of the mean vector and covariance matrix are incorrect.")
     #check if covariance matrix is positive definite or not.
     _value_check((i > 0 for i in sigma.eigenvals().keys()),
                  "The covariance matrix must be positive definite. ")
Exemplo n.º 2
0
 def check(mu, sigma, v):
     _value_check(mu.shape[0] == sigma.shape[0],
                  "Size of the location vector and shape matrix are incorrect.")
     # check if covariance matrix is positive definite or not.
     if not isinstance(sigma, MatrixSymbol):
         _value_check(sigma.is_positive_definite,
                      "The shape matrix must be positive definite. ")
Exemplo n.º 3
0
 def __new__(cls, sym, p, success=1, failure=0):
     _value_check(p >= 0 and p <= 1, 'Value of p must be between 0 and 1.')
     sym = _symbol_converter(sym)
     p = _sympify(p)
     success = _sym_sympify(success)
     failure = _sym_sympify(failure)
     return Basic.__new__(cls, sym, p, success, failure)
Exemplo n.º 4
0
 def check(self, mu, sigma, v):
     _value_check(
         len(mu) == len(sigma.col(0)),
         "Size of the location vector and shape matrix are incorrect.")
     #check if covariance matrix is positive definite or not.
     _value_check(
         all([Gt(i, 0) != False for i in sigma.eigenvals().keys()]),
         "The shape matrix must be positive definite. ")
Exemplo n.º 5
0
 def check(self, mu, sigma):
     mu, sigma = Matrix([mu]), Matrix(sigma)
     _value_check(
         len(mu) == len(sigma.col(0)),
         "Size of the mean vector and covariance matrix are incorrect.")
     #check if covariance matrix is positive definite or not.
     _value_check(
         all([Gt(i, 0) != False for i in sigma.eigenvals().keys()]),
         "The covariance matrix must be positive definite. ")
Exemplo n.º 6
0
 def check(alpha):
     _value_check(
         len(alpha) >= 2, "At least two categories should be passed.")
     for a_k in alpha:
         _value_check(
             (a_k > 0) != False,
             "Each concentration parameter"
             " should be positive.",
         )
Exemplo n.º 7
0
 def __new__(cls, sym, p, success=1, failure=0):
     _value_check(p >= 0 and p <= 1, 'Value of p must be between 0 and 1.')
     p = _sympify(p)
     sym = _symbol_converter(sym)
     success = _sym_sympify(success)
     failure = _sym_sympify(failure)
     state_space = _set_converter([success, failure])
     return Basic.__new__(cls, sym, state_space, BernoulliDistribution(p),
                          p, success, failure)
Exemplo n.º 8
0
 def check(self, delta, v, l, mu):
     _value_check((delta >= 0, delta <= 1), "delta must be in range [0, 1].")
     _value_check((v > 0), "v must be positive")
     for lk in l:
         _value_check((lk > 0), "lamda must be a positive vector.")
     for muk in mu:
         _value_check((muk > 0), "mu must be a positive vector.")
     _value_check(len(l) > 1,"the distribution should have at least"
                             " two random variables.")
Exemplo n.º 9
0
 def check(alpha, beta, scale_matrix):
     if not isinstance(scale_matrix, MatrixSymbol):
         _value_check(scale_matrix.is_positive_definite, "The shape "
                      "matrix must be positive definite.")
     _value_check(scale_matrix.is_square, "Should " "be square matrix")
     _value_check(alpha.is_positive, "Shape parameter should be positive.")
     _value_check(beta.is_positive, "Scale parameter should be positive.")
Exemplo n.º 10
0
 def check(k0, p):
     _value_check(k0 > 0, "number of failures must be a positive integer")
     for p_k in p:
         _value_check((p_k >= 0, p_k <= 1),
                      "probability must be in range [0, 1].")
     _value_check(
         sum(p) <= 1, "success probabilities must not be greater than 1.")
Exemplo n.º 11
0
 def check(k, delta, c):
     _value_check(k.is_integer and k.is_positive,
                  "'k' must be a positive integer")
     _value_check(
         Gt(delta, 0) and Le(delta, 1),
         "'delta' must be a real number in the interval (0,1)")
     _value_check(c.is_positive, "'c' must be a positive real number.")
Exemplo n.º 12
0
 def check(n, alpha, beta):
     _value_check((n.is_integer, n.is_nonnegative),
                  "'n' must be nonnegative integer. n = %s." % str(n))
     _value_check((alpha > 0),
                  "'alpha' must be: alpha > 0 . alpha = %s" % str(alpha))
     _value_check((beta > 0),
                  "'beta' must be: beta > 0 . beta = %s" % str(beta))
Exemplo n.º 13
0
 def check(n, N, m):
     _value_check((N.is_integer, N.is_nonnegative),
                  "'N' must be nonnegative integer. N = %s." % str(n))
     _value_check((n.is_integer, n.is_nonnegative),
                  "'n' must be nonnegative integer. n = %s." % str(n))
     _value_check((m.is_integer, m.is_nonnegative),
                  "'m' must be nonnegative integer. m = %s." % str(n))
Exemplo n.º 14
0
 def check(n, p):
     _value_check(n > 0,
                     "number of trials must be a positive integer")
     for p_k in p:
         _value_check((p_k >= 0, p_k <= 1),
                     "probability must be in range [0, 1]")
     _value_check(Eq(sum(p), 1),
                     "probabilities must sum to 1")
Exemplo n.º 15
0
 def check(p, succ, fail):
     _value_check((p >= 0, p <= 1), "p should be in range [0, 1].")
Exemplo n.º 16
0
 def check(density):
     for p in density.values():
         _value_check((p >= 0, p <= 1),
                      "Probability at a point must be between 0 and 1.")
     _value_check(Eq(sum(density.values()), 1),
                  "Total Probability must be 1.")
Exemplo n.º 17
0
 def check(s):
     _value_check(s > 1, 's should be greater than 1')
Exemplo n.º 18
0
 def check(a, b):
     _value_check(a > 0, "alpha must be positive")
     _value_check(b > 0, "beta must be positive")
Exemplo n.º 19
0
 def check(pdf, set):
     x = Dummy('x')
     val = Sum(pdf(x), (x, set._inf, set._sup)).doit()
     _value_check(
         Eq(val, 1) != S.false, "The pdf is incorrect on the given set.")
Exemplo n.º 20
0
 def check(mu1, mu2):
     _value_check(mu1 >= 0, 'Parameter mu1 must be >= 0')
     _value_check(mu2 >= 0, 'Parameter mu2 must be >= 0')
Exemplo n.º 21
0
 def check(mu, s):
     _value_check(s > 0, "s must be positive")
Exemplo n.º 22
0
 def check(p):
     _value_check((p > 0, p < 1), "p should be between 0 and 1")
Exemplo n.º 23
0
 def check(rate):
     _value_check(rate > 0, "Rate must be positive.")
Exemplo n.º 24
0
 def check(alpha, beta):
     _value_check(alpha > 0, "Alpha must be positive")
     _value_check(beta > 0, "Beta must be positive")
Exemplo n.º 25
0
 def check(p):
     _value_check(And(p > 0, p < 1), "p should be between 0 and 1")
Exemplo n.º 26
0
 def check(r, p):
     _value_check(r > 0, 'r should be positive')
     _value_check(And(p > 0, p < 1), 'p should be between 0 and 1')
Exemplo n.º 27
0
 def check(s):
     _value_check(s > 1, 's should be greater than 1')
Exemplo n.º 28
0
 def check(rho):
     _value_check(rho > 0, 'rho should be positive')
Exemplo n.º 29
0
 def check(self, mu, lamda, alpha, beta):
     _value_check(mu.is_real, "Location must be real.")
     _value_check(lamda > 0, "Lambda must be positive")
     _value_check(alpha > 0, "alpha must be positive")
     _value_check(beta > 0, "beta must be positive")
Exemplo n.º 30
0
 def check(a1, a2):
     _value_check(a1.is_nonnegative, 'Parameter a1 must be >= 0.')
     _value_check(a2.is_nonnegative, 'Parameter a2 must be >= 0.')
Exemplo n.º 31
0
 def check(k, theta):
     _value_check(k > 0, "k must be positive")
     _value_check(theta > 0, "Theta must be positive")
Exemplo n.º 32
0
 def check(r, p):
     _value_check(r > 0, 'r should be positive')
     _value_check((p > 0, p < 1), 'p should be between 0 and 1')
Exemplo n.º 33
0
 def check(xm, alpha):
     _value_check(xm > 0, "Xm must be positive")
     _value_check(alpha > 0, "Alpha must be positive")
Exemplo n.º 34
0
 def check(lamda):
     _value_check(lamda > 0, "Lambda must be positive")
Exemplo n.º 35
0
 def check(nu, location_matrix, scale_matrix_1, scale_matrix_2):
     if not isinstance(scale_matrix_1, MatrixSymbol):
         _value_check(scale_matrix_1.is_positive_definite != False,
                      "The shape "
                      "matrix must be positive definite.")
     if not isinstance(scale_matrix_2, MatrixSymbol):
         _value_check(scale_matrix_2.is_positive_definite != False,
                      "The shape "
                      "matrix must be positive definite.")
     _value_check(scale_matrix_1.is_square != False,
                  "Scale matrix 1 should be "
                  "be square matrix")
     _value_check(scale_matrix_2.is_square != False,
                  "Scale matrix 2 should be "
                  "be square matrix")
     n = location_matrix.shape[0]
     p = location_matrix.shape[1]
     _value_check(
         scale_matrix_1.shape[0] == p, "Scale matrix 1 should be"
         " of shape %s x %s" % (str(p), str(p)))
     _value_check(
         scale_matrix_2.shape[0] == n, "Scale matrix 2 should be"
         " of shape %s x %s" % (str(n), str(n)))
     _value_check(nu.is_positive != False,
                  "Degrees of freedom must be positive")
Exemplo n.º 36
0
 def check(rho):
     _value_check(rho > 0, 'rho should be positive')
Exemplo n.º 37
0
 def check(k):
     _value_check(k.is_integer and k.is_positive,
                  "'k' must be a positive integer.")
Exemplo n.º 38
0
 def check(a, b):
     _value_check(a > 0, "a must be positive")
     _value_check(b > 0, "b must be positive")
Exemplo n.º 39
0
 def check(mean, std):
     _value_check(std > 0, "Standard deviation must be positive")
Exemplo n.º 40
0
 def check(sides):
     _value_check(
         (sides.is_positive, sides.is_integer),
         "number of sides must be a positive integer.",
     )
Exemplo n.º 41
0
 def check(a):
     _value_check((0 < a, a < 1), "a must be between 0 and 1")
Exemplo n.º 42
0
 def check(n, p, succ, fail):
     _value_check((n.is_integer, n.is_nonnegative),
                  "'n' must be nonnegative integer.")
     _value_check((p <= 1, p >= 0), "p should be in range [0, 1].")
Exemplo n.º 43
0
 def check(p):
     _value_check((0 < p, p <= 1), "p must be between 0 and 1")
Exemplo n.º 44
0
 def check(lamda):
     _value_check(lamda > 0, "Lambda must be positive")
Exemplo n.º 45
0
 def check(p):
     _value_check(And(0 < p, p <= 1), "p must be between 0 and 1")
Exemplo n.º 46
0
 def check(self, mu, sigma):
     _value_check(len(mu) == len(sigma.col(0)),
         "Size of the mean vector and covariance matrix are incorrect.")
     #check if covariance matrix is positive definite or not.
     _value_check(all([Gt(i, 0) != False for i in sigma.eigenvals().keys()]),
         "The covariance matrix must be positive definite. ")
Exemplo n.º 47
0
 def check(p):
     _value_check(0 < p and p <= 1, "p must be between 0 and 1")