Ejemplo n.º 1
0
 def sample(self, n=None):
     """Return a multivariate normal sample."""
     if n is None:
         snsamps = random.standard_normal(self.ndim)
         return _mvnt.mvnsamp(self.mu, self.L, snsamps)
     samps = zeros((n, self.ndim), float)
     for i in range(n):
         snsamps = random.standard_normal(self.ndim)
         samps[i] = _mvnt.mvnsamp(self.mu, self.L, snsamps)
     return samps
Ejemplo n.º 2
0
 def sample(self, n=None):
     """Return a multivariate normal sample."""
     if n is None:
         snsamps = random.standard_normal(self.ndim)
         return _mvnt.mvnsamp(self.mu, self.L, snsamps)
     samps = zeros((n, self.ndim), float)
     for i in range(n):
         snsamps = random.standard_normal(self.ndim)
         samps[i] = _mvnt.mvnsamp(self.mu, self.L, snsamps)
     return samps
Ejemplo n.º 3
0
 def sample(self, n=None):
     """
     Return one or more samples from the KDE.
     Randomly choose a component, then return a scaled MVN sample from
     that component.
     """
     if n == None:
         n = self.randint.rvs()
         snsamps = random.standard_normal(self.ndim)
         displ = _mvnt.mvnsamp(self.origin, self.L, snsamps)
         return self.nodes[n] + self.scale * displ
     samps = zeros((n, self.ndim), float)
     for i in range(n):
         n = self.randint.rvs()
         snsamps = random.standard_normal(self.ndim)
         displ = _mvnt.mvnsamp(self.origin, self.L, snsamps)
         samps[i] = self.nodes[n] + self.scale * displ
     return samps
Ejemplo n.º 4
0
 def sample(self, n=None):
     """
     Return one or more samples from the KDE.
     Randomly choose a component, then return a scaled MVN sample from
     that component.
     """
     if n == None:
         n = self.randint.rvs()
         snsamps = random.standard_normal(self.ndim)
         displ = _mvnt.mvnsamp(self.origin, self.L, snsamps)
         return self.nodes[n] + self.scale*displ
     samps = zeros((n, self.ndim), float)
     for i in range(n):
         n = self.randint.rvs()
         snsamps = random.standard_normal(self.ndim)
         displ = _mvnt.mvnsamp(self.origin, self.L, snsamps)
         samps[i] = self.nodes[n] + self.scale*displ
     return samps