コード例 #1
0
 def __init__(self, sampler, a=2, b=2):
     """
     Args:
         sampler (DiscreteDistribution/TrueMeasure): A 
             discrete distribution from which to transform samples or a
             true measure by which to compose a transform 
         a (ndarray): a 
         b (ndarray): b
     """
     self.parameters = ['a', 'b']
     self.domain = array([[0, 1]])
     self.range = array([[0, 1]])
     self._parse_sampler(sampler)
     self.a = a
     self.b = b
     if isscalar(self.a):
         a = tile(self.a, self.d)
     if isscalar(self.b):
         b = tile(self.b, self.d)
     self.alpha = array(a)
     self.beta = array(b)
     if len(self.alpha) != self.d or len(self.beta) != self.d:
         raise DimensionError(
             'a and b must be scalar or have length equal to dimension.')
     super(Kumaraswamy, self).__init__()
コード例 #2
0
 def _set_dimension(self, dimension):
     l0 = self.l[0]
     if (self.l!=l0).any():
         raise DimensionError('''
             In order to change dimension of a Continuous Bernoulli measure
             lam must all be the same.''')
     self.d = dimension
     self.l = tile(l0,self.d)
コード例 #3
0
 def _set_dimension(self, dimension):
     a = self.alpha[0]
     b = self.beta[0]
     if not (all(self.alpha == a) and all(self.beta == b)):
         raise DimensionError('''
             In order to change dimension of a Kumaraswamy measure
             a must all be the same and 
             b must all be the same''')
     self.d = dimension
     self.alpha = tile(a, self.d)
     self.beta = tile(b, self.d)
コード例 #4
0
 def _set_dimension(self, dimension):
     gamma = self._gamma[0]
     xi = self._xi[0]
     delta = self._delta[0]
     lam = self._lam[0]
     if not (all(self._gamma == gamma) and all(self._xi == xi)
             and all(self._delta == delta) and all(self._lam == lam)):
         raise DimensionError('''
             In order to change dimension of a Johnson's S_U measure
             gamma must all be the same and 
             xi must all be the same and 
             delta must all be the same and 
             lam (lambda) must all be the same.''')
     self.d = dimension
     self._gamma = tile(gamma, self.d)
     self._xi = tile(xi, self.d)
     self._delta = tile(delta, self.d)
     self._lam = tile(lam, self.d)
コード例 #5
0
 def __init__(self, sampler, lam=1/2, b=2):
     """
     Args:
         sampler (DiscreteDistribution/TrueMeasure): A 
             discrete distribution from which to transform samples or a
             true measure by which to compose a transform 
         lam (ndarray): lambda, a shape parameter, independent for each dimension 
     """
     self.parameters = ['lam']
     self.domain = array([[0,1]])
     self.range = array([[0,1]])
     self._parse_sampler(sampler)
     self.lam = lam
     if isscalar(self.lam):
         lam = tile(self.lam,self.d)
     self.l = array(lam)
     if len(self.l)!=self.d or (self.l<=0).any() or (self.l>=1).any():
         raise DimensionError('lam must be scalar or have length equal to dimension and must be in (0,1).')
     super(BernoulliCont,self).__init__() 
コード例 #6
0
 def __init__(self, sampler, gamma=1, xi=1, delta=2, lam=2):
     """
     Args:
         sampler (DiscreteDistribution/TrueMeasure): A 
             discrete distribution from which to transform samples or a
             true measure by which to compose a transform 
         gamma (ndarray): gamma
         xi (ndarray): xi
         delta (ndarray): delta
         lam (ndarray): lambda
     """
     self.parameters = ['gamma', 'xi', 'delta', 'lam']
     self.domain = array([[0, 1]])
     self.range = array([[-inf, inf]])
     self._parse_sampler(sampler)
     self.gamma = gamma
     self.xi = xi
     self.delta = delta
     self.lam = lam
     if isscalar(self.gamma):
         gamma = tile(self.gamma, self.d)
     if isscalar(self.xi):
         xi = tile(self.xi, self.d)
     if isscalar(self.delta):
         delta = tile(self.delta, self.d)
     if isscalar(self.lam):
         lam = tile(self.lam, self.d)
     self._gamma = array(gamma)
     self._xi = array(xi)
     self._delta = array(delta)
     self._lam = array(lam)
     if len(self._gamma) != self.d or len(self._xi) != self.d or len(
             self._delta) != self.d or len(self._lam) != self.d:
         raise DimensionError(
             "all Johnson's S_U parameters be scalar or have length equal to dimension."
         )
     if (self._delta <= 0).any() or (self._lam <= 0).any():
         raise ParameterError(
             "delta and lam (lambda) must be greater than 0")
     super(JohnsonsSU, self).__init__()