|
148 | 148 | "\n", |
149 | 149 | "Initializing a stochastic variable requires a `name` argument, plus additional parameters that are class specific. For example:\n", |
150 | 150 | "\n", |
151 | | - "`some_variable = mc.DiscreteUniform( \"discrete_uni_var\", 0, 4 )`\n", |
| 151 | + "`some_variable = mc.DiscreteUniform(\"discrete_uni_var\", 0, 4)`\n", |
152 | 152 | "\n", |
153 | 153 | "where 0,4 are the `DiscreteUniform`-specific upper and lower bound on the random variable. The [PyMC docs](http://pymc-devs.github.com/pymc/distributions.html) contain the specific parameters for stochastic variables. (Or use `??` if you are using IPython!)\n", |
154 | 154 | "\n", |
|
158 | 158 | "\n", |
159 | 159 | "The `size` argument also solves the annoying case where you may have many variables $\\beta_i, \\; i = 1,...,N$ you wish to model. Instead of creating arbitrary names and variables for each one, like:\n", |
160 | 160 | "\n", |
161 | | - " beta_1 = mc.Uniform( \"beta_1\", 0, 1)\n", |
162 | | - " beta_2 = mc.Uniform( \"beta_2\", 0, 1)\n", |
| 161 | + " beta_1 = mc.Uniform(\"beta_1\", 0, 1)\n", |
| 162 | + " beta_2 = mc.Uniform(\"beta_2\", 0, 1)\n", |
163 | 163 | " ...\n", |
164 | 164 | "\n", |
165 | 165 | "we can instead wrap them into a single variable:\n", |
166 | 166 | "\n", |
167 | | - " betas = mc.Uniform( \"betas\", 0, 1, size = N )\n", |
| 167 | + " betas = mc.Uniform(\"betas\", 0, 1, size=N)\n", |
168 | 168 | "\n", |
169 | 169 | "#### Calling `random()`\n", |
170 | 170 | "We can also call on a stochastic variable's `random()` method, which (given the parent values) will generate a new, random value. Below we demonstrate this using the texting example from the previous chapter." |
|
320 | 320 | "Inside the deterministic decorator, the `Stochastic` variables passed in behave like scalars or Numpy arrays ( if multivariable), and *not* like `Stochastic` variables. For example, running the following:\n", |
321 | 321 | "\n", |
322 | 322 | " @mc.deterministic\n", |
323 | | - " def some_deterministic( stoch = some_stochastic_var ):\n", |
| 323 | + " def some_deterministic(stoch=some_stochastic_var):\n", |
324 | 324 | " return stoch.value**2\n", |
325 | 325 | "\n", |
326 | 326 | "\n", |
|
0 commit comments