Use of pm.Potential in Survival Analysis Example

I am working through the pymc3 Bayesian Survival Analysis example at the link below and I’m struggling to understand their use of pm.Potential :

The heart of the example comes down to the following two snippets of code:

y_obs = pm.Gumbel("y_obs", η[~cens_], s, observed=y_std[~cens])
y_cens = pm.Potential("y_cens", gumbel_sf(y_std[cens], η[cens_], s))

Basically what is being done is they are modeling observed survival as a Gumbel distribution and censoring as a Gumbel survival function. In general that sort of makes sense to me. I do think I understand how observed deaths and observed censoring mathematically relate to these distributions. I just don’t understand what pm.Potential is doing. In fact, if I take it out it doesn’t appear to affect anything.

Can anyone educate me on the function of pm.Potential in the above example? I watched @junpenglao’s PyData but the above still wasn’t clear.

I got help on this from stack exchange: bayesian - Use of pm.Potential in Pymc3 Survival example - Cross Validated

If you upgrade to v4, then you get a way better API for censored data. See here for an example: Bayesian regression with truncated or censored data — PyMC documentation