liveBook · Manning

Hierarchical model

As explained in Machine Learning Algorithms in Depth

A hierarchical regression model represents regression relationships across groups while sharing information through higher-level parameters.

A hierarchical regression model represents relationships across groups while sharing information between them. Group-specific parameters are sampled from common distributions, allowing the model to capture both group differences and similarities. section 6.3

The model structure contrasts three ways to handle grouped observations:

  • A pooled model uses one parameter set for every observation and does not model group-specific variation. section 6.3
  • An unpooled model assigns independent parameters to each group, preventing information sharing. section 6.3
  • A hierarchical model samples group parameters from shared distributions, combining partial pooling with group-specific behavior. section 6.3

In Bayesian hierarchical regression, priors describe the higher-level distributions and group-level coefficients. For county c, an intercept αc and slope βc can be sampled from shared Gaussian distributions. Posterior distributions are then inferred with MCMC. section 6.3

County-level radon regression

A regression of house radon levels uses county membership and floor information, particularly whether a house has a basement. Each county receives its own intercept and slope while sharing higher-level distributions with other counties. section 6.3

Figure 6.3 Pooled, unpooled, and hierarchical graphical models
figure

Compare pooled, unpooled, and hierarchical graphical models to see how parameter sharing changes the regression structure. section 6.3

A practical implementation defines coefficient distributions and the data likelihood in PyMC, indexes observations by county, and runs inference with the no-U-turn sampler. section 6.3

How Machine Learning Algorithms in Depth covers it

How deep it goes
Defines pooled, unpooled, and hierarchical structures, then implements Bayesian inference without detailing sampler internals.
Examples
Uses county-level radon measurements, basement status, shared Gaussian coefficient distributions, PyMC code, and MCMC traceplots.
What it assumes
Assumes regression and Bayesian modeling context while developing group-level parameter sharing through pooled contrasts.
What you can do after
Operate/configure a Bayesian hierarchical regression in PyMC and infer posterior distributions with NUTS.
How it connects
Connects Bayesian regression with priors, MCMC, probabilistic graphical models, pooled models, and unpooled models.

Also explained in

Compare how 2 books explain hierarchical model →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning Algorithms in Depth. The section links point to the parts of the book it draws on.