Skip to content

Calibration of kernel parameter inference for large number of nodes #6

@tillahoffmann

Description

@tillahoffmann

I've experimented with inferring the power exponent $\gamma$ of a preferential attachment kernel (attachment probability is $\propto k^\gamma$ for degree $k$), as discussed in the PRL paper (preprint). Everything works as expected when the number of nodes is small (tens of nodes), but I've struggled to get consistent inference when the number of nodes is large (more than a few hundred).

If we simulate from the joint distribution of parameters $\gamma$ and data $G$ and infer the posterior, then the posterior CDF evaluated at the parameter value used to generate the data should be uniformly distributed (Cook, Gelman and Rubin, 2006). However, in experiments, I don't observe such a uniform distribution.

Would love to get your input; this may just be a coding error on my part.

Here's the setup:

  1. Sample $\gamma$ from a uniform distribution on $[0,2)$.
  2. Generate a directed tree with $n$ nodes and attachment kernel $k^\gamma$ using nx.gn_graph and convert to an undirected graph.
  3. Set up a HistorySampler and evaluate the posterior on a dense grid of $\gamma$ on the prior support by calling set_kernel and get_log_posterior repeatedly; average the posteriors over all histories as in eq. (13) of the preprint.
  4. Normalize the log posterior on the support of the prior interval numerically, integrate to get the CDF on the grid, interpolate the CDF, and evaluate the interpolated CDF at the parameter value $\gamma$ used to generate the graph; let's call that value $c$.
  5. Repeat steps 1–4 to get a large number of $c$ s.

Here's a figure of the results for 50 nodes, 200 history samples, 501 grid points for evaluating the log posterior, and 101 repeats. Panel (a) show a randomly chosen posterior with the true value as a vertical line as a sanity check; they usually look reasonable. Panel (b) shows the sorted $c$ s plotted against the uniformly increasing values we'd expect. There's a small bump around 0.3, but things look reasonable. Panel (c) shows posterior means with 1.96 posterior standard deviation error bars plotted against parameters used to generate the data; again, things look good. Panel (d) shows the data-averaged posteriors which should recover the prior (dotted horizontal line; see eq. (1) of Talts et al. (2018) for details); maybe some slight deviation but no obvious problems.

Here's the same figure for 500 nodes, 1000 history samples, and 101 repeats. I increased the number of history samples because I thought there might be more uncertainty regarding histories for large graphs; not sure whether that's actually the case. But more is more, right? The $c$ s in panel (b) diverge significantly from what we'd expect: the posterior CDF evaluated at the "true" parameter value is too large. This means that the posterior tends to underestimate the "true" parameter values. This is not particularly obvious in panel (c), but, for $\gamma\gtrsim 1.5$ one can see the departure from the diagonal (colors indicate $c$ s).

I've also tried increasing the number of grid points because more precise posteriors for larger graphs may suffer from discretization artifacts. This didn't seem to have an effect though (see below; although with number of history samples reduced to 200 because it would've taken a few hours otherwise).

Do you know what might be going on here or where I've misunderstood? Code to reproduce is here. Thanks for your time!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions