Are there C implementations of ExGaussian and Normal logcdf functions?

I am trying to use a custom model (i.e. defining a logp function for a custom pdf) in pymc3 that requires the logcdf of the ExGaussian and Normal distributions. I have written my own functions for them, using basic theano calls, however this results in lots of overflow (as discussed in another recent thread).

Conversely, I am trying to use:
pm.ExGaussian.dist().logcdf()
pm.Normal.dist().logcdf()

However, these run very slowly and give me the following warning:

WARNING (theano.tensor.opt): Optimization Warning: The Op erfcx does not provide a C implementation. As well as being potentially slow, this also disables loop fusion.

Is there any C implementations of these logcdf functions that can be used with pymc3?

2 Likes

Not yet. For numerical stability reasons we are relying on the ercfx method, which currently does not have c support. We have an open issue here: Add C implementation for I1e, I0e and erfcx Ops · Issue #267 · pymc-devs/aesara · GitHub

Great! Thanks for your work on getting the C implementation up and running.

@ricardoV94 I wanted to check in about the status of the C implementation of the erfcx function. Has it been utilized in the logcdf functions of ExGaussian and if so, what versions of pymc3/aesara? I was trying to follow along in the GitHub Issue you linked but it wasn’t clear to me whether or not it had been resolved. Thanks for all the work you’re doing. It’s much appreciated!

@jstanley I added the C code for erfcx, but it will only show up in the next version of pymc3 (V4) which will be using aesara. There is no stable version of pymc3 running with aesara just yet :confused:

1 Like

Thanks for the update. I’ll be patient then.