Univariate Normal Distribution¶
-
breze.arch.component.distributions.normal.
pdf
(sample, location=0, scale=1)¶ Return a theano expression representing the values of the probability density function of a Gaussian distribution.
Parameters: sample : Theano variable
Array of shape
(n,)
wheren
is the number of samples.location : Theano variable
Scalar representing the mean of the distribution.
scale : Theano variable
Scalar representing the standard deviation of the distribution.
Returns: l : Theano variable
Array of shape
(n,)
where each entry represents the density of the corresponding sample.Examples
>>> import theano >>> import theano.tensor as T >>> import numpy as np >>> from breze.learn.utils import theano_floatx >>> sample, mean, std = T.vector(), T.scalar(), T.scalar() >>> p = pdf(sample, mean, std) >>> f_p = theano.function([sample, mean, std], p)
>>> X, = theano_floatx(np.array([-1, 0, 1])) >>> ps = f_p(X, 0.1, 1.2) >>> np.allclose(ps, [0.21840613, 0.33129956, 0.25094786]) True
-
breze.arch.component.distributions.normal.
cdf
(sample, location=0, scale=1)¶ Return a theano expression representing the values of the cumulative density function of a Gaussian distribution.
Parameters: sample : Theano variable
Array of shape
(n,)
wheren
is the number of samples.location : Theano variable
Scalar representing the mean of the distribution.
scale : Theano variable
Scalar representing the standard deviation of the distribution.
Returns: l : Theano variable
Array of shape
(n,)
where each entry represents the cumulative density of the corresponding sample.Examples
>>> import theano >>> import theano.tensor as T >>> import numpy as np >>> from breze.learn.utils import theano_floatx >>> sample, mean, std = T.vector(), T.scalar(), T.scalar() >>> c = cdf(sample, mean, std) >>> f_c = theano.function([sample, mean, std], c)
>>> X, = theano_floatx(np.array([-1, 0, 1])) >>> cs = f_c(X, 0.1, 1.2) >>> np.allclose(cs, [0.17965868, 0.46679324, 0.77337265]) True