Skip to content

Commit 1a24abf

Browse files
Updated PyMC3 and Theano Example (#5292)
* Updated Example -Typo Corrections -Missing imports -Typecasting to int32 for the custom function, originally omitted * Run pre-commit Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 6a580cc commit 1a24abf

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/source/PyMC3_and_Theano.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ arbitrarily chosen) function
3737
First, we need to define symbolic variables for our inputs (this
3838
is similar to eg SymPy's `Symbol`)::
3939

40+
import pymc as pm
41+
import numpy
4042
import theano
4143
import theano.tensor as tt
4244
# We don't specify the dtype of our input variables, so it
@@ -75,7 +77,7 @@ We can call this function with actual arrays as many times as we want::
7577

7678
a_val = 1.2
7779
x_vals = np.random.randn(10)
78-
y_vals = np.random.randn(10)
80+
y_vals = np.int32(np.random.randn(10))
7981

8082
out = func(a_val, x_vals, y_vals)
8183

@@ -167,8 +169,8 @@ we generate a Theano variable. And for each variable (observed or otherwise)
167169
we add a term to the global logp. In the background something similar to
168170
this is happening::
169171

170-
# For illustration only, those functions don't actually exist
171-
# in exactly this way!
172+
# For illustration only, these functions don't exactly
173+
# work this way!
172174
model = pm.Model()
173175

174176
mu = tt.scalar('mu')

0 commit comments

Comments
 (0)