Skip to content

Commit 4fc408d

Browse files
committed
interpolated minor fixes
1 parent 5722fbd commit 4fc408d

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

pymc3/distributions/continuous.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4223,26 +4223,20 @@ class Interpolated(BoundedContinuous):
42234223
Both parameters ``x_points`` and values ``pdf_points`` are not variables, but
42244224
plain array-like objects, so they are constant and cannot be sampled.
42254225
4226-
======== ===========================================
4227-
Support :math:`x \in [x\_points[0], x\_points[-1]]`
4228-
======== ===========================================
4229-
4226+
.. plot::
42304227
import matplotlib.pyplot as plt
42314228
import numpy as np
42324229
import pymc3 as pm
4230+
import arviz as az
42334231
import warnings
42344232
warnings.simplefilter(action="ignore", category=FutureWarning)
42354233
from scipy.stats import gamma
4236-
a = 1.99
4237-
mean, var, skew, kurt = gamma.stats(a, moments='mvsk')
4238-
rv = gamma(a)
4234+
rv = gamma(1.99)
42394235
x = np.linspace(rv.ppf(0.01),rv.ppf(0.99), 1000)
42404236
points = np.linspace(x[0], x[-1], 50)
42414237
pdf = rv.pdf(points)
42424238
interpolated = pm.Interpolated.dist(points, pdf)
42434239
plt.style.use('arviz-darkgrid')
4244-
plt.style.use('tableau-colorblind10')
4245-
#plt.set_cmap('coolwarm')
42464240
fig, ax = plt.subplots(1, 1)
42474241
ax.plot(x, rv.pdf(x), 'C0', linestyle = '--', label='Original Gamma pdf',alpha=0.8,lw=2)
42484242
ax.plot(points, pdf, color='black', marker='o', label='Lattice Points',alpha=0.5,linestyle='')
@@ -4252,6 +4246,10 @@ class Interpolated(BoundedContinuous):
42524246
ax.legend(loc='best', frameon=False)
42534247
plt.show()
42544248
4249+
======== ===========================================
4250+
Support :math:`x \in [x\_points[0], x\_points[-1]]`
4251+
======== ===========================================
4252+
42554253
Parameters
42564254
----------
42574255
x_points: array-like

0 commit comments

Comments
 (0)