Skip to content

Commit

Permalink
update hichical models presentation
Browse files Browse the repository at this point in the history
  • Loading branch information
juanitorduz committed Aug 21, 2024
1 parent 59de4e5 commit cf741a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<link href="intro_hierarchical_models_files/libs/quarto-html/light-border.css" rel="stylesheet">
<link href="intro_hierarchical_models_files/libs/quarto-html/quarto-html.min.css" rel="stylesheet" data-mode="light">
<link href="intro_hierarchical_models_files/libs/quarto-html/quarto-syntax-highlighting.css" rel="stylesheet" id="quarto-text-highlighting-styles"><meta charset="utf-8">
<meta name="generator" content="quarto-1.5.54">
<meta name="generator" content="quarto-1.5.56">

<meta name="author" content="Dr.&nbsp;Juan Orduz">
<title>Introduction to Hierarchical Models</title>
Expand Down Expand Up @@ -420,7 +420,7 @@ <h2>Outline</h2>
<li class="fragment">Data: EDA</li>
<li class="fragment">Models
<ul>
<li class="fragment">Pooled</li>
<li class="fragment">Unpooled</li>
<li class="fragment">Hierarchical
<ul>
<li class="fragment">Non-Centered Parametrization</li>
Expand All @@ -429,6 +429,7 @@ <h2>Outline</h2>
<li class="fragment">Hierarchical with Correlated Random Effects</li>
</ul></li>
<li class="fragment">Predictions for a New Region</li>
<li class="fragment">Appendix: Hierarchical Pricing Elasticity Models at Scale</li>
</ul>
</div>
</div><div class="column" style="width:50%;">
Expand Down Expand Up @@ -523,8 +524,8 @@ <h2>Base Model - Unpooled</h2>
<p>See <a href="https://bayesiancomputationbook.com/markdown/chp_04.html#unpooled-parameters">Bayesian Modeling and Computation in Python, Chapter 4.5.1: Unpooled Parameters</a></p>
</div>
</section>
<section id="base-model---pooled-pymc" class="slide level2">
<h2>Base Model - Pooled (PyMC)</h2>
<section id="base-model---unpooled-pymc" class="slide level2">
<h2>Base Model - Unpooled (PyMC)</h2>
<div class="sourceCode" id="cb1" data-code-line-numbers="|1|3|4-7|9-18|20-27"><pre class="sourceCode numberSource python number-lines code-with-copy"><code class="sourceCode python"><span id="cb1-1"><a href=""></a>coords <span class="op">=</span> {<span class="st">"region"</span>: region, <span class="st">"obs"</span>: obs}</span>
<span id="cb1-2"><a href=""></a></span>
<span id="cb1-3"><a href=""></a><span class="cf">with</span> pm.Model(coords<span class="op">=</span>coords) <span class="im">as</span> base_model:</span>
Expand Down Expand Up @@ -553,8 +554,8 @@ <h2>Base Model - Pooled (PyMC)</h2>
<span id="cb1-26"><a href=""></a> dims<span class="op">=</span><span class="st">"obs"</span></span>
<span id="cb1-27"><a href=""></a> )</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
</section>
<section id="base-model---pooled-plate-notation" class="slide level2">
<h2>Base Model - Pooled (Plate Notation)</h2>
<section id="base-model---unpooled-1" class="slide level2">
<h2>Base Model - Unpooled</h2>
<div class="quarto-figure quarto-figure-center">
<figure>
<p><img data-src="intro_hierarchical_models_files/images/blog/multilevel_elasticities_single_sku_33_0.svg" class="quarto-figure quarto-figure-center" height="600"></p>
Expand Down Expand Up @@ -831,7 +832,7 @@ <h2>Thank you!</h2>
</section>
<section id="appendix" class="slide level2">
<h2>Appendix</h2>
<h3 id="hierarchical-pricing-elasticity-models">Hierarchical Pricing Elasticity Models</h3>
<h3 id="hierarchical-pricing-elasticity-models-at-scale">Hierarchical Pricing Elasticity Models at Scale</h3>
<div class="quarto-figure quarto-figure-center">
<figure>
<p><img data-src="intro_hierarchical_models_files/images/elasticities_45_0.svg" class="quarto-figure quarto-figure-center" height="500"></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ format:
- Business Case: Price Elasticity
- Data: EDA
- Models
- Pooled
- Unpooled
- Hierarchical
- Non-Centered Parametrization
- Shrinkage Effect
- Hierarchical with Correlated Random Effects
- Predictions for a New Region
- Appendix: Hierarchical Pricing Elasticity Models at Scale

:::

Expand Down Expand Up @@ -135,7 +136,7 @@ $$
See [Bayesian Modeling and Computation in Python, Chapter 4.5.1: Unpooled Parameters](https://bayesiancomputationbook.com/markdown/chp_04.html#unpooled-parameters)
:::

## Base Model - Pooled (PyMC)
## Base Model - Unpooled (PyMC)

``` {.python code-line-numbers="|1|3|4-7|9-18|20-27"}
coords = {"region": region, "obs": obs}
Expand Down Expand Up @@ -167,7 +168,7 @@ with pm.Model(coords=coords) as base_model:
)
```

## Base Model - Pooled (Plate Notation)
## Base Model - Unpooled

![](intro_hierarchical_models_files/images/blog/multilevel_elasticities_single_sku_33_0.svg){fig-align="center" height="600"}

Expand Down Expand Up @@ -407,7 +408,7 @@ All data and code are available on the blog posts:
![](intro_hierarchical_models_files/images/juanitorduz.png){.absolute bottom=0 left=0 height=300}

## Appendix
### Hierarchical Pricing Elasticity Models
### Hierarchical Pricing Elasticity Models at Scale

![](intro_hierarchical_models_files/images/elasticities_45_0.svg){fig-align="center" height="500"}

Expand Down

0 comments on commit cf741a8

Please sign in to comment.