Skip to content

Commit 675f8c8

Browse files
committed
minor edits
1 parent 4fc408d commit 675f8c8

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

pymc3/distributions/continuous.py

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4224,27 +4224,26 @@ class Interpolated(BoundedContinuous):
42244224
plain array-like objects, so they are constant and cannot be sampled.
42254225
42264226
.. plot::
4227-
import matplotlib.pyplot as plt
4228-
import numpy as np
4229-
import pymc3 as pm
4230-
import arviz as az
4231-
import warnings
4232-
warnings.simplefilter(action="ignore", category=FutureWarning)
4233-
from scipy.stats import gamma
4234-
rv = gamma(1.99)
4235-
x = np.linspace(rv.ppf(0.01),rv.ppf(0.99), 1000)
4236-
points = np.linspace(x[0], x[-1], 50)
4237-
pdf = rv.pdf(points)
4238-
interpolated = pm.Interpolated.dist(points, pdf)
4239-
plt.style.use('arviz-darkgrid')
4240-
fig, ax = plt.subplots(1, 1)
4241-
ax.plot(x, rv.pdf(x), 'C0', linestyle = '--', label='Original Gamma pdf',alpha=0.8,lw=2)
4242-
ax.plot(points, pdf, color='black', marker='o', label='Lattice Points',alpha=0.5,linestyle='')
4243-
ax.plot(x, np.exp(interpolated.logp(x).eval()),'C1',label='Interpolated pdf',alpha=0.8,lw=3)
4244-
r = interpolated.random(size=1000)
4245-
ax.hist(r, density=True, histtype='stepfilled', alpha=0.4,align ='right',color='grey')
4246-
ax.legend(loc='best', frameon=False)
4247-
plt.show()
4227+
4228+
import matplotlib.pyplot as plt
4229+
import numpy as np
4230+
import pymc3 as pm
4231+
import arviz as az
4232+
from scipy.stats import gamma
4233+
rv = gamma(1.99)
4234+
x = np.linspace(rv.ppf(0.01),rv.ppf(0.99), 1000)
4235+
points = np.linspace(x[0], x[-1], 50)
4236+
pdf = rv.pdf(points)
4237+
interpolated = pm.Interpolated.dist(points, pdf)
4238+
plt.style.use('arviz-darkgrid')
4239+
fig, ax = plt.subplots(1, 1)
4240+
ax.plot(x, rv.pdf(x), 'C0', linestyle = '--', label='Original Gamma pdf',alpha=0.8,lw=2)
4241+
ax.plot(points, pdf, color='black', marker='o', label='Lattice Points',alpha=0.5,linestyle='')
4242+
ax.plot(x, np.exp(interpolated.logp(x).eval()),'C1',label='Interpolated pdf',alpha=0.8,lw=3)
4243+
r = interpolated.random(size=1000)
4244+
ax.hist(r, density=True, histtype='stepfilled', alpha=0.4,align ='right',color='grey')
4245+
ax.legend(loc='best', frameon=False)
4246+
plt.show()
42484247
42494248
======== ===========================================
42504249
Support :math:`x \in [x\_points[0], x\_points[-1]]`

0 commit comments

Comments
 (0)