Distributions¶
These distributions can be used in any place that Nengo distributions can be used.
|
Concatenate distributions to form an independent multivariate |
|
Generalized multivariate distribution. |
|
|
|
Choose values in order from an array |
|
|
|
|
|
-
class
nengo_extras.dists.Concatenate(distributions)[source]¶ Concatenate distributions to form an independent multivariate
-
sample(self, n, d=None, rng=numpy.random)[source]¶ Samples the distribution.
- Parameters
- nint
Number samples to take.
- dint or None, optional
The number of dimensions to return. If this is an int, the return value will be of shape
(n, d). If None, the return value will be of shape(n,).- rng
numpy.random.RandomState, optional Random number generator state.
- Returns
- samples(n,) or (n, d) array_like
Samples as a 1d or 2d array depending on
d. The second dimension enumerates the dimensions of the process.
-
-
class
nengo_extras.dists.MultivariateCopula(marginal_icdfs, rho=None)[source]¶ Generalized multivariate distribution.
Uses the copula method to sample from a general multivariate distribution, given marginal distributions and copula covariances [1].
- Parameters
- marginal_icdfsiterable
List of functions, each one being the inverse CDF of the marginal distribution across that dimension.
- rhoarray_like (optional)
Array of copula covariances [1] between parameters. Defaults to the identity matrix (independent parameters).
See also
References
- 1(1,2)
Copula (probability theory). Wikipedia. https://en.wikipedia.org/wiki/Copula_(probability_theory%29
-
sample(self, n, d=None, rng=numpy.random)[source]¶ Samples the distribution.
- Parameters
- nint
Number samples to take.
- dint or None, optional
The number of dimensions to return. If this is an int, the return value will be of shape
(n, d). If None, the return value will be of shape(n,).- rng
numpy.random.RandomState, optional Random number generator state.
- Returns
- samples(n,) or (n, d) array_like
Samples as a 1d or 2d array depending on
d. The second dimension enumerates the dimensions of the process.
-
class
nengo_extras.dists.MultivariateGaussian(mean, cov)[source]¶ -
sample(self, n, d=None, rng=numpy.random)[source]¶ Samples the distribution.
- Parameters
- nint
Number samples to take.
- dint or None, optional
The number of dimensions to return. If this is an int, the return value will be of shape
(n, d). If None, the return value will be of shape(n,).- rng
numpy.random.RandomState, optional Random number generator state.
- Returns
- samples(n,) or (n, d) array_like
Samples as a 1d or 2d array depending on
d. The second dimension enumerates the dimensions of the process.
-
-
class
nengo_extras.dists.Mixture(distributions, p=None)[source]¶ -
sample(self, n, d=None, rng=numpy.random)[source]¶ Samples the distribution.
- Parameters
- nint
Number samples to take.
- dint or None, optional
The number of dimensions to return. If this is an int, the return value will be of shape
(n, d). If None, the return value will be of shape(n,).- rng
numpy.random.RandomState, optional Random number generator state.
- Returns
- samples(n,) or (n, d) array_like
Samples as a 1d or 2d array depending on
d. The second dimension enumerates the dimensions of the process.
-
-
class
nengo_extras.dists.Tile(values)[source]¶ Choose values in order from an array
This distribution is not random, but rather tiles an array to be a particular size. This is useful for example if you want to pass an array for a neuron parameter, but are not sure how many neurons there will be.
- Parameters
- valuesarray_like
The values to tile.
-
sample(self, n, d=None, rng=numpy.random)[source]¶ Samples the distribution.
- Parameters
- nint
Number samples to take.
- dint or None, optional
The number of dimensions to return. If this is an int, the return value will be of shape
(n, d). If None, the return value will be of shape(n,).- rng
numpy.random.RandomState, optional Random number generator state.
- Returns
- samples(n,) or (n, d) array_like
Samples as a 1d or 2d array depending on
d. The second dimension enumerates the dimensions of the process.