|
51 | 51 | "import theano\n",
|
52 | 52 | "import theano.tensor as tt\n",
|
53 | 53 | "\n",
|
54 |
| - "print(\"Running on PyMC3 v{}\".format(pm.__version__))" |
| 54 | + "print(f\"Running on PyMC3 v{pm.__version__}\")" |
55 | 55 | ]
|
56 | 56 | },
|
57 | 57 | {
|
|
697 | 697 | " color=colors[i],\n",
|
698 | 698 | " hist_kwargs={\"density\": True},\n",
|
699 | 699 | " **hist2dkwargs,\n",
|
700 |
| - " truths=[mtrue, ctrue]\n", |
| 700 | + " truths=[mtrue, ctrue],\n", |
701 | 701 | " )\n",
|
702 | 702 | " else:\n",
|
703 | 703 | " corner.corner(\n",
|
|
729 | 729 | "test_grad_op_func = theano.function([var], test_grad_op(var))\n",
|
730 | 730 | "grad_vals = test_grad_op_func([mtrue, ctrue])\n",
|
731 | 731 | "\n",
|
732 |
| - "print('Gradient returned by \"LogLikeGrad\": {}'.format(grad_vals))\n", |
| 732 | + "print(f'Gradient returned by \"LogLikeGrad\": {grad_vals}')\n", |
733 | 733 | "\n",
|
734 | 734 | "# test the gradient called through LogLikeWithGrad\n",
|
735 | 735 | "test_gradded_op = LogLikeWithGrad(my_loglike, data, x, sigma)\n",
|
736 | 736 | "test_gradded_op_grad = tt.grad(test_gradded_op(var), var)\n",
|
737 | 737 | "test_gradded_op_grad_func = theano.function([var], test_gradded_op_grad)\n",
|
738 | 738 | "grad_vals_2 = test_gradded_op_grad_func([mtrue, ctrue])\n",
|
739 | 739 | "\n",
|
740 |
| - "print('Gradient returned by \"LogLikeWithGrad\": {}'.format(grad_vals_2))\n", |
| 740 | + "print(f'Gradient returned by \"LogLikeWithGrad\": {grad_vals_2}')\n", |
741 | 741 | "\n",
|
742 | 742 | "# test the gradient that PyMC3 uses for the Normal log likelihood\n",
|
743 | 743 | "test_model = pm.Model()\n",
|
|
751 | 751 | " gradfunc.set_extra_values({\"m_interval__\": mtrue, \"c_interval__\": ctrue})\n",
|
752 | 752 | " grad_vals_pymc3 = gradfunc(np.array([mtrue, ctrue]))[1] # get dlogp values\n",
|
753 | 753 | "\n",
|
754 |
| - "print('Gradient returned by PyMC3 \"Normal\" distribution: {}'.format(grad_vals_pymc3))" |
| 754 | + "print(f'Gradient returned by PyMC3 \"Normal\" distribution: {grad_vals_pymc3}')" |
755 | 755 | ]
|
756 | 756 | },
|
757 | 757 | {
|
|
0 commit comments