Does anyone have an example of what the point argument on dist.random does?

The distributions in pymc3 have a method called random which has an argument called point

The documentation states

point (dict, optional) – Dict of variable values on which random values are to be conditioned (uses default point if not specified).

but in plain English what does this mean? Or even better is there a practical example that shows when this functionality should be used or how it is used?

https://docs.pymc.io/api/distributions/continuous.html#pymc3.distributions.continuous.Normal.random

The point argument is like the test point. Like you do `model.logp(model.test_point)`, the random is called via `RV.random(model.test_point)`:

``````import pymc3 as pm
import numpy as np

alpha, sigma = 1, 1
beta = 2.5
size = 100
X1 = np.linspace(0, 1, size)
Y = alpha + beta * X1 + np.random.randn(size) * sigma

with pm.Model() as m:
alpha = pm.Normal('alpha', mu=0, sd=10)
beta = pm.Normal('beta', mu=0, sd=10)
sigma = pm.HalfNormal('sigma', sd=1)
mu = alpha + beta * X1
Y_obs = pm.Normal('Y_obs', mu=mu, sd=sigma, observed=Y)
``````
``````point = m.test_point
point
# {'alpha': array(0.), 'beta': array(0.), 'sigma_log__': array(-0.22579135)}

y_gen = Y_obs.distribution.random(point=point)
plt.plot(X1, y_gen)
plt.plot(X1, Y, 'o');

point['alpha'] = 1
point['beta'] = 2.5
y_gen = Y_obs.distribution.random(point=point)
plt.plot(X1, y_gen)
plt.plot(X1, Y, 'o');
``````