Package csb :: Package statistics :: Module rand
[frames] | no frames]

Module rand

source code

Random number generators

Functions
 
gen_inv_gaussian(a, b, p, burnin=10)
Sampler based on Gibbs sampling.
source code
 
inv_gaussian(mu=1.0, _lambda=1.0, shape=None)
Generate random samples from inverse gaussian.
source code
 
probability_transform(shape, inv_cum, cum_min=0.0, cum_max=1.0)
Generic sampler based on the probability transform.
source code
3 x 3 numpy array
random_rotation(A, n_iter=10, initial_values=None)
Generation of three-dimensional random rotations in fitting and matching problems, Habeck 2009.
source code
 
sample_dirichlet(alpha, n_samples=1)
Sample points from a dirichlet distribution with parameter alpha.
source code
 
sample_from_histogram(p, n_samples=1)
returns the indice of bin according to the histogram p
source code
numpy array
sample_sphere3d(radius=1.0, n_samples=1)
Sample points from 3D sphere.
source code
 
truncated_gamma(shape=None, alpha=1.0, beta=1.0, x_min=None, x_max=None)
Generate random variates from a lower-and upper-bounded gamma distribution.
source code
 
truncated_normal(shape=None, mu=0.0, sigma=1.0, x_min=None, x_max=None)
Generates random variates from a lower-and upper-bounded normal distribution
source code
Variables
  __package__ = None
hash(x)
Function Details

gen_inv_gaussian(a, b, p, burnin=10)

source code 

Sampler based on Gibbs sampling. Assumes scalar p.

probability_transform(shape, inv_cum, cum_min=0.0, cum_max=1.0)

source code 

Generic sampler based on the probability transform.

Parameters:
  • shape - shape of the random sample
  • inv_cum - inversion of the cumulative density function from which one seeks to sample
  • cum_min - lower value of the cumulative distribution
  • cum_max - upper value of the cumulative distribution
Returns:
random variates of the PDF implied by the inverse cumulative distribution

random_rotation(A, n_iter=10, initial_values=None)

source code 

Generation of three-dimensional random rotations in fitting and matching problems, Habeck 2009.

Generate random rotation R from:

   exp(trace(dot(transpose(A), R)))
Parameters:
  • A (3 x 3 numpy array) - generating parameter
  • n_iter (integer) - number of gibbs sampling steps
  • initial_values (tuple) - initial euler angles alpha, beta and gamma
Returns: 3 x 3 numpy array

sample_dirichlet(alpha, n_samples=1)

source code 

Sample points from a dirichlet distribution with parameter alpha.

Parameters:
  • alpha (array) - alpha parameter of a dirichlet distribution

sample_from_histogram(p, n_samples=1)

source code 

returns the indice of bin according to the histogram p

Parameters:
  • p (numpy.array) - histogram
  • n_samples (integer) - number of samples to generate

sample_sphere3d(radius=1.0, n_samples=1)

source code 

Sample points from 3D sphere.

Parameters:
  • radius (float) - radius of the sphere
  • n_samples (int) - number of samples to return
Returns: numpy array
n_samples times random cartesian coordinates inside the sphere

truncated_gamma(shape=None, alpha=1.0, beta=1.0, x_min=None, x_max=None)

source code 

Generate random variates from a lower-and upper-bounded gamma distribution.

Parameters:
  • shape - shape of the random sample
  • alpha - shape parameter (alpha > 0.)
  • beta - scale parameter (beta >= 0.)
  • x_min - lower bound of variate
  • x_max - upper bound of variate
Returns:
random variates of lower-bounded gamma distribution

truncated_normal(shape=None, mu=0.0, sigma=1.0, x_min=None, x_max=None)

source code 

Generates random variates from a lower-and upper-bounded normal distribution

Parameters:
  • shape - shape of the random sample
  • mu - location parameter
  • sigma - width of the distribution (sigma >= 0.)
  • x_min - lower bound of variate
  • x_max - upper bound of variate
Returns:
random variates of lower-bounded normal distribution