_matutils
– Cython matutils¶gensim._matutils.
digamma
¶Digamma function for positive floats, using _digamma()
.
x (float) – Positive value.
Digamma(x).
float
gensim._matutils.
dirichlet_expectation
(alpha)¶Expected value of log(theta) where theta is drawn from a Dirichlet distribution.
Using dirichlet_expectation_1d()
or dirichlet_expectation_2d()
.
alpha (numpy.ndarray) – Dirichlet parameter 2d matrix or 1d vector, if 2d - each row is treated as a separate parameter vector, supports float16, float32 and float64.
Log of expected values, dimension same as alpha.ndim.
numpy.ndarray
gensim._matutils.
dirichlet_expectation_1d
(alpha)¶Expected value of log(theta) where theta is drawn from a Dirichlet distribution.
Using _dirichlet_expectation_1d()
.
alpha (numpy.ndarray) – Dirichlet parameter 1d vector, supports float16, float32 and float64.
Log of expected values, 1d vector.
numpy.ndarray
gensim._matutils.
dirichlet_expectation_2d
(alpha)¶Expected value of log(theta) where theta is drawn from a Dirichlet distribution.
Using _dirichlet_expectation_2d()
.
alpha (numpy.ndarray) – Dirichlet parameter 2d matrix, each row is treated as a separate parameter vector, supports float16, float32 and float64.
Log of expected values, 2d matrix.
numpy.ndarray
gensim._matutils.
logsumexp
(x)¶Log of sum of exponentials, using _logsumexp_2d()
.
x (numpy.ndarray) – Input 2d matrix, supports float16, float32 and float64.
log of sum of exponentials of elements in x.
float
Warning
By performance reasons, doesn’t support NaNs or 1d, 3d, etc arrays like scipy.special.logsumexp()
.
gensim._matutils.
mean_absolute_difference
(a, b)¶Mean absolute difference between two arrays, using _mean_absolute_difference()
.
a (numpy.ndarray) – Input 1d array, supports float16, float32 and float64.
b (numpy.ndarray) – Input 1d array, supports float16, float32 and float64.
mean(abs(a - b)).
float