You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In basic.py, we have this definition of the icdf helper function:
def icdf(rv: TensorVariable, value: TensorLike, **kwargs) -> TensorVariable:
"""Create a graph for the inverse CDF of a Random Variable."""
value = pt.as_tensor_variable(value, dtype=rv.dtype)
try:
return _icdf_helper(rv, value, **kwargs)
except NotImplementedError:
# Try to rewrite rv
fgraph, rv_values, _ = construct_ir_fgraph({rv: value})
[ir_rv] = fgraph.outputs
return _icdf_helper(ir_rv, value, **kwargs)
I specifically have a concern about value = pt.as_tensor_variable(value, dtype=rv.dtype)
Should not the input type to icdf function be a floating point type? (Type of probability value). rv.dtype can be integer too, such as for discrete distributions and is not the right type for the probability value input to the icdf function.
TensorType(int64, ()) cannot store accurately value 0.1, it would be represented as 0. If you do not mind this precision loss, you can: 1) explicitly convert your data to a numpy array of dtype int64, or 2) set"allow_input_downcast=True" when calling "function".
Describe the issue:
In basic.py, we have this definition of the icdf helper function:
I specifically have a concern about
value = pt.as_tensor_variable(value, dtype=rv.dtype)
Should not the input type to icdf function be a floating point type? (Type of probability value).
rv.dtype
can be integer too, such as for discrete distributions and is not the right type for the probability value input to the icdf function.Reproduceable code example:
Error message:
PyMC version information:
pytensor: 2.10.1
Python: 3.10.10
PyMC: latest commit b7764dd
Context for the issue:
I would like to implement a util function for a self consistency test for ICDF and logcdf of discrete distributions.
That is, to check if:
value = icdf(dist, exp(logcdf(dist, value)))
The text was updated successfully, but these errors were encountered: