{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Sampler statistics\n", "\n", "When checking for convergence or when debugging a badly behaving\n", "sampler, it is often helpful to take a closer look at what the\n", "sampler is doing. For this purpose some samplers export\n", "statistics for each generated sample." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import seaborn as sb\n", "import pandas as pd\n", "import pymc3 as pm \n", "\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As a minimal example we sample from a standard normal distribution:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "model = pm.Model()\n", "with model:\n", " mu1 = pm.Normal(\"mu1\", mu=0, sigma=1, shape=10)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Multiprocess sampling (2 chains in 2 jobs)\n", "NUTS: [mu1]\n" ] }, { "data": { "text/html": [ "\n", "