Math#
This submodule contains various mathematical functions. Most of them are imported directly from pytensor.tensor (see there for more details). Doing any kind of math with PyMC random variables, or defining custom likelihoods or priors requires you to use these PyTensor expressions rather than NumPy or Python code.
Functions exposed in pymc namespace#
|
Convert a packed triangular matrix into a two dimensional array. |
|
|
Logistic sigmoid function (1 / (1 + exp(-x)), also known as expit or inverse logit |
|
|
|
|
|
|
Logarithm of the sum of exponentiations of the inputs. |
|
Compute the log of the sum of exponentials of input elements. |
Functions exposed in pymc.math#
|
Computes the product along the given axis(es) of a tensor input. |
|
Return a symbolic dot product. |
a == b |
|
a != b |
|
a >= b |
|
a > b |
|
a <= b |
|
a < b |
|
e^`a` |
|
base e logarithm of a |
|
|
sign of a |
square of a |
|
square root of a |
|
|
Computes the sum along the given axis(es) of a tensor input. |
ceiling of a |
|
floor of a |
|
sine of a |
|
hyperbolic sine of a |
|
arcsine of a |
|
hyperbolic arc sine of a |
|
cosine of a |
|
hyperbolic cosine of a |
|
arccosine of a |
|
hyperbolic arc cosine of a |
|
tangent of a |
|
hyperbolic tangent of a |
|
arctangent of a |
|
hyperbolic arc tangent of a |
|
|
Return the cumulative product of the elements along a given axis. |
|
Return the cumulative sum of the elements along a given axis. |
|
Compute the matrix product of two tensor variables. |
bitwise a & b |
|
|
Broadcast an array to a new shape. |
Clip x to be between min and max. |
|
|
|
|
Return a copy of the array collapsed into one dimension. |
bitwise a | b |
|
|
Stack tensors in sequence on given axis (default is 0). |
if cond then ift else iff |
|
if cond then ift else iff |
|
|
|
|
Return a TensorConstant with value x. |
|
Returns maximum elements obtained by iterating over given axis. |
elemwise maximum. |
|
|
Computes the mean value along the given axis(es) of a tensor input. |
|
Returns minimum elements obtained by iterating over given axis. |
elemwise minimum. |
|
|
round_mode(a) with mode in [half_away_from_zero, half_to_even]. |
error function |
|
complementary error function |
|
inverse complementary error function |
|
inverse error function |
|
Compute log(1 + exp(x)), also known as softplus or log1pexp |
|
|
Return log(1 - exp(-x)). |
|
Logarithm of the sum of exponentiations of the inputs. |
|
Compute the log of the sum of exponentials of input elements. |
|
|
|
|
Logistic sigmoid function (1 / (1 + exp(-x)), also known as expit or inverse logit |
|
|
|
|
|
Logistic sigmoid function (1 / (1 + exp(-x)), also known as expit or inverse logit |
|
|
|
|
|
|
|
|
Return a new array of given shape and type, filled with fill_value. |
|
Equivalent of numpy.full_like. |
|
Create a TensorVariable filled with ones, closer to NumPy's syntax than |
|
equivalent of numpy.ones_like Parameters ---------- model : tensor dtype : data-type, optional opt : If True, we will return a constant instead of a graph when possible. Useful for PyTensor optimization, not for user building a graph as this have the consequence that model isn't always in the graph. |
|
Create a TensorVariable filled with zeros, closer to NumPy's syntax than |
|
equivalent of numpy.zeros_like Parameters ---------- model : tensor dtype : data-type, optional opt : If True, we will return a constant instead of a graph when possible. Useful for PyTensor optimization, not for user building a graph as this have the consequence that model isn't always in the graph. |
|
Return the Kronecker product of arguments: |
|
Makes the Cartesian product of arrays. |
|
Apply op to krons and m in a way that reproduces |
|
Apply op to krons and m in a way that reproduces |
|
Apply op to krons and m in a way that reproduces |
|
Returns diagonal of a kronecker product. |
|
|
|
Convert a packed triangular matrix into a two dimensional array. |
|
|
|
See pt.slinalg.block_diag or pytensor.sparse.basic.block_diag for reference |
Generalizes a core Op to work with batched dimensions. |
|
Compute the logarithm of the absolute determinant of a square matrix M, log(abs(det(M))) on the CPU. |