<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>Inverse Complexity Lab</title>
<link>https://skewed.de/lab/blog.html</link>
<atom:link href="https://skewed.de/lab/blog.xml" rel="self" type="application/rss+xml"/>
<description></description>
<image>
<url>https://skewed.de/lab/static/research/foodweb-wsbm-lognormal.png</url>
<title>Inverse Complexity Lab</title>
<link>https://skewed.de/lab/blog.html</link>
</image>
<generator>quarto-1.9.38</generator>
<lastBuildDate>Sun, 22 Feb 2026 23:00:00 GMT</lastBuildDate>
<item>
  <title>Higher orders need higher standards</title>
  <dc:creator>Tiago P. Peixoto</dc:creator>
  <link>https://skewed.de/lab/posts/higher-standards/</link>
  <description><![CDATA[ 

<div class="h-entry e-content entry-content page-columns page-full">




<blockquote class="blockquote">
<p>TL;DR — Contrary to widespread claims in recent years, it’s not true that graphs encode “pairwise” interactions. Graphs encode neighborhoods—sets of nodes incident to other nodes—on which multivariate interactions can be defined. This has been the standard way to model networks for decades. Hypergraphs are only special cases of this standard and more general graph-based framework. We demonstrate this in a new work<span class="citation" data-cites="peixoto_graphs_2026">&nbsp;[1]</span>.</p>
</blockquote>
<section id="hype-cycles-in-network-science" class="level2">
<h2 class="anchored" data-anchor-id="hype-cycles-in-network-science">Hype cycles in network science</h2>
<p>Network science has always been a heterogeneous field, with many interesting problems and far-reaching questions, but it has also always been prone to uneven standards—presumably due to its interdisciplinary appeal and low technical barriers to entry. A certain laxity in rigor is not, in itself, a serious issue; one could even argue it is essential to deal with complex problems at the frontier of knowledge. It allows for intuition and creativity to play a bigger role in accelerating understanding, with increased rigor coming at a later stage as a mechanism of error correction and consolidation.</p>
<p>Under these circumstances, it has always been part of the game to have to sift through the sands of confusion and irrelevance to find the valuable nuggets of rare metals and gemstones that make this field worthwhile. This is likely true in most active areas of science.</p>
<p>Occasionally, however, the sands accumulate into dunes, and we are caught in a hype sandstorm that obscures everything else. This has happened many times before, and the current installment concerns the so-called “higher-order networks” (HONs).</p>
<p>In past hype cycles—from the early claims of power laws being everywhere, the excessive number of redundant heuristics for network clustering, to the gratuitous generalization to multilayer and temporal systems—the overindulgence has always been grounded in an element of truth: Networks do often exhibit broad degree distributions; network clustering is both useful and important; different interaction modalities matter; and certainly many networks do evolve in time. None of these are trivial aspects, and there’s a lot of depth required to tackle them properly. So one ignores the excesses, or spends some time correcting the most egregious ones, and then moves on to the actual work.</p>
<p>The situation with HONs, however, seems quite different. In my view, it is built largely on superficial misconceptions and quite a bit of smoke and mirrors that obscure relatively simple facts. Once these issues are cleared away, very little appears to remain—at least nothing especially distinctive.</p>
</section>
<section id="higher-order-networks" class="level2">
<h2 class="anchored" data-anchor-id="higher-order-networks">“Higher-order networks”</h2>
<p>The HON literature centers on the idea of models defined on hypergraphs, a mathematical generalization of graphs in which links may connect not just pairs of nodes but larger sets of three or more. The goal is to study processes such as epidemic spreading, synchronization, and other dynamical phenomena parameterized on hypergraphs rather than on conventional graphs.</p>
<p>Exploring the usefulness of hypergraph abstractions is, of course, entirely legitimate. Statistical physics has employed hypergraphs (calling them <a href="https://en.wikipedia.org/wiki/Factor_graph">factor graphs</a>) for decades, using them as a core concept in the study of spin glasses, constraint satisfaction, error correction, community detection, and nonequilibrium systems (see Ref.<span class="citation" data-cites="mezard_information_2009">&nbsp;[2]</span> for an introduction). Hypergraphs are likewise central in <a href="https://en.wikipedia.org/wiki/Algebraic_topology">algebraic topology</a> and <a href="https://en.wikipedia.org/wiki/Topological_data_analysis">topological data analysis</a>. Their utility in appropriate contexts is therefore neither new nor controversial. One might reasonably argue that hypergraphs were understudied within network science and thus merited greater attention. I myself have worked on problems involving hypergraphs<span class="citation" data-cites="young_hypergraph_2021">&nbsp;[3]</span> and, I must admit, even contributed to a perspective article that helped fuel the very hype I criticize here (more on this below).</p>
<p>Much of the HON literature, however, is not just about exploring hypergraphs; it seeks to do something more ambitious. It presents itself as having uncovered <em>a more fundamental representation of complex systems,</em> explicitly casting alternative frameworks as incomplete or outdated in general. Almost invariably, the introduction of hundreds—perhaps thousands—of HON papers begin with slight variations of the following mantra:</p>
<div class="epigraph">
<blockquote class="blockquote">
<p>“While networks provide important representations of real-world systems, they are inherently restricted to describing pairwise interactions. However, many real systems involve interactions among groups of more than two elements, requiring hypergraphs rather than conventional graphs for a more faithful modeling, leading to the understanding of entirely new phenomena.”</p>
<div class="attribution">
<p>—About a quarter of all authors in network science the past five years (paraphrased)</p>
</div>
</blockquote>
</div>
<p>This narrative is repeated with remarkable persistence and is often treated as self-evident and intuitive. Rhetorically, it sounds both obvious and progressive: pairwise interactions are “limited,” group interactions are “realistic,” and therefore hypergraphs are “necessary.” Once stated in this way, the conclusion appears to follow almost automatically. As a result, the vast majority of works built on this premise simply adopt it as a starting point, rarely pausing to articulate precisely what is meant, what assumptions are being made, or what—if anything—is genuinely precluded by conventional graph-based descriptions.</p>
<!-- The claim thus functions less as a carefully examined hypothesis and more as a -->
<!-- ritual demarcation. It establishes a sense of conceptual rupture---the assertion -->
<!-- that we have long been looking at complex systems through an impoverished lens, -->
<!-- and that only now, through the language of hypergraphs, can we finally see -->
<!-- clearly. -->
</section>
<section id="taking-the-hype-out-of-hypergraphs" class="level2 page-columns page-full">
<h2 class="anchored" data-anchor-id="taking-the-hype-out-of-hypergraphs">Taking the hype out of hypergraphs</h2>
<p>In a new work with <a href="https://piratepeel.github.io/">Leto Peel</a>, <a href="https://hifmb.de/de/personen/thilo-gross/">Thilo Gross</a>, and <a href="https://manliodedomenico.com/">Manlio de Domenico</a><sup>1</sup><span class="citation" data-cites="peixoto_graphs_2026">&nbsp;[1]</span>, we scrutinize the premises underlying the HON literature and the conclusions drawn from them, showing that they all disintegrate under close examination.</p>
<div class="no-row-height column-margin column-container"><div id="fn1"><p><sup>1</sup>&nbsp;Manlio also has written about our work <a href="https://manlius.substack.com/p/higher-order-links-and-broken-standards">here</a>. He has also published a <a href="https://manliodedomenico.com/structure_is_not_mechanism.php">FAQ</a> covering some potential confusion about what we claim.</p></div></div><p>Our analysis goes beyond typical gripes one could have with this literature.</p>
<p>For example, a natural first reaction to claims about the supposed uniqueness of hypergraphs is to recall that they admit an equivalent representation as bipartite graphs: each hyperedge can be mapped to a factor node connected to the nodes it contains. From this perspective, assertions of hypergraph uniqueness relative to graph-based representations seem to evaporate rather quickly. Indeed, many papers ostensibly about hypergraphs read like papers about conventional bipartite graphs once one runs the text through <code>sed s/hypergraph/bipartite graph/</code>.</p>
<p>This is not a trivial observation. It implies that hypergraphs are intrinsically compatible with standard tools of network analysis and that, whether one likes this fact or not, any generative model for a hypergraph is simultaneously a model for a bipartite graph—and conversely. Frankly, for the same reason, I always found that the development of stand-alone software frameworks dedicated to hypergraphs to be ill-conceived—they all internally use bipartite graph representations, since these are the most efficient, and hence could have been developed on top of established graph-based frameworks without any loss at all; on the contrary, it would have avoided fragmentation, incompatibility, and code duplication.<sup>2</sup></p>
<div class="no-row-height column-margin column-container"><div id="fn2"><p><sup>2</sup>&nbsp;The specification of standard <a href="https://github.com/HIF-org/HIF-standard">file formats for hypergraphs</a> seem also equally redundant, and in fact quite counter-productive. Since hypergraphs are indistinguisable from bipartite graphs, the most obvious and meaningful choice would have been to use established graph formats, not create a new one for this special case alone.</p></div></div><p>On top of this, I never fully understood the appeal of using such cumbersome formalisms as <a href="https://en.wikipedia.org/wiki/Simplicial_complex">simplicial complexes</a>, which seem far removed from any reasonable modeling of real world systems that are the typical subject of study in network science, such as socio-economical and biological networks. The <em>raison d’être</em> of <a href="https://en.wikipedia.org/wiki/Complexity">complexity science</a>—in fact of science in general—is to find <em>simple</em> mechanisms that explain seemingly complex behavior. If the best one can do to model reality is to represent it as, say, a multilayer, time-varying, simplicial complex, I think this counts mostly as a failure of this program.</p>
<p>But, the above considerations should be put in the background if nature demands it. Indeed, this is how the HON literature frames things, insisting on the following very specific set of claims, often stated explicitly and repeatedly:</p>
<ol type="1">
<li>Graphs encode only “pairwise interactions,”</li>
<li>Hypergraphs encode “group interactions,” indivisible interaction units with more than two elements that cannot be represented by graphs.</li>
<li>Many systems are better modeled with “group interactions,” and hence hypergraphs.</li>
<li>“Group interactions” give rise to new phenomenology, not explainable by graph-based models.</li>
</ol>
<p>The central observation we make is that this set of claims rests on a rather elementary conflation between structure and function: A graph does not define interactions; it merely constrains them.</p>
</section>
<section id="beyond-the-edge-two-edges" class="level2">
<h2 class="anchored" data-anchor-id="beyond-the-edge-two-edges">Beyond the edge: two edges</h2>
<p>Suppose we model a system with a graph and then ask someone to simulate the dynamics it represents. They would immediately face an obvious question: which dynamics? An epidemic spreading? Coupled oscillators? A diffusion process? And if so, which specific formulation?</p>
<p>To specify the dynamics, we have to actually define the interactions, which are based on, but are absent from, the graph description. In other words, for a node <img src="https://latex.codecogs.com/png.latex?i">, all a graph does is define the neighborhood set <img src="https://latex.codecogs.com/png.latex?%0A%5Cpartial%20i%20=%20%5C%7B%20j%20%5Cmid%20(i,j)%20%5Cin%20%5Cmathcal%7BE%7D%20%5C%7D,%0A"> where <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BE%7D"> is the edge set. This doesn’t yet define any interaction. It tells us <em>who</em> interacts with node <img src="https://latex.codecogs.com/png.latex?i">, but not <em>how</em> they interact. To do that we have to give extra information: what are the interaction values and functions. For example, if our system is defined on continuous scalar variables <img src="https://latex.codecogs.com/png.latex?x_i">, that evolve in time via a system of ordinary differential equations, in general we can write <span id="eq-ode"><img src="https://latex.codecogs.com/png.latex?%0A%5Cdot%20x_i%20=%20f_i(x_i,%20%5Cboldsymbol%20x_%7B%5Cpartial%20i%7D),%0A%5Ctag%7B1%7D"></span> where <img src="https://latex.codecogs.com/png.latex?f_i"> is a multivariate function that depends simultaneously on the values of all neighbors, i.e. <img src="https://latex.codecogs.com/png.latex?%0A%5Cboldsymbol%20x_%7B%5Cpartial%20i%7D%20=%20%5C%7Bx_j%20%5Cmid%20j%20%5Cin%20%5Cpartial%20i%5C%7D.%0A"> Once we acknowledge this elementary fact, we notice immediately that there is nothing “pairwise” about this picture. Even though the graph is defined on node pairs, the interaction functions can be in general multivariate. This is the classic separation between “structure” and “function” in network science<span class="citation" data-cites="newman_structure_2003">&nbsp;[4]</span>. One would imagine that this would be common knowledge in the field, but apparently not everyone got the memo.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/higher-standards/diagram_func.svg" class="white-bg img-fluid figure-img" width="600"></p>
<figcaption>Graphs encode neighborhoods, which define the domain of interactions, not the interactions themselves. The adjacency set constrains which variables can influence a node, but only when functions are defined on these adjacencies are the interactions specified. Since these functions are multivariate in general, they do not need to decompose into pairwise terms. This diagram shows a possible instance of the proof-of-concept ODE system of Equation&nbsp;1, including the equations governing the dynamics of the nodes encircled. The adjacent nodes in blue (together with the red nodes) define the domain of each function.</figcaption>
</figure>
</div>
<p>Therefore, the claim that graph-based models can only encode “pairwise” interactions is not only untrue, but also ahistorical, since there are many network models defined in the literature that take advantage of this kind of generality, from Kauffman’s <a href="https://en.wikipedia.org/wiki/Boolean_network">boolean networks</a>, to threshold dynamics, and many others.</p>
<p>This simple fact about graph-based models has important consequences. One of them is that graph-based models <em>generalize</em> hypergraph-based ones, not the other way around!</p>
</section>
<section id="graph-models-generalize-hypergraph-models" class="level2">
<h2 class="anchored" data-anchor-id="graph-models-generalize-hypergraph-models">Graph models generalize hypergraph models</h2>
<p>This is simple to explain: since graphs only constrain the interactions by specifying their domain, and as they contain more information, hypergraphs can only add further constraints to the interaction functions. Indeed, hypergraph parameterizations typically inform interaction functions that act on all members of a hyperedge in a symmetric and mutually coherent manner. Graphs leave completely open the kinds of interactions possible, which means they can accommodate exactly the same functions one can define on hypergraphs, but in fact many others that hypergraphs cannot.</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/higher-standards/graph-vs-hypergraph.svg" class="white-bg img-fluid figure-img" width="800"></p>
<figcaption>Hypergraph parameterizations are special cases of graph-based models, and thus offer no generalization. The node adjacencies (top) show the skeleton of each model, and the coupling functions (bottom) define the interactions. A hypergraph requires <em>mutual, symmetric membership</em>: if nodes <img src="https://latex.codecogs.com/png.latex?%5C%7Bi,j,k%5C%7D"> form a hyperedge, a single shared coupling function of all three must appear in the equation of every node in that set. Panel (a) satisfies this constraint—the shaded regions mark groups of nodes that always appear together in function arguments, forming consistent hyperedges. This can also be represented by the graph-based model of panel (b). Panel (b) uses the same form of the multivariate functions, but no hypergraph can represent it, since changing the adjacencies and/or the couplings can break the mutual membership constraint. For example, <img src="https://latex.codecogs.com/png.latex?h_5%5E%7B(1)%7D"> groups <img src="https://latex.codecogs.com/png.latex?%5C%7B1,3,5,6%5C%7D">, but node 1 depends only on <img src="https://latex.codecogs.com/png.latex?%5C%7B1,4,5%5C%7D"> via <img src="https://latex.codecogs.com/png.latex?h_1">, node 3 on <img src="https://latex.codecogs.com/png.latex?%5C%7B3,5,6%5C%7D"> via <img src="https://latex.codecogs.com/png.latex?h_3">, and node 6 on <img src="https://latex.codecogs.com/png.latex?%5C%7B3,5,6,12%5C%7D"> via <img src="https://latex.codecogs.com/png.latex?h_6">—none share the same coupling function as node 5, so no hyperedge <img src="https://latex.codecogs.com/png.latex?%5C%7B1,3,5,6%5C%7D"> can exist. The colored edge endpoints in (b) indicate which coupling function each edge belongs to, for nodes with more than one. The existence of multivariate coupling functions is completely independent from any hypergraph structure. Therefore, simultaneously labeling the model of panel (a) “higher-order” and the one of panel (b) “pairwise” or “dyadic” would be arbitrary.</figcaption>
</figure>
</div>
<p>In addition, we also show in the paper that, from a purely parametric perspective, ignoring the interaction functions, <a href="https://en.wikipedia.org/wiki/Multidimensional_network">multilayer networks</a> also generalize hypergraphs, further undermining the central premises of the HON literature.</p>
</section>
<section id="no-network-phenomena-are-invisible-to-graph-models" class="level2">
<h2 class="anchored" data-anchor-id="no-network-phenomena-are-invisible-to-graph-models">No network phenomena are “invisible” to graph models</h2>
<p>The above generalization hierarchy already completely disables the claim that phenomenology observed with hypergraph models is “invisible” to graph-based models<span class="citation" data-cites="battiston_higher-order_2025">&nbsp;[5]</span>. However, if one inspects the alleged unique phenomena more closely, such as the onset of abrupt transitions in synchronization<span class="citation" data-cites="skardal_higher_2020">&nbsp;[6]</span> or contagion<span class="citation" data-cites="iacopini_simplicial_2019">&nbsp;[7]</span>, one sees that they rely on homogeneous <a href="https://en.wikipedia.org/wiki/Mean-field_theory">mean-field calculations</a> that completely disregard the hypergraph structure. The abrupt transitions described occur in exactly the same way on locally tree-like graphs, which do not possess any cliques, let alone hyperedges. Therefore, these works actually prove the opposite of what they claim: the hypergraph structure is neither necessary nor relevant to explain the observed phenomena. Furthermore, as we show, these abrupt transitions belong to the same class as <a href="https://en.wikipedia.org/wiki/Bootstrap_percolation">bootstrap (<img src="https://latex.codecogs.com/png.latex?k">-core) percolation</a> and <a href="https://en.wikipedia.org/wiki/Interdependent_networks">interdependent percolation</a>—two classic and well-known graph processes, which somehow are never referenced in the HON literature. As it turns out, it seems that it is the correct interpretation of mean-field calculations and the broader literature of cooperative phenomena in networks that can be invisible to some.</p>
</section>
<section id="absence-of-empirical-evidence" class="level2">
<h2 class="anchored" data-anchor-id="absence-of-empirical-evidence">Absence of empirical evidence</h2>
<p>Networks and hypergraphs are not literal features of the world but abstract tools we use to model complex systems. A single system can often be represented in multiple mathematical ways, and choosing among them involves balancing interpretability, versatility, and empirical support.</p>
<p>Network models have historically offered a powerful balance of simplicity and analytical depth, supported by a rich ecosystem of mature mathematical tools. While hypergraphs provide a more structurally specific language for representing particular kinds of group interactions, their analytical framework is still comparatively limited. In the absence of clear mathematical advantages, we contend that networks—including multilayer extensions—currently offer a more practical and versatile foundation for modeling many complex systems.</p>
<p>That said, empirical performance should be the final arbiter: if hypergraphs yield more parsimonious or predictive descriptions in specific contexts, they should be preferred.</p>
<p>However, as we argue, the HON literature frequently makes clearly excessive claims about hypegraphs being “ubiquitous” and “essential” to model real world systems while giving virtually no real evidence to support them.</p>
<p>We examine several common arguments presented as evidence for the ubiquity of hypergraphs and find them lacking. Toy models formulated with hypergraphs may reproduce interesting phenomena, but they do not demonstrate that real systems require hypergraph structure, especially when the exact same behaviors can often be generated by graph-based models. Likewise, reinterpreting bipartite data as hypergraphs frequently amounts to a relabeling exercise rather than a substantive empirical advance. Attempts to impute hypergraphs from graph data or reconstruct them from time series typically rely on heuristics, suffer from non-identifiability, and lack rigorous model comparison. Without principled statistical frameworks<span class="citation" data-cites="peel_statistical_2022">&nbsp;[8]</span> that test hypergraph models against graph-based alternatives, these approaches cannot establish that the particular complexity of hypergraph parametrizations is warranted by the data.</p>
<p>This persistent lack of decisive evidence is not accidental but reflects a deeper epistemic problem. Any system representable as a hypergraph can also be represented as a graph; the real differences lie in assumptions about hidden interaction rules, which are rarely observed directly in empirical data. For instance, a protein–protein interaction database typically indicates only whether the interaction is believed to be positive or negative; a survey reporting friendship ties between students does not specify how gossip or infection would propagate; and a neuronal map does not reveal firing dynamics. This pattern holds for virtually all network data. Because these rules are typically latent and measurements are incomplete, it may be impossible to obtain direct proof that one representation is uniquely correct. Instead, as in all of science, models must be evaluated comparatively, with preference given to those that offer the best balance of parsimony, predictive accuracy, and explanatory power. In this light, hypergraphs should be viewed as one option among many—not as universally necessary, but as tools whose value must be demonstrated case by case.</p>
</section>
<section id="falling-from-the-edge-post-mortem" class="level2">
<h2 class="anchored" data-anchor-id="falling-from-the-edge-post-mortem">Falling from the edge: post mortem</h2>
<p>The observations we make are not particularly deep, and one can’t help but wonder how such misconceptions went on for so long as they did unchecked.</p>
<p>I believe the rapid rise of publications on HONs is not difficult to understand. These works do not require a great deal of creativity. The usual protocol is just to take any old idea and apply it to a hypergraph. If something superficially different is seen, call that a novel phenomenon, throw in an unjustified assertion that this is “invisible” on graph-based representations, collect citations, lather, rinse, repeat. Bonus points if you combine it with generalizations such as multilayer and temporal. If you write a paper on temporal multilayer simplicial complexes, you win the HON bingo. Careers can and have been made based on such triteness.</p>
<p>I’m not doing justice to all papers on hypergraph models, since there are surely many interesting ones—I’m talking about the sand, not the gemstones.</p>
<p>Given the widespread hype, it’s unlikely many will snap out of the “hypergraphs go brrr” mentality very soon, but for those that actually wish to understand something meaningful about the world, value quality over quantity and substance over hype, the above considerations are relevant.</p>
<p>Hopefully our work will help at least to cut down the grandiose, self-serving, and misleading rhetoric that permeates these papers, which can get a bit embarrassing.</p>
<p>More constructively, the distinction between multivariate interactions and hypergraphs that we elucidate could motivate more refined models and analyses of network phenomena. What other ways do we have of formulating multivariate interactions that break away from the restrictive hypergraph framework but are also analytically convenient in some cases? How can we develop network reconstruction methods that can wield the full expressive power of graph-based formulations? How do we develop principled inference methods to select between different network abstractions? Answering these questions, and others, requires us to be actually creative and venture into new ground—not reachable by only recycling old ideas.</p>
</section>
<section id="sec-mea-culpa" class="level2 page-columns page-full">
<h2 class="anchored" data-anchor-id="sec-mea-culpa">Mea culpa</h2>
<p>I have to admit that I share some responsibility for the current state of the HON literature. In 2021, I co-authored a perspective article<span class="citation" data-cites="battiston_physics_2021">&nbsp;[9]</span> that, in retrospect, helped fuel a lot of the hype. The paper had fourteen authors, and it was hardly an “indivisible group interaction.” I was invited to contribute to a specific section on statistical inference—especially how to reconstruct hypergraphs from indirect data—building on recent work at the time<span class="citation" data-cites="young_hypergraph_2021">&nbsp;[3]</span>, which I thought was an important and worthwhile direction.</p>
<p>My reading of the paper back then was that it called for richer models of multibody interactions, not for replacing graphs wholesale with hypergraphs. That idea was already in the text, but at the time I considered it innocuous—specially given the counterpoint I was helping provide with a call for principled statistical methods. I didn’t anticipate how influential that particular framing would become. It was only later, once the topic started to go viral, that I realized how literally it was being interpreted.</p>
<p>To my surprise and mortification, the paper now has over a thousand citations and is still being cited in support of claims I don’t necessarily agree with. As more recent publications indicate<span class="citation" data-cites="battiston_higher-order_2025">&nbsp;[5]</span>, the hype has not quite given way to more critical reflection. That association is something I’m not especially proud of.</p>
<p>This is a lesson in academic promiscuity and carelessness that I won’t soon forget. In fact, part of my motivation behind the current work of Ref.<span class="citation" data-cites="peixoto_graphs_2026">&nbsp;[1]</span> is to revisit some of these issues and clarify what I think the right perspective should have been all along—even if the original effects were unintended.</p>
<section id="references" class="level4">
<h4 class="anchored" data-anchor-id="references">References</h4>
<div id="refs" class="references csl-bib-body" data-entry-spacing="0">
<div id="ref-peixoto_graphs_2026" class="csl-entry">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">T. P. Peixoto, L. Peel, T. Gross, and M. D. Domenico, <em><a href="https://doi.org/10.48550/arXiv.2602.16937">Graphs Are Maximally Expressive for Higher-Order Interactions</a></em>, arXiv:2602.16937 (2026).</div>
</div>
<div id="ref-mezard_information_2009" class="csl-entry">
<div class="csl-left-margin">[2] </div><div class="csl-right-inline">M. Mezard and A. Montanari, <em>Information, <span>Physics</span>, and <span>Computation</span></em> (Oxford University Press, 2009).</div>
</div>
<div id="ref-young_hypergraph_2021" class="csl-entry">
<div class="csl-left-margin">[3] </div><div class="csl-right-inline">J.-G. Young, G. Petri, and T. P. Peixoto, <em><a href="https://doi.org/10.1038/s42005-021-00637-w">Hypergraph Reconstruction from Network Data</a></em>, Communications Physics <strong>4</strong>, 1 (2021).</div>
</div>
<div id="ref-newman_structure_2003" class="csl-entry">
<div class="csl-left-margin">[4] </div><div class="csl-right-inline">M. E. J. Newman, <em>The Structure and Function of Complex Networks</em>, SIAM Review <strong>45</strong>, 167 (2003).</div>
</div>
<div id="ref-battiston_higher-order_2025" class="csl-entry">
<div class="csl-left-margin">[5] </div><div class="csl-right-inline">F. Battiston, V. Capraro, F. Karimi, S. Lehmann, A. B. Migliano, O. Sadekar, A. Sánchez, and M. Perc, <em><a href="https://doi.org/10.1038/s41562-025-02373-5">Higher-Order Interactions Shape Collective Human Behaviour</a></em>, Nature Human Behaviour <strong>9</strong>, 2441 (2025).</div>
</div>
<div id="ref-skardal_higher_2020" class="csl-entry">
<div class="csl-left-margin">[6] </div><div class="csl-right-inline">P. S. Skardal and A. Arenas, <em><a href="https://doi.org/10.1038/s42005-020-00485-0">Higher Order Interactions in Complex Networks of Phase Oscillators Promote Abrupt Synchronization Switching</a></em>, Communications Physics <strong>3</strong>, 218 (2020).</div>
</div>
<div id="ref-iacopini_simplicial_2019" class="csl-entry">
<div class="csl-left-margin">[7] </div><div class="csl-right-inline">I. Iacopini, G. Petri, A. Barrat, and V. Latora, <em><a href="https://doi.org/10.1038/s41467-019-10431-6">Simplicial Models of Social Contagion</a></em>, Nature Communications <strong>10</strong>, 2485 (2019).</div>
</div>
<div id="ref-peel_statistical_2022" class="csl-entry">
<div class="csl-left-margin">[8] </div><div class="csl-right-inline">L. Peel, T. P. Peixoto, and M. De Domenico, <em><a href="https://doi.org/10.1038/s41467-022-34267-9">Statistical Inference Links Data and Theory in Network Science</a></em>, Nature Communications <strong>13</strong>, 6794 (2022).</div>
</div>
<div id="ref-battiston_physics_2021" class="csl-entry">
<div class="csl-left-margin">[9] </div><div class="csl-right-inline">F. Battiston et al., <em><a href="https://doi.org/10.1038/s41567-021-01371-4">The Physics of Higher-Order Interactions in Complex Systems</a></em>, Nature Physics <strong>17</strong>, 1093 (2021).</div>
</div>
</div>
<hr>
</section>
<section id="comments" class="level4">
<h4 class="anchored" data-anchor-id="comments">Comments</h4>
<p>(Comments may be moderated.)</p>
<div class="discourse-excerpt" style="display: none">
<p>If you reply to this post, it will show as a comment below the original article.</p>
</div>
<div id="discourse-comments"></div>
<meta name="discourse-username" content="tiago">

<script type="text/javascript">

  const discourse_url = "https://forum.skewed.de";

  // Here, we determine the theme, and send a message to the iframe to let it know what the theme is
  // See below for how we hook up notifyFrameStyle 
  const notifyIFrameOfTheme = () => {
    const iframe = document.getElementById("discourse-embed-frame");
    if (document.body.classList.contains("quarto-dark")) {
      theme = "dark";
    } else {
      theme = "light";
    }

    if (iframe && iframe.contentWindow) {
      iframe.contentWindow.postMessage(
        {
          // Modify the line below to grab dark mode setting, depending on how you store it
          theme: theme
        },
        discourse_url
      );
    }
  };

  // Call setFrameStyle when we receive the "iframe loaded" message
  const handleMessageListener = (event) => {
    var origin = event.origin;
    if ((origin === discourse_url) && (event.data == "iframe loaded")) {
      notifyIFrameOfTheme();
    }
  };

  DiscourseEmbed = {
    discourseUrl: 'https://forum.skewed.de/',
    discourseEmbedUrl: 'https://skewed.de/lab/posts/higher-standards/',
    //className: 'discourse-excerpt',
  };
  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();

  window.addEventListener("message", handleMessageListener);
</script>
</section>
<section id="webmentionswebmentions" class="level4">
<h4 class="anchored" data-anchor-id="webmentionswebmentions">Webmentions<sup>3</sup></h4>
<div id="nomention">
<p>(Nothing yet)</p>
</div>
<div class="mentionsio">
<ul id="facepile">
</ul>
<ul id="reposts">
</ul>
<ul id="mentions">
</ul>
</div>


</section>
<div class="no-row-height column-margin column-container"><div id="fn3"><p><sup>3</sup>&nbsp;<a href="https://indieweb.org/Webmention">Webmention</a> is a standardized decentralized mechanism for conversations and interactions across the web.</p></div></div></section>


</div> ]]></description>
  <category>hyperslop</category>
  <category>hypergraphs</category>
  <category>higher-order</category>
  <category>hype</category>
  <category>mean-field</category>
  <guid>https://skewed.de/lab/posts/higher-standards/</guid>
  <pubDate>Sun, 22 Feb 2026 23:00:00 GMT</pubDate>
  <media:content url="https://skewed.de/lab/posts/higher-standards/diagram_func.png" medium="image" type="image/png" height="65" width="144"/>
</item>
<item>
  <title>The perplexing “connected cluster axiom”</title>
  <dc:creator>Tiago P. Peixoto</dc:creator>
  <link>https://skewed.de/lab/posts/connected-clusters/</link>
  <description><![CDATA[ 

<div class="h-entry e-content entry-content page-columns page-full">




<blockquote class="blockquote">
<p>TL;DR — There’s no good reason to always expect communities in networks to be made of strictly connected nodes. On the contrary, doing so leads to conceptual inconsistencies and overfitting.</p>
</blockquote>
<p>There’s a meme<sup>1</sup> in the network science literature, in which authors declare that a desirable property of a network clustering algorithm is for it to find communities that are strictly connected, i.e.&nbsp;there is an internal path between any two pairs of nodes that belong to the same cluster. When provided, this statement is virtually <em>never</em> followed by any justification, as if it were completely self-evident — an entirely obvious axiom. This is particularly common of older papers, from the wild west era of the 2000s when authors were trying every heuristic under the sun to solve the community detection problem, without agreeing first on what the problem actually is, or should be. This has changed substantially in last 20 years, in particular in the last 15 years or so, when a principled theoretical framework for community detection has been established, based predominantly on statistical inference and information theory. But alas, in some corners, the “connected cluster axiom” persists. However, it is interesting how this expectation seems intuitive to some, despite being inconsistent with other simultaneously held assumptions.</p>
<div class="no-row-height column-margin column-container"><div id="fn1"><p><sup>1</sup>&nbsp;In the <a href="https://en.wikipedia.org/wiki/Meme">original sense of the word</a>. I’m not talking about <a href="https://en.wikipedia.org/wiki/Internet_meme">images in social media</a>.</p></div><div class="" style="clear:both">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/connected-clusters/clusters.svg" class="img-fluid figure-img"></p>
<figcaption>According to the “connected cluster axiom,” a good community detection algorithm must put each of the components of the above graph in its own community. Is that obvious? Yet, this requirement runs against the important notion of <a href="https://en.wikipedia.org/wiki/Statistical_significance">statistical significance</a>.</figcaption>
</figure>
</div>
</div></div>
<p>For example, the most widely (mis-)used and infamous community detection method, <a href="../modularity-harmful">modularity maximization</a>, relies on the notion of a <em>null model</em>: a statistical <a href="https://en.wikipedia.org/wiki/Generative_model">generative model</a> for networks that have no meaningful community structure. The most common generative model employed for this purpose is the <a href="https://en.wikipedia.org/wiki/Configuration_model">configuration model</a>, where nodes are connected at random, while guaranteeing that the degree of each node is fixed in expectation to a particular value, set to be equal to the one in the network being clustered. This choice begs the question: “Are networks generated by the null model typically connected?” The answer is actually “no,” since networks sampled from this null model are guaranteed to be connected <em>only</em> in the unrealistic asymptotic regime where every degree is sufficiently large. In most of the cases, the null models chosen to match most empirical networks do not result in connected networks. Therefore, a sane person would not simultaneously hold the conviction that clusters must be connected together with the idea that the configuration model is a suitable null model for community detection. Yet, bizarrely, when some authors notice that modularity maximization always puts disconnected components in their own separate communities, they think all is well with the universe, since the “connected cluster axiom” is satisfied, although the premise of the method has actually been completely subverted: it finds “meaningful” structures in its own null model! Instead of rendering the method unfit for purpose, this <a href="../modularity-harmful">major inconsistency</a> is often simply ignored.</p>
<p>Equally perplexing is when, due to a mathematical artifact or lack of statistical evidence, a method happens to produce disconnected clusters (for example due to the resolution limit of modularity), authors then choose to simply <em>force</em> the communities to be connected, once more ignoring any internal methodological inconsistency this entails. In network science, one can become <a href="https://scholar.google.com/scholar?cites=364122666491805792&amp;as_sdt=2005&amp;sciodt=0,5&amp;hl=en">very popular</a> by disseminating such ideas<span class="citation" data-cites="traag_louvain_2019">&nbsp;[1]</span>.</p>
<p>The conceptual inconsistency of the “connected cluster axiom” is also evident when benchmarks are used to compare different methods. A prominent choice is the LFR benchmark<span class="citation" data-cites="lancichinetti_benchmark_2008">&nbsp;[2]</span>, which consists of networks sampled from the degree-corrected <a href="https://en.wikipedia.org/wiki/Stochastic_block_model">stochastic block model</a> (SBM) with particular parameter choices (assortative communities, with sizes and node degrees following a power law distribution). Is the benchmark guaranteed to produce connected clusters? No.&nbsp;Yet, the contradiction seems to go largely unnoticed by proponents of the “connected cluster axiom.”</p>
<p>A lot of this can be explained simply by carelessness. Some researchers seem to only want a quick simple tool that seems to do the job, and are not interested to learn about how it works (or doesn’t). Everyone else uses the same flawed method anyway, so who cares, specially if the analysis being done is superfluous after all — an unavoidable premise of this rationale.<sup>2</sup></p>
<div class="no-row-height column-margin column-container"><div id="fn2"><p><sup>2</sup>&nbsp;As I <a href="../modularity-harmful">mentioned in another occasion</a>, the reliance on heuristics like modularity maximization for community detection, with its many documented flaws, but also the <a href="https://en.wikipedia.org/wiki/Nonlinear_dimensionality_reduction#Uniform_manifold_approximation_and_projection">UMAP method</a> for dimensionality reduction, <a href="https://en.wikipedia.org/wiki/Topological_data_analysis">TDA</a>, and so on are red flags that indicate that the authors have given up on a minimally rigorous understanding of their analysis. This does not necessarily mean that the overall analysis is bad as a whole, but whatever quality it has is achieved <em>in spite</em> of its methodological choices, rather than because of them.</p></div></div><p>At the risk of giving them undue attention, I just came across two recent papers<span class="citation" data-cites="park_improved_2025 vu-le_using_2025">&nbsp;[3,4]</span> that heroically managed to employ the “connected cluster axiom” as a criterion to “improve” <a href="https://graph-tool.skewed.de/static/docs/stable/demos/inference/inference.html">SBM inference</a>. It seems the authors used <a href="https://graph-tool.skewed.de">graph-tool</a> to find clusters in networks, and found that it yielded disconnected clusters for them. How truly embarrassing! Generously, the authors went a long way to “fix” the problem, and provided much needed “improvements” to the inference algorithm to prevent this calamity from occurring: by suitably post-processing the data (always a good idea!), and forcing disconnected clusters inside each group to belong to different communities.</p>
<p>(Since this is the internet, I should disclose that the above paragraph contains sarcasm.)</p>
<p>What is particularly egregious about the works mentioned above is that the authors manage to completely miss the point of the whole <a href="../descriptive-inferential">inferential approach</a> based on SBMs. Because of the “connected cluster axiom,” they interpret what is an explicit <em>strength</em> of the approach — namely its ability to <a href="../../research.html#structure-vs.-randomness">distinguish structure from randomness</a> — as a defect. And therefore, the supposed “fix” they propose actually <em>breaks the method</em>. When we infer a SBM given some observed network, we try to find the groups of nodes that have the same (latent) probability of connecting to other nodes in the network. According to this model, in the assortative case,<sup>3</sup> i.e.&nbsp;when the connection probability is larger inside groups than across, nodes belonging to the same group could still end up being disconnected. In other words, the generative model used does not attempt to obey the “connected cluster axiom.” Furthermore, trying to “fix” this, by either constraining the algorithm or modifying the data, means that the algorithm can no longer always find a single group in a maximally random network, such as one from an Erdős–Rényi or the configuration model. In other words, this inept “fix” just causes the approach to overfit in trivial scenarios, entirely nullifying its <em>raison d’être</em>. And frankly, that’s just rude.</p>
<div class="no-row-height column-margin column-container"><div id="fn3"><p><sup>3</sup>&nbsp;I mention only in passing that when the group mixing is disassortative, the expectation that nodes of the same group should be connected is just schizophrenic at this point, rather than just excessive. Sadly, this is a relevant point for the papers in question, since they consider empirical networks, which are <a href="../hidden-models">rarely purely assortative</a><span class="citation" data-cites="peixoto_implicit_2023">&nbsp;[5]</span>.</p></div></div><p>Needless to say, I expressly recommend users of graph-tool to avoid such alleged “improvements” at all costs.</p>
<p>The detection of planted community structure in sparse graphs is a challenging task. One can easily construct instances that are NP-hard, and the outcome will depend not only on the quality function being used, but also on the optimization/sampling algorithms chosen. The SBM parametrization and choice of priors can also have an important effect, as discussed in the literature<span class="citation" data-cites="peixoto_latent_2020">&nbsp;[6]</span>. Elaborating on alternative model choices that work better in particular scenarios is a perfectly valid endeavor. What is invalid is to bypass explicit modeling choices in favor of a heuristic kludge with no actual justification.</p>
<p>Where does the “connected cluster axiom” meme come from? Is it simply from the conflation between “connected component” and “cluster”? Are people inherently thinking of <a href="../descriptive-inferential">descriptive clusters</a> that are helpful to explain some dynamics on a network, such as a flow or a spreading process, where connectedness plays a deciding role? If adherents of the “connected cluster axiom” would only actually try to explain their rationale, instead of taking it as given, it could be addressed. But I’m not too optimistic, since academics don’t usually miss the opportunity of explaining a conviction when they can, and hence, due to Bayes’ theorem, we can conclude that they probably can’t explain it when they don’t.</p>
<section id="references" class="level4">
<h4 class="anchored" data-anchor-id="references">References</h4>
<div id="refs" class="references csl-bib-body" data-entry-spacing="0">
<div id="ref-traag_louvain_2019" class="csl-entry">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline"><span class="nocase">V. A. Traag, L. Waltman, and N. J. van Eck</span>, <em><a href="https://doi.org/10.1038/s41598-019-41695-z">From <span>Louvain</span> to <span>Leiden</span>: Guaranteeing Well-Connected Communities</a></em>, Scientific Reports <strong>9</strong>, 5233 (2019).</div>
</div>
<div id="ref-lancichinetti_benchmark_2008" class="csl-entry">
<div class="csl-left-margin">[2] </div><div class="csl-right-inline">A. Lancichinetti, S. Fortunato, and F. Radicchi, <em><a href="https://doi.org/10.1103/PhysRevE.78.046110">Benchmark Graphs for Testing Community Detection Algorithms</a></em>, Physical Review E <strong>78</strong>, 046110 (2008).</div>
</div>
<div id="ref-park_improved_2025" class="csl-entry">
<div class="csl-left-margin">[3] </div><div class="csl-right-inline">M. Park, D. W. Feng, S. Digra, T.-A. Vu-Le, G. Chacko, and T. Warnow, <em><a href="https://doi.org/10.1007/978-3-031-82435-7_9">Improved <span>Community Detection Using Stochastic Block Models</span></a></em>, in <em>Complex <span>Networks</span> &amp; <span>Their Applications XIII</span></em>, edited by H. Cherifi, M. Donduran, L. M. Rocha, C. Cherifi, and O. Varol (Springer Nature Switzerland, Cham, 2025), pp. 103–114.</div>
</div>
<div id="ref-vu-le_using_2025" class="csl-entry">
<div class="csl-left-margin">[4] </div><div class="csl-right-inline">T.-A. Vu-Le, M. Park, I. Chen, and T. Warnow, <em><a href="https://doi.org/10.1007/s41109-025-00747-2">Using Stochastic Block Models for Community Detection</a></em>, Applied Network Science (2025).</div>
</div>
<div id="ref-peixoto_implicit_2023" class="csl-entry">
<div class="csl-left-margin">[5] </div><div class="csl-right-inline">T. P. Peixoto and A. Kirkley, <em><a href="https://doi.org/10.1103/PhysRevE.108.024309">Implicit Models, Latent Compression, Intrinsic Biases, and Cheap Lunches in Community Detection</a></em>, Physical Review E <strong>108</strong>, 024309 (2023).</div>
</div>
<div id="ref-peixoto_latent_2020" class="csl-entry">
<div class="csl-left-margin">[6] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevE.102.012309">Latent <span>Poisson</span> Models for Networks with Heterogeneous Density</a></em>, Physical Review E <strong>102</strong>, 012309 (2020).</div>
</div>
</div>
<hr>
</section>
<section id="comments" class="level4">
<h4 class="anchored" data-anchor-id="comments">Comments</h4>
<p>(Comments may be moderated.)</p>
<div class="discourse-excerpt" style="display: none">
<p>If you reply to this post, it will show as a comment below the original article.</p>
</div>
<div id="discourse-comments"></div>
<meta name="discourse-username" content="tiago">

<script type="text/javascript">

  const discourse_url = "https://forum.skewed.de";

  // Here, we determine the theme, and send a message to the iframe to let it know what the theme is
  // See below for how we hook up notifyFrameStyle 
  const notifyIFrameOfTheme = () => {
    const iframe = document.getElementById("discourse-embed-frame");
    if (document.body.classList.contains("quarto-dark")) {
      theme = "dark";
    } else {
      theme = "light";
    }

    if (iframe && iframe.contentWindow) {
      iframe.contentWindow.postMessage(
        {
          // Modify the line below to grab dark mode setting, depending on how you store it
          theme: theme
        },
        discourse_url
      );
    }
  };

  // Call setFrameStyle when we receive the "iframe loaded" message
  const handleMessageListener = (event) => {
    var origin = event.origin;
    if ((origin === discourse_url) && (event.data == "iframe loaded")) {
      notifyIFrameOfTheme();
    }
  };

  DiscourseEmbed = {
    discourseUrl: 'https://forum.skewed.de/',
    discourseEmbedUrl: 'https://skewed.de/lab/posts/connected-clusters/',
    //className: 'discourse-excerpt',
  };
  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();

  window.addEventListener("message", handleMessageListener);
</script>
</section>
<section id="webmentionswebmentions" class="level4">
<h4 class="anchored" data-anchor-id="webmentionswebmentions">Webmentions<sup>4</sup></h4>
<div id="nomention">
<p>(Nothing yet)</p>
</div>
<div class="mentionsio">
<ul id="facepile">
</ul>
<ul id="reposts">
</ul>
<ul id="mentions">
</ul>
</div>


</section>
<div class="no-row-height column-margin column-container"><div id="fn4"><p><sup>4</sup>&nbsp;<a href="https://indieweb.org/Webmention">Webmention</a> is a standardized decentralized mechanism for conversations and interactions across the web.</p></div></div>

</div> ]]></description>
  <category>community detection</category>
  <category>heuristics</category>
  <category>overfitting</category>
  <category>memes</category>
  <guid>https://skewed.de/lab/posts/connected-clusters/</guid>
  <pubDate>Wed, 03 Dec 2025 23:00:00 GMT</pubDate>
  <media:content url="https://skewed.de/lab/posts/connected-clusters/clusters.png" medium="image" type="image/png" height="144" width="144"/>
</item>
<item>
  <title>Untangling the hairball using statistical inference</title>
  <dc:creator>Tiago P. Peixoto</dc:creator>
  <link>https://skewed.de/lab/posts/hairball/</link>
  <description><![CDATA[ 

<div class="h-entry e-content entry-content page-columns page-full">




<blockquote class="blockquote">
<p>TL;DR — Network visualization is often done in the wrong way: first a network layout is produced using a heuristic, and then follow-up analyses are performed and evaluated according to the layout. This is an inversion of priorities that subjugates algorithmic analyses to unreliable and often misleading visualization heuristics. Here I show how this inversion can be fixed: by performing the more meaningful algorithmic analysis first—like clustering or ordering—and then subjugating the visualization heuristics to it.</p>
</blockquote>
<section id="the-seductive-futility-of-network-visualization" class="level3 page-columns page-full">
<h3 class="anchored" data-anchor-id="the-seductive-futility-of-network-visualization">The seductive futility of network visualization</h3>
<p>Network visualization is a ubiquitous task in data analysis. We can’t seem to resist trying to just <em>see</em> the network structure with our own eyes. Our visual cognitive abilities can be a powerful tool, since we can effortlessly identify some kinds of patterns that would otherwise be difficult to detect. It would be wasteful not to harness it.</p>
<p>Unfortunately, network data suffers from a fundamental problem of representation. Namely, networks are usually not low-dimensional objects to begin with, so we cannot directly inspect them in their “natural” space<sup>1</sup>—unlike clouds, rocks, trees, insects, etc. Instead, we need first to <em>project</em> them into a low-dimensional representation (usually in 2D) that is digestible to our visual apparatus. This is a rather violent act that invariably distorts the structure in the data in important and <em>unavoidable</em> ways. With network data, not only <a href="https://en.wikipedia.org/wiki/Map%E2%80%93territory_relation">“is the map not the territory”</a>, but these two live in radically different universes. A universally faithful representation of arbitrary networks in 2D (or even 3D) is simply impossible, and therefore is not a sensible goal.<sup>2</sup></p>
<div class="no-row-height column-margin column-container"><div id="fn1"><p><sup>1</sup>&nbsp;Notable exceptions are spatial networks common in transportation systems, such as roads, railways, subways, etc.</p></div><div id="fn2"><p><sup>2</sup>&nbsp;Faithful projections are not even always possible between spaces with the same number of dimensions, such as <a href="https://en.wikipedia.org/wiki/Stereographic_projection">from the surface of a sphere to a plane</a>.</p></div></div><p>In addition to these unavoidable distortions, data visualization in general is a double-edged sword—our sensitive pattern detection abilities mean that we can also see structures in the data that are not really there, or at least not in a statistically meaningful way.</p>

<div class="no-row-height column-margin column-container"><div class="" style="clear:both">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/hairball/danish.jpg" class="img-fluid figure-img" style="width:50.0%"></p>
<figcaption>The Danish power socket is the friendliest power socket.</figcaption>
</figure>
</div>
</div></div><p>This phenomenon is called <a href="https://en.wikipedia.org/wiki/Pareidolia">pareidolia</a>, which is an instance of a more general cognitive bias called <a href="https://en.wikipedia.org/wiki/Apophenia">apophenia</a>—the tendency to perceive meaningful connections between unrelated things. Everyday examples of this include seeing common shapes in clouds, and faces in inanimate objects.</p>
<p>The combination of these unavoidable distortions with our cognitive bias to identify spurious patterns is not a good one for network visualization.</p>
<p>Let us inspect some representative instances:</p>
<div class="center quarto-layout-panel" data-layout-ncol="2">
<div class="quarto-layout-row quarto-layout-valign-center">
<div class="quarto-layout-cell" style="flex-basis: 50.0%;justify-content: flex-start;">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/hairball/ridiculogram.png" class="img-fluid figure-img" style="width:90.0%"></p>
<figcaption>Ceci n’est pas un réseau. <br>(C’est un <a href="https://www.youtube.com/watch?v=YS-asmU3p_4">ridiculogramme</a>!)</figcaption>
</figure>
</div>
</div>
<div class="quarto-layout-cell" style="flex-basis: 50.0%;justify-content: flex-start;">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/hairball/blobs-of-blobs.png" class="img-fluid figure-img" style="width:90.0%"></p>
<figcaption>Ceci n’est pas non plus un réseau. <br> (Credit: <a href="https://reticular.hypotheses.org/">Mathieu Jacomy</a>)</figcaption>
</figure>
</div>
</div>
</div>
</div>
<p>It’s easy to ridicule the visualization on the left: it’s the typical hairball that conveys little useful information. It <em>overloads</em> our pattern recognition abilities, and the whole thing just looks like a confusing mess. However, the visualization on the right is arguably also problematic. Despite showing a seemingly clearer picture—we can see a more obvious modular pattern—how can we be sure it’s not an illusion, caused by the algorithmic distortion, our cognitive bias,<sup>3</sup> or both?</p>
<div class="no-row-height column-margin column-container"><div id="fn3"><p><sup>3</sup>&nbsp;In fact, one particularly important instance of apophenia is the so-called <a href="https://en.wikipedia.org/wiki/Clustering_illusion">clustering illusion</a>: The tendency to see clusters in data which cannot be statistically justified. Some community detection algorithms <a href="../modularity-harmful">suffer from the same problem</a>.</p></div></div></section>
<section id="force-directed-layouts-only-see-assortativity" class="level3 page-columns page-full">
<h3 class="anchored" data-anchor-id="force-directed-layouts-only-see-assortativity">Force-directed layouts only see assortativity</h3>
<p>It’s important to observe that both drawings above have been obtained with the same algorithm: a <a href="https://en.wikipedia.org/wiki/Force-directed_graph_drawing">force-directed layout</a>.</p>
<p>Force-directed layout algorithms try to make the edge lengths as small as possible, representing them as attractive forces between the nodes at their endpoints, which are then compensated by an overall repulsive force between every pair of nodes. The final node positions are the ones that balance these competing forces. The usual interpretation of these layouts is that nodes that are close in the projected space are also close in the native “unprojected” structure of the network, and therefore we should be able to observe modules and other kinds of structural patterns visually.</p>
<p>However, this interpretation is not quite true in general, or even often. Such projections are <em>mostly</em> distortions, and while they are informed by the large-scale network structure, they cannot encapsulate it even in situations where we know the network is embedded in a well-defined metric space of a higher dimension<span class="citation" data-cites="chari_specious_2023">&nbsp;[1]</span>—and much less so in the more general case when it’s not. Networks are rich high-dimensional objects that diffuse blobs drawn on a 2D surface cannot really capture; at least not if we are not carefully specific about what patterns we want to extract.</p>
<p>Some might argue that force-directed visualizations are good enough when the structure in the data is very strong, and this is maybe what we should care about in most cases. Although it’s true that sometimes the genuine patterns in the data survive our callous abuse, there are simple scenarios with strong structure where the approach completely fails. For example, the figure below shows a random bipartite graph, i.e.&nbsp;there are two types of nodes, white and black, such that an edge can only connect a white to a black node,<sup>4</sup> but are otherwise placed uniformly at random, visualized using a force-directed layout.</p>
<div class="no-row-height column-margin column-container"><div id="fn4"><p><sup>4</sup>&nbsp;We observe this kind of bipartite pattern in heterosexual relations, for example.</p></div></div><div id="9e55ffd6" class="cell center fig-50" data-execution_count="3">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> graph_tool.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">all</span> <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span></span>
<span id="cb1-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb1-3"></span>
<span id="cb1-4">b <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.concatenate((np.zeros(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span>), np.ones(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span>)))</span>
<span id="cb1-5">d <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.full(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">400</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>)</span>
<span id="cb1-6">u <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> generate_sbm(b, np.array([[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,   <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">600</span>],</span>
<span id="cb1-7">                              [<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">600</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>  ]]),</span>
<span id="cb1-8">                 out_degs<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>d, micro_ers<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">True</span>, micro_degs<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">True</span>)</span>
<span id="cb1-9">u.vp.b <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> b <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> u.new_vp(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"int"</span>, vals<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>b)</span>
<span id="cb1-10">remove_parallel_edges(u)</span>
<span id="cb1-11"></span>
<span id="cb1-12">graph_draw(u, vertex_fill_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>b, fmt<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"svg"</span>, bg_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>])</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/hairball/index_files/figure-html/cell-3-output-1.svg" class="img-fluid figure-img"></p>
<figcaption>Every black node only connects to a white node and vice versa. Yet, the layout is none the wiser!</figcaption>
</figure>
</div>
</div>
</div>
<p>Despite the strong modular pattern in the data, the layout is completely blind to it, as it does not separate the colors—if we didn’t know the graph was bipartite, the visualization would not reveal this to us. This problem generalizes to other kinds of mixing patterns between groups of nodes. For example, if we have three node colors, so that nodes of one color connect only to nodes of a different color, then this structure is also invisible to a force-directed layout:</p>
<div id="0363abb8" class="cell center fig-50" data-execution_count="4">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> matplotlib</span>
<span id="cb2-2"></span>
<span id="cb2-3">b <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.concatenate((np.full(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">150</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>), np.full(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">150</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>), np.full(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">150</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)))</span>
<span id="cb2-4">d <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.full(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">450</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>)</span>
<span id="cb2-5">w <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> generate_sbm(b, np.array([[  <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">600</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">600</span>],</span>
<span id="cb2-6">                              [<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">600</span>,   <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">600</span>],</span>
<span id="cb2-7">                              [<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">600</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">600</span>,   <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>]]),</span>
<span id="cb2-8">                 out_degs<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>d, micro_ers<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">True</span>, micro_degs<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">True</span>)</span>
<span id="cb2-9">w.vp.b <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> b <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> w.new_vp(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"int"</span>, vals<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>b)</span>
<span id="cb2-10">remove_parallel_edges(w)</span>
<span id="cb2-11"></span>
<span id="cb2-12">graph_draw(w, vertex_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>b, vertex_fill_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>b, vcmap<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>matplotlib.cm.tab10, fmt<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"svg"</span>, bg_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>])</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/hairball/index_files/figure-html/cell-4-output-1.svg" class="img-fluid figure-img"></p>
<figcaption>Nodes connect only to nodes of a different color.</figcaption>
</figure>
</div>
</div>
</div>
<p>In fact, this kind of visualization will only reveal modular structure of the “assortative” kind, i.e.&nbsp;when nodes of the same module connect preferentially between themselves:</p>
<div id="02df5631" class="cell center fig-50" data-execution_count="5">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb3" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb3-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> graph_tool.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">all</span> <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span></span>
<span id="cb3-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb3-3"></span>
<span id="cb3-4">b <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.concatenate((np.zeros(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span>), np.ones(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span>)))</span>
<span id="cb3-5">d <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.full(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">400</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>)</span>
<span id="cb3-6">g <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> generate_sbm(b, np.array([[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">700</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">60</span> ],</span>
<span id="cb3-7">                              [<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">60</span>,  <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">700</span>]]),</span>
<span id="cb3-8">                 out_degs<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>d, micro_ers<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">True</span>, micro_degs<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">True</span>)</span>
<span id="cb3-9">b <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> g.new_vp(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"int"</span>, vals<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>b)</span>
<span id="cb3-10">remove_parallel_edges(g)</span>
<span id="cb3-11">remove_self_loops(g)</span>
<span id="cb3-12"></span>
<span id="cb3-13">graph_draw(g, vertex_fill_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>b, fmt<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"svg"</span>, bg_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>])</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/hairball/index_files/figure-html/cell-5-output-1.svg" class="img-fluid figure-img"></p>
<figcaption>Assortativity is the only modular pattern visible to force-directed layout algorithms.</figcaption>
</figure>
</div>
</div>
</div>
<p>But this is only one of a multitude of possible mixing patterns in networks. And furthermore, even if you see apparent modular structure in such visualizations, <a href="http://localhost:6895/posts/descriptive-inferential/#fig-infvsdesc">it does not mean they are statistically meaningful</a>.</p>
</section>
<section id="visualization-first-vs.-visualization-second" class="level3 page-columns page-full">
<h3 class="anchored" data-anchor-id="visualization-first-vs.-visualization-second">“Visualization-first” vs.&nbsp;“visualization-second”</h3>
<p>Since perfect visual network representations are impossible, we need to delineate what are the trade-offs we’re willing to accept in the context of our research questions, and work within them. Importantly, we need to understand the biases of the chosen projection, and what distortions they introduce.</p>
<p>Alas, this critical analytical stance is rarely incorporated in visual network analyses, and the output of visualizations are often taken for granted. In more extreme cases, the two-dimensional projection of a network is taken as the <em>starting point</em> of an analysis, and is used to judge wether further evaluations are meaningful—e.g.&nbsp;a node centrality measure is good if it coincides with what can be seen in the visualization, a community detection method is working well if the partition is sufficiently separated visually, and so on.</p>
<p>This practice is common in the branch of the humanities known as <a href="https://en.wikipedia.org/wiki/Science_and_technology_studies">Science and Technology Studies</a>, in particular with popular software like <a href="https://gephi.org/">Gephi</a>, which arguably encourages this kind of “visualization-first” approach.<sup>5</sup> When coupled with our tendency to extract <a href="https://x.com/GrandjeanMartin/status/1600154712380014594/photo/1">specious interpretations from meaningless shapes</a>, this just becomes a bad way of doing science.</p>
<div class="no-row-height column-margin column-container"><div id="fn5"><p><sup>5</sup>&nbsp;Gephi’s popularity is not unwarranted. It’s a tool that empowers a vast number of users, who would be almost completely disenfranchised without the visual interface it provides.</p>
<p>Nevertheless, although its authors are aware of many of the issues mentioned here, they are a bit too quick to <a href="https://reticular.hypotheses.org/2003">absolve themselves</a> of their statistical carelessness.</p>
<p>Mathieu Jacomy, the co-creator of Gephi, makes an <a href="https://reticular.hypotheses.org/2003">analogy</a> between statistical neglect (as I see it) and off-label drug use. I find the analogy good: that practice may cause harm and lead to hospitalization!</p>
<p>The degree of formalization of a methodology determines how much we understand it, and a final analysis is scientific to the same extent as our understanding of the methodologies used. There are no shortcuts!</p>
<p>But most importantly: It’s doubtful that <em>Gephi’s users</em> even understand the overwhelming handicap that comes with conducting network analysis <strong>entirely</strong> through the dull prism of a force-directed layout. Unfortunately, within the confines of software like Gephi, <a href="https://cytoscape.org/">Cytoscape</a>, etc, users currently have no alternative.</p></div></div><p>“Visualization-first” represents an inversion of priorities in scientific studies. Instead of being the starting point, network visualization should be the result of a well defined analytical procedure, that is informed and <em>determined</em> by our research questions and analytical methodology, and articulates notions of statistical evidence and validity. Otherwise we cannot be sure that the patterns we are seeing should be taken seriously.</p>
<p>Let’s explore these ideas with a couple of examples. Consider below the visualization of <a href="https://networks.skewed.de/net/polblogs">citations between blogs</a> discussing the 2004 US presidential election.</p>
<div id="bb581369" class="cell center fig-75" data-execution_count="7">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> graph_tool.<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">all</span> <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span></span>
<span id="cb4-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> matplotlib</span>
<span id="cb4-3"></span>
<span id="cb4-4">g <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> collection.ns[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"polblogs"</span>]</span>
<span id="cb4-5">g <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> extract_largest_component(g, directed<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">False</span>)</span>
<span id="cb4-6">pos <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> sfdp_layout(g)</span>
<span id="cb4-7"></span>
<span id="cb4-8"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">def</span> rotate(pos, a):</span>
<span id="cb4-9">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">"""Rotate the positions by `a` degrees."""</span></span>
<span id="cb4-10">    theta <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> numpy.radians(a)</span>
<span id="cb4-11">    c, s <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.cos(theta), np.sin(theta)</span>
<span id="cb4-12">    R <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array(((c, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span>s), (s, c)))</span>
<span id="cb4-13">    x, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> pos.get_2d_array()</span>
<span id="cb4-14">    cm <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.array([x.mean(), y.mean()])</span>
<span id="cb4-15">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> pos.t(<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">lambda</span> x: R <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">@</span> (x.a <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> cm) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> cm)</span>
<span id="cb4-16"></span>
<span id="cb4-17">pos <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> rotate(pos, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">160</span>)</span>
<span id="cb4-18"></span>
<span id="cb4-19">dprms <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">dict</span>(fmt<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"png"</span>, output_size<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1200</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1200</span>), bg_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>])</span>
<span id="cb4-20"></span>
<span id="cb4-21">graph_draw(g, pos, vertex_fill_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>g.vp.value, vcmap<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>matplotlib.cm.coolwarm,</span>
<span id="cb4-22">           vcnorm<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>matplotlib.colors.Normalize(vmin<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, vmax<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>), <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>dprms)</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/hairball/index_files/figure-html/cell-7-output-1.png" width="1200" height="1051" class="figure-img"></p>
<figcaption>Political blog network from circa 2004. Blue nodes are aligned with the democrats, and red with the republicans.</figcaption>
</figure>
</div>
</div>
</div>
<p>We can see two obvious assortative modules, corresponding to the preferred political affiliation of each blog to one of the two candidates (indicated also by the node colors). This is a pretty straightforward and plausible narrative, well encapsulated by the tagline “divided they blog” of the original paper that analyzed this data<span class="citation" data-cites="adamic_political_2005">&nbsp;[2]</span>.</p>
<p>But is this the whole story? Or is just the most prominent pattern that survives the projection? What about non-assortative modular patterns? We know we would not be able to see them if they were there.</p>
<p>How do we detect modular patterns in networks in a statistically robust way? The state-of-the-art consists in <a href="../descriptive-inferential">inferential community detection</a><span class="citation" data-cites="peixoto_descriptive_2023">&nbsp;[3]</span><sup>6</sup> based on Bayesian methods<span class="citation" data-cites="peixoto_bayesian_2019">&nbsp;[4]</span>. These methods evaluate statistical evidence in a principled way and are <a href="../inference-compression">guaranteed not to overfit</a>.<sup>7</sup></p>
<div class="no-row-height column-margin column-container"><div id="fn6"><p><sup>6</sup>&nbsp;See <a href="https://graph-tool.skewed.de/static/doc/demos/inference/inference.html">here</a> for a detailed HOWTO on inferential community detection using <a href="https://graph-tool.skewed.de">graph-tool</a>.</p></div><div id="fn7"><p><sup>7</sup>&nbsp;Some widespread methods of module detection like <a href="../modularity-harmful">modularity maximization</a> are ill-suited for this task for two important reasons: 1. They are just as blind to general modular patterns as force-directed layouts, and can only uncover assortative mixing; 2. They <a href="../hidden-models">massively overfit</a>, and will find seemingly “strong” modules even in maximally random networks.</p></div></div><p>So what happens when we employ such a method on this network? We can see the results below.</p>
<div id="6b68b94d" class="cell center fig-75" data-execution_count="8">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1">state <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> minimize_nested_blockmodel_dl(g)</span>
<span id="cb5-2">state.levels[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>].draw(pos<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>pos, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>dprms)</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/hairball/index_files/figure-html/cell-8-output-1.png" width="1200" height="1051" class="figure-img"></p>
<figcaption>Statistically meaningful modular structure found for the political blog network, but obscured by the force-directed layout.</figcaption>
</figure>
</div>
</div>
</div>
<p>At this point, if you rely on the force-directed layout to judge the quality of the result, you will tend to reject it, since the colors are all mixed together and the structure they represent isn’t at all clear. It’s easy to imagine a Gephi user immediately discarding this result, and opting instead for a more aesthetically pleasing partition of the network—even if it’s a statistical illusion, or obscures important information.</p>
<p>But there’s a better way!</p>
</section>
<section id="turning-the-tables-enforcing-visual-modularity" class="level3 page-columns page-full">
<h3 class="anchored" data-anchor-id="turning-the-tables-enforcing-visual-modularity">Turning the tables: enforcing visual modularity</h3>
<p>There’s no good reason for us to accept the status quo: We can simply modify how the layout behaves based on what we know about the network data, or what we have discovered using a well-defined methodology that is relevant for our research question. Equipped with this information, we can then use it to constrain the visualization, rather than the other way around.</p>
<p>In the case of a force-directed layout we can simply add an additional attractive force between nodes that belong to the same detected module.<sup>8</sup> For the political blog network, this results in the following:</p>
<div class="no-row-height column-margin column-container"><div id="fn8"><p><sup>8</sup>&nbsp;This can be done in <a href="https://graph-tool.skewed.de">graph-tool</a> by passing the options <code>groups</code>, containing the partition, and <code>gamma</code>, controlling the strength of the attractive force, to the <a href="https://graph-tool.skewed.de/static/doc/autosummary/graph_tool.draw.sfdp_layout.html">sfdp_layout()</a> function.</p></div></div><div id="fcadd41e" class="cell center fig-75" data-execution_count="10">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb6" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb6-1">pos2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> sfdp_layout(g, groups<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>state.levels[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>].b, gamma<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.04</span>) </span>
<span id="cb6-2">pos2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> rotate(pos2, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>) </span>
<span id="cb6-3">state.levels[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>].draw(pos<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>pos2, edge_gradient<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[], edge_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#33333322"</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>dprms)</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/hairball/index_files/figure-html/cell-10-output-1.png" width="1200" height="770" class="figure-img"></p>
<figcaption>Same modular structure as the one found in the previous figure, but now with an attractive force between nodes of the same group.</figcaption>
</figure>
</div>
</div>
</div>
<p>The result is not only more aesthetic, but it enables us to more clearly investigate visually the structure that the our inference algorithm has uncovered. We can see now that the peripheric blogs—those that mostly cite to other blogs but are never themselves cited, or vice-versa—tend to have very specific preferences, and do not cite (or are cited) indiscriminately. Most of the subgroups inside each of the two large factions cite themselves in specific ways, and most citations between them are done by a much smaller subset of the nodes, indicating different degrees of insularity.</p>
<p>None of these statistically valid patterns are visible in the original force-directed layout.</p>

<div class="no-row-height column-margin column-container"><div class="" style="clear:both">
<p>An alternative way of visualizing hierarchical modular structures in networks is via a <a href="https://en.wikipedia.org/wiki/Chord_diagram_(information_visualization)">chordal diagram</a>, as shown below, which can be more readable in some circumstances.</p>
<div id="3de50ef8" class="cell center fig-100" data-execution_count="12">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb7-1">state.draw(bg_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>])<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">;</span></span></code></pre></div></div>
</details>
<div class="cell-output cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/hairball/index_files/figure-html/cell-12-output-1.png" width="600" height="600" class="figure-img img-fluid"></p>
<figcaption>Chordal diagram of the hierarchical modular structure found in the political blog network.</figcaption>
</figure>
</div>
</div>
</div>
</div><div class="" style="clear:both">
<p>You might be wondering how the bipartite and multipartite graphs we considered earlier will fare under this kind of visualization. The results are exactly as you would expect:</p>
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb8" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb8-1">ustate <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> BlockState(u, b<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>u.vp.b)</span>
<span id="cb8-2">upos <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> sfdp_layout(u, groups<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>ustate.b, gamma<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.1</span>) </span>
<span id="cb8-3">ustate.draw(pos<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>upos, bg_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>])</span>
<span id="cb8-4"></span>
<span id="cb8-5">wstate <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> BlockState(w, b<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>w.vp.b)</span>
<span id="cb8-6">wpos <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> sfdp_layout(w, groups<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>wstate.b, gamma<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.1</span>) </span>
<span id="cb8-7">wstate.draw(pos<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>wpos, bg_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>])</span></code></pre></div></div>
</details>
<div id="96e19a6e" class="cell center fig-75 quarto-layout-panel" data-execution_count="14" data-layout-ncol="2">
<div class="quarto-layout-row">
<div class="quarto-layout-cell" style="flex-basis: 50.0%;justify-content: flex-start;">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/hairball/index_files/figure-html/cell-14-output-1.png" width="600" height="522" class="figure-img"></p>
<figcaption>A random bipartite graph.</figcaption>
</figure>
</div>
</div>
<div class="quarto-layout-cell" style="flex-basis: 50.0%;justify-content: flex-start;">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/hairball/index_files/figure-html/cell-14-output-2.png" width="600" height="596" class="figure-img"></p>
<figcaption>A random tripartite graph.</figcaption>
</figure>
</div>
</div>
</div>
</div>
</div></div>
<p>We can also enforce a <a href="https://graph-tool.skewed.de/static/doc/demos/inference/inference.html#hierarchical-partitions">hierarchical modular structure</a> by adding one additional force per hierarchical level, leading to nested separations at multiple scales:</p>
<div id="92cd9988" class="cell center fig-75" data-execution_count="16">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb9-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> matplotlib <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> pyplot <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> plt</span>
<span id="cb9-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> matplotlib <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> patches, path</span>
<span id="cb9-3"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> scipy.spatial <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> ConvexHull</span>
<span id="cb9-4"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> seaborn <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> sns</span>
<span id="cb9-5"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> itertools <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> groupby</span>
<span id="cb9-6"></span>
<span id="cb9-7">pos3 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> sfdp_layout(g, pos<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>pos2, groups<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>state.get_bs(), gamma<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.04</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.1</span>]) </span>
<span id="cb9-8">pos3 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> rotate(pos3, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>) </span>
<span id="cb9-9"></span>
<span id="cb9-10"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Now we only need to draw some convex polygons around the groups</span></span>
<span id="cb9-11"></span>
<span id="cb9-12"><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">class</span> RoundedPolygon(patches.PathPatch):</span>
<span id="cb9-13">    <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># https://stackoverflow.com/a/66279687/2912349</span></span>
<span id="cb9-14">    <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">def</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">__init__</span>(<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">self</span>, xy, pad, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>kwargs):</span>
<span id="cb9-15">        p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> path.Path(<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">self</span>.__round(xy<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>xy, pad<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>pad))</span>
<span id="cb9-16">        <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">super</span>().<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">__init__</span>(path<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>p, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">**</span>kwargs)</span>
<span id="cb9-17"></span>
<span id="cb9-18">    <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">def</span> __round(<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">self</span>, xy, pad):</span>
<span id="cb9-19">        n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">len</span>(xy)</span>
<span id="cb9-20">        <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> i <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">range</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, n):</span>
<span id="cb9-21">            x0, x1, x2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.atleast_1d(xy[i <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>], xy[i], xy[(i <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">%</span> n])</span>
<span id="cb9-22">            d01, d12 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> x0, x2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> x1</span>
<span id="cb9-23">            l01, l12 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.linalg.norm(d01), np.linalg.norm(d12)</span>
<span id="cb9-24">            u01, u12 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> d01 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> l01, d12 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span> l12</span>
<span id="cb9-25">            x00 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x0 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">min</span>(pad, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> l01) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> u01</span>
<span id="cb9-26">            x01 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">min</span>(pad, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> l01) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> u01</span>
<span id="cb9-27">            x10 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">min</span>(pad, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> l12) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> u12</span>
<span id="cb9-28">            x11 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> x2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">min</span>(pad, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> l12) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> u12</span>
<span id="cb9-29">            <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> i <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>:</span>
<span id="cb9-30">                verts <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [x00, x01, x1, x10]</span>
<span id="cb9-31">            <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">else</span>:</span>
<span id="cb9-32">                verts <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+=</span> [x01, x1, x10]</span>
<span id="cb9-33">        codes <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [path.Path.MOVETO] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> n<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span>[path.Path.LINETO, path.Path.CURVE3, path.Path.CURVE3]</span>
<span id="cb9-34">        verts[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> verts[<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]</span>
<span id="cb9-35">        <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">return</span> np.atleast_1d(verts, codes)</span>
<span id="cb9-36"></span>
<span id="cb9-37">fig, ax <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> plt.subplots(nrows<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, ncols<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, figsize<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.6</span>))</span>
<span id="cb9-38"></span>
<span id="cb9-39">clrs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">list</span>(<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">reversed</span>(sns.color_palette(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"muted"</span>)))</span>
<span id="cb9-40"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> l <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">reversed</span>(<span class="bu" style="color: null;
background-color: null;
font-style: inherit;">range</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>)):</span>
<span id="cb9-41">    lstate <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> state.project_level(l)</span>
<span id="cb9-42">    vlist <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">sorted</span>(lstate.g.vertices(), key<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">lambda</span> v: lstate.b[v])</span>
<span id="cb9-43">    hulls <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> []</span>
<span id="cb9-44">    <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> r, vs <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> groupby(vlist, key<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">lambda</span> v: lstate.b[v]):</span>
<span id="cb9-45">        vs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">list</span>(vs)</span>
<span id="cb9-46">        hull <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> ConvexHull([pos3[v].a <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> v <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> vs])</span>
<span id="cb9-47">        xy <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [pos3[vs[i]] <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> i <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> hull.vertices]</span>
<span id="cb9-48">        p <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> ax.add_patch(RoundedPolygon(xy, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,</span>
<span id="cb9-49">                                        facecolor<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>clrs[l],</span>
<span id="cb9-50">                                        edgecolor<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"black"</span>,</span>
<span id="cb9-51">                                        linewidth<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.5</span>, alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.5</span>))</span>
<span id="cb9-52">        p.set_zorder(<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>)</span>
<span id="cb9-53"></span>
<span id="cb9-54">ax.add_artist(ax.patch)</span>
<span id="cb9-55"></span>
<span id="cb9-56">a <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> state.levels[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>].draw(pos<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>pos3, edge_gradient<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[], edge_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"#33333311"</span>, mplfig<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>ax)</span>
<span id="cb9-57">a.fit_view(yflip<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">True</span>)</span>
<span id="cb9-58"></span>
<span id="cb9-59">ax.get_xaxis().set_visible(<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">False</span>)</span>
<span id="cb9-60">ax.get_yaxis().set_visible(<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">False</span>)</span>
<span id="cb9-61">ax.spines[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'right'</span>].set_visible(<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">False</span>)</span>
<span id="cb9-62">ax.spines[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'top'</span>].set_visible(<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">False</span>)</span>
<span id="cb9-63">ax.spines[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'left'</span>].set_visible(<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">False</span>)</span>
<span id="cb9-64">ax.spines[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">'bottom'</span>].set_visible(<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">False</span>)</span>
<span id="cb9-65">ax.patch.set_facecolor(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"white"</span>)</span>
<span id="cb9-66">fig.tight_layout(pad<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.0</span>)</span>
<span id="cb9-67">fig.savefig(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"polblogs-nested.png"</span>, transparent<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">True</span>, bbox_inches<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"tight"</span>, pad_inches<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.0</span>)</span></code></pre></div></div>
</details>
</div>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/hairball/polblogs-nested.png" class="center figure-img" style="width:75.0%"></p>
<figcaption>Inferred hierarchical modular structure for the political blog networks. The convex polygons enclose groups of nodes at different hierarchical levels.</figcaption>
</figure>
</div>
<p>This simple idea opens many opportunities to visualize networks outside of the shackles of standard force-directed algorithms.</p>
</section>
<section id="ranked-networks" class="level3">
<h3 class="anchored" data-anchor-id="ranked-networks">Ranked networks</h3>
<p>Modularity is not the only aspect that we can enforce in the visualization. Some networks also possess a latent rank—or an ordering—of the nodes. Most force-directed layout algorithms completely ignore the directionality of the edges, and therefore do not capture this kind of structure. So solve this, we can add an additional force that tends to anchor the nodes in the vertical direction according to their relative ordering, together with their modular structure.</p>
<p>For example, the visualization below shows a <a href="https://networks.skewed.de/net/foodweb_little_rock">food web network</a>, with inferred groups and <a href="https://graph-tool.skewed.de/static/doc/demos/inference/inference.html#ordered-community-structure">latent ordering</a><span class="citation" data-cites="peixoto_ordered_2022">&nbsp;[5]</span>:</p>
<div id="19881cd4" class="cell center fig-75" data-execution_count="18">
<details class="code-fold">
<summary>Code</summary>
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb10" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb10-1">g <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> collection.ns[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"foodweb_little_rock"</span>]</span>
<span id="cb10-2">state <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> minimize_nested_blockmodel_dl(g, state_args<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">dict</span>(base_type<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>RankedBlockState))</span>
<span id="cb10-3"><span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">for</span> i <span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">in</span> <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">range</span>(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>):</span>
<span id="cb10-4">    state.multiflip_mcmc_sweep(beta<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>numpy.inf, niter<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>)</span>
<span id="cb10-5">pos <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> sfdp_layout(g, groups<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>state.levels[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>].b, gamma<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.6</span>, rmap<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>state.levels[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>].get_vertex_order(), R<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>)</span>
<span id="cb10-6">pos <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> pos.t(<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">lambda</span> x: (x[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>], x[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.4</span>))</span>
<span id="cb10-7">state.levels[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>].draw(pos<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>pos, vertex_text<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>state.levels[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>].get_vertex_order(),</span>
<span id="cb10-8">                     edge_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>state.levels[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>].get_edge_colors().t(<span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">lambda</span> x: <span class="bu" style="color: null;
background-color: null;
font-style: inherit;">list</span>(x[:<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>]) <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> [<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.2</span>] <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">if</span> x[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>] <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.5</span> <span class="cf" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;">else</span> x),</span>
<span id="cb10-9">                     fmt<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"svg"</span>, bg_color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>[<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>])</span></code></pre></div></div>
</details>
<div class="cell-output cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/hairball/index_files/figure-html/cell-18-output-1.svg" class="img-fluid figure-img"></p>
<figcaption>A food web among the species found in Little Rock Lake in Wisconsin. The node labels show the inferred trophic rank. Red edges represent rank violations.</figcaption>
</figure>
</div>
</div>
</div>
<p>A standard force-directed layout would make this kind of visualization nearly impossible.</p>
</section>
<section id="caveats" class="level3 page-columns page-full">
<h3 class="anchored" data-anchor-id="caveats">Caveats</h3>
<p>The “visualization-second” approach gives the user more control and makes visualizations easier to interpret reliably. But it’s not without its own caveats and limitations. Nothing we can do will solve the fundamental representation problem we described earlier, so the visualizations we obtain in this way are also not without its own distortions and omissions. The main advantage is that these have been articulated explicitly as formal modeling assumptions in the inferential methods that we have used to obtain the modules and orderings that constrain the visualization. We need only to keep in mind that different models exist, which, when used, might reveal other relevant aspects of the data. Therefore, just as no model is final, neither is a particular visualization strategy.</p>
<p>Looking forward, we need to be able to move away from the staple of force-directed layouts, and incorporate not only more methodological rigor but also more creativity in the way we visualize networks. There’s a whole universe of structural patterns out there that we would not be able to see if we stick to the same tired old routine.</p>
<section id="references" class="level4">
<h4 class="anchored" data-anchor-id="references">References</h4>
<div id="refs" class="references csl-bib-body" data-entry-spacing="0">
<div id="ref-chari_specious_2023" class="csl-entry">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">T. Chari and L. Pachter, <em><a href="https://doi.org/10.1371/journal.pcbi.1011288">The Specious Art of Single-Cell Genomics</a></em>, PLOS Computational Biology <strong>19</strong>, e1011288 (2023).</div>
</div>
<div id="ref-adamic_political_2005" class="csl-entry">
<div class="csl-left-margin">[2] </div><div class="csl-right-inline">L. A. Adamic and N. Glance, <em><a href="https://doi.org/10.1145/1134271.1134277">The Political Blogosphere and the 2004 <span>U</span>.<span>S</span>. Election: Divided They Blog</a></em>, in <em>Proceedings of the 3rd International Workshop on <span>Link</span> Discovery</em> (ACM, New York, NY, USA, 2005), pp. 36–43.</div>
</div>
<div id="ref-peixoto_descriptive_2023" class="csl-entry">
<div class="csl-left-margin">[3] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1017/9781009118897">Descriptive Vs. <span>Inferential Community Detection</span> in <span>Networks</span>: <span>Pitfalls</span>, <span>Myths</span> and <span>Half-Truths</span></a></em>, Elements in the Structure and Dynamics of Complex Networks (2023).</div>
</div>
<div id="ref-peixoto_bayesian_2019" class="csl-entry">
<div class="csl-left-margin">[4] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1002/9781119483298.ch11">Bayesian <span>Stochastic Blockmodeling</span></a></em>, in <em>Advances in <span>Network Clustering</span> and <span>Blockmodeling</span></em> (John Wiley &amp; Sons, Ltd, 2019), pp. 289–332.</div>
</div>
<div id="ref-peixoto_ordered_2022" class="csl-entry">
<div class="csl-left-margin">[5] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevE.106.024305">Ordered Community Detection in Directed Networks</a></em>, Physical Review E <strong>106</strong>, 024305 (2022).</div>
</div>
</div>
<hr>
</section>
<section id="comments" class="level4">
<h4 class="anchored" data-anchor-id="comments">Comments</h4>
<div class="discourse-excerpt" style="display: none">
<p>If you reply to this post, it will show as a comment below the original article.</p>
</div>
<div id="discourse-comments"></div>
<meta name="discourse-username" content="tiago">

<script type="text/javascript">

  const discourse_url = "https://forum.skewed.de";

  // Here, we determine the theme, and send a message to the iframe to let it know what the theme is
  // See below for how we hook up notifyFrameStyle 
  const notifyIFrameOfTheme = () => {
    const iframe = document.getElementById("discourse-embed-frame");
    if (document.body.classList.contains("quarto-dark")) {
      theme = "dark";
    } else {
      theme = "light";
    }

    if (iframe && iframe.contentWindow) {
      iframe.contentWindow.postMessage(
        {
          // Modify the line below to grab dark mode setting, depending on how you store it
          theme: theme
        },
        discourse_url
      );
    }
  };

  // Call setFrameStyle when we receive the "iframe loaded" message
  const handleMessageListener = (event) => {
    var origin = event.origin;
    if ((origin === discourse_url) && (event.data == "iframe loaded")) {
      notifyIFrameOfTheme();
    }
  };

  DiscourseEmbed = {
    discourseUrl: 'https://forum.skewed.de/',
    discourseEmbedUrl: 'https://skewed.de/lab/posts/hairball/',
    //className: 'discourse-excerpt',
  };
  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();

  window.addEventListener("message", handleMessageListener);
</script>
</section>
<section id="webmentionswebmentions" class="level4">
<h4 class="anchored" data-anchor-id="webmentionswebmentions">Webmentions<sup>9</sup></h4>
<div id="nomention">
<p>(Nothing yet)</p>
</div>
<div class="mentionsio">
<ul id="facepile">
</ul>
<ul id="reposts">
</ul>
<ul id="mentions">
</ul>
</div>


</section>
<div class="no-row-height column-margin column-container"><div id="fn9"><p><sup>9</sup>&nbsp;<a href="https://indieweb.org/Webmention">Webmention</a> is a standardized decentralized mechanism for conversations and interactions across the web.</p></div></div></section>


</div> ]]></description>
  <category>network visualization</category>
  <category>inference</category>
  <category>hairball</category>
  <category>apophenia</category>
  <category>ridiculogram</category>
  <category>methodological imperialism</category>
  <guid>https://skewed.de/lab/posts/hairball/</guid>
  <pubDate>Sun, 19 May 2024 22:00:00 GMT</pubDate>
  <media:content url="https://skewed.de/lab/posts/hairball/polblogs-sbm.png" medium="image" type="image/png" height="92" width="144"/>
</item>
<item>
  <title>Hidden models and latent compression in community detection</title>
  <dc:creator>Tiago P. Peixoto</dc:creator>
  <link>https://skewed.de/lab/posts/hidden-models/</link>
  <description><![CDATA[ 

<div class="h-entry e-content entry-content page-columns page-full">




<p>This is an overdue post on a paper published last year with <a href="https://aleckirkley.com/">Alec Kirkley</a>, named <em>“Implicit Models, Latent Compression, Intrinsic Biases, and Cheap Lunches in Community Detection”</em><span class="citation" data-cites="peixoto_implicit_2023">&nbsp;[1]</span>.</p>
<div class="hidden">
<p><img src="https://latex.codecogs.com/png.latex?%0A%5Cnewcommand%7B%5Cb%7D%7B%5Cboldsymbol%20b%7D%0A%5Cnewcommand%7B%5CA%7D%7B%5Cboldsymbol%20A%7D%0A"></p>
</div>
<p>There are essentially two kinds of community detection methods (or data analysis procedures in general): <a href="../descriptive-inferential">descriptive, and inferential</a><span class="citation" data-cites="peixoto_descriptive_2023">&nbsp;[2]</span>. Inferential methods attempt to fit a generative model to data, reject a null model, or in some other way articulate mechanisms of network formation, or more formally, a population of potential observations from which the observed data is only one possibility—so, for example, a network with assortative community structure becomes one where there’s a higher <em>probability</em> of an edge being formed between two nodes of the same group. A descriptive method, on the other hand, doesn’t evoke explicitly an edge formation mechanism, and relies instead on simply describing the structural patterns seen (e.g.&nbsp;a community is a group of nodes with sufficiently more internal than external observed edges). In either case we typically wish to find the best partition <img src="https://latex.codecogs.com/png.latex?%5Chat%5Cb(%5CA)"> of a network <img src="https://latex.codecogs.com/png.latex?%5CA">. In the case of descriptive methods this is usually obtained via the optimization of a non-probabilistic quality function <img src="https://latex.codecogs.com/png.latex?W(%5CA,%5Cb)">, <img src="https://latex.codecogs.com/png.latex?%0A%5Chat%5Cb(%5CA)%20=%20%5Cunderset%7B%5Cb%7D%7B%5Coperatorname%7Barg%20max%7D%7D%5C;%20W(%5CA,%5Cb).%0A"> Some of the most serious problems of descriptive methods arise when their results are interpreted in an inferential way, e.g.&nbsp;ascribing the communities found to homophily or other mixing preferences. Many practitioners are surprised and concerned when these descriptive methods find <a href="../../#fig-random">nontrivial clusters</a> in random graphs where the presence of any edge in the network has the exact same probability<span class="citation" data-cites="guimera_modularity_2004">&nbsp;[3]</span>, in this way betraying a clear <a href="../descriptive-inferential">inferential goal</a>, in contradiction with what the method being used is actually expected to accomplish—a goal perhaps shared even with the designers of the method, who acted inadvertently.</p>
<p>Despite its importance, this issue hasn’t yet prevented compromised methods such as <a href="../modularity-harmful">modularity maxizimization</a> to be employed <em>en masse</em>—although it’s unclear if most users even realize the problem. In any case, this is not the only instance of specious statistical practice permeating through vast areas of science<span class="citation" data-cites="chari_specious_2023 wasserstein_asa_2016">&nbsp;[4,5]</span>. Evidently, pontification and explanation only go so far.<sup>1</sup></p>
<div class="no-row-height column-margin column-container"><div id="fn1"><p><sup>1</sup>&nbsp;“If you’re explaining, you’re losing.” — Ronald Reagan</p></div></div><p>In an effort to understand a bit better the consequences of interpreting descriptive methods in an inferential way, Alec and I tried to <em>reverse engineer</em> them. In other words, we asked the question:</p>
<blockquote class="blockquote">
<p>If we interpret the results of a community detection algorithm as inferential, to what generative model does it correspond?</p>
</blockquote>
<p>We managed to go surprisingly far in answering this question!</p>
<section id="every-method-is-inferential-when-the-model-is-bad-enough" class="level2 page-columns page-full">
<h2 class="anchored" data-anchor-id="every-method-is-inferential-when-the-model-is-bad-enough">Every method is inferential when the model is bad enough</h2>
<p>Algorithmically, inferential methods are not so different from descriptive ones; in fact, at least at first,<sup>2</sup> it all boils down to choosing a different quality function <img src="https://latex.codecogs.com/png.latex?%0A%20%20%20%20W(%5CA,%5Cb)%20=%20P(%5Cb%20%7C%20%5CA),%0A"> where <span id="eq-bayes"><img src="https://latex.codecogs.com/png.latex?%0A%20%20%20%20P(%5Cb%20%7C%20%5CA)%20=%20%5Cfrac%7BP(%5CA%20%7C%20%5Cb)P(%5Cb)%7D%7BP(%5CA)%7D%0A%5Ctag%7B1%7D"></span> is the posterior probability of a partition <img src="https://latex.codecogs.com/png.latex?%5Cb"> given an observed network <img src="https://latex.codecogs.com/png.latex?%5CA">. This isn’t a trivial difference, however, since defining the quality function in this way amounts precisely to reasoning about possible generative mechanism and our prior assumptions over their parameters, as discussed <a href="../inference-compression">previously</a>.</p>
<div class="no-row-height column-margin column-container"><div id="fn2"><p><sup>2</sup>&nbsp;At first, there’s no algorithmic difference. However, in an inferential setting, we quickly realize that there’s no reason to focus only on the best partition, and we might choose instead to characterize the whole posterior distribution <img src="https://latex.codecogs.com/png.latex?P(%5Cb%20%7C%20%5CA)">, and average over it, so we can quantify uncertainties, competing hypotheses, and everything else that is essential to a serious scientific pipeline.</p></div><div id="fn3"><p><sup>3</sup>&nbsp;Interestingly, as we show in the paper, the precise shape of <img src="https://latex.codecogs.com/png.latex?g(x)"> has asymptotically no effect whatsoever in the resulting generative model, up to a multiplicative “inverse temperature” constant.</p></div></div><p>The idea we explored in <span class="citation" data-cites="peixoto_implicit_2023">&nbsp;[1]</span> is that we can essentially reverse Bayes’ formula in Equation&nbsp;1, and obtain an <em>implicit</em> generative model that is compatible with any given quality function <img src="https://latex.codecogs.com/png.latex?W(%5CA,%5Cb)">: <span id="eq-model"><img src="https://latex.codecogs.com/png.latex?%0A%20%20%20%20P(%5CA,%5Cb)%20=%20%5Cfrac%7B%5Cmathrm%7Be%7D%5E%7Bg(W(%5CA,%5Cb))%7D%7D%7BZ%7D,%0A%5Ctag%7B2%7D"></span> where <img src="https://latex.codecogs.com/png.latex?g(x)"> is any non-decreasing invertible function,<sup>3</sup> and <img src="https://latex.codecogs.com/png.latex?Z=%5Csum_%7B%5CA,%5Cb%7D%0A%5Cmathrm%7Be%7D%5E%7Bg(W(%5CA,%5Cb))%7D"> is a normalization constant. In order to understand what that means, consider the illustration in Figure&nbsp;1.</p>
<div id="fig-implicit" class="highlight quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-implicit-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://skewed.de/lab/posts/hidden-models/diagram.svg" class="highlight img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-implicit-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Diagrammatic illustration of the inverse problem we consider in Ref. <span class="citation" data-cites="peixoto_implicit_2023">&nbsp;[1]</span>. (a) A community detection algorithm provides a mapping <img src="https://latex.codecogs.com/png.latex?%5Chat%5Cb(%5CA)=%5Cb"> of a network <img src="https://latex.codecogs.com/png.latex?%5CA"> to a partition <img src="https://latex.codecogs.com/png.latex?%5Cb"> of its nodes. (b) This mapping can always be inverted, such that for any given partition <img src="https://latex.codecogs.com/png.latex?%5Cb"> of the nodes we can consider the set of all networks <img src="https://latex.codecogs.com/png.latex?%5CA"> such that <img src="https://latex.codecogs.com/png.latex?%5Chat%5Cb(%5CA)=%5Cb">. This set of networks reveals the implicit generative model compatible with the community detection algorithm under consideration (we show three independent samples drawn uniformly from this set). The arrow from case 2 in panel (a) to (b) indicates that the same partition is considered in both examples.
</figcaption>
</figure>
</div>
<p>The networks generated by the implicit model in panel (b) of Figure&nbsp;1 are markedly different from the original network in case 2 in (a), which would be generated only with a very low probability under this model. This happens because the mixing between groups tends to be homogeneous for networks sampled from the model, whereas in the network in case 2 in (a) the groups connect preferentially to a central group (in blue) and they have more heterogeneous densities. This mismatch indicates that the underlying model is in fact a poor representation of the network structure — which would be impossible to determine from the results of panel (a) alone. Therefore, characterizing the implicit models hidden behind community detection methods allows us to evaluate their ability to faithfully capture network structure in a systematic manner and reveal their intrinsic biases towards particular kinds of structure.</p>
<p>Furthermore, this reverse engineering allows us to compare different community detection methods on equal grounds; in particular it allows us to compute their <a href="../inference-compression">description length</a>, <img src="https://latex.codecogs.com/png.latex?%0A%5CSigma%20(%5CA,%5Cb)%20=%20-W(%5CA,%5Cb)%20+%20%5Clog%20Z,%0A"></p>
<p>i.e.&nbsp;the amount of information required to describe both the data and the model parameters — which is a universal model selection criterion that removes the need for “ground truth” labels for method comparison. The “partition function” <img src="https://latex.codecogs.com/png.latex?Z"> is not trivial to compute, but we show how it can be done for a wide class of quality functions.<sup>4</sup></p>
<div class="no-row-height column-margin column-container"><div id="fn4"><p><sup>4</sup>&nbsp;The computation of <img src="https://latex.codecogs.com/png.latex?Z"> can in fact be seen as the main technical contribution of our work.</p></div></div><p>Does that mean that those that propose or use a specific quality function <img src="https://latex.codecogs.com/png.latex?W(%5CA,%5Cb)"> advocate for or even accept the implicit generative model of Equation&nbsp;2 as a realistic explanation of their data? Well, what goes on in <a href="../objective-inference">peoples’ minds</a> is not our primary concern. The relevant point here is that they certainly <em>cannot coherently object</em> to this generative model, while at the same time interpreting the results of their algorithm in an inferential manner.</p>
</section>
<section id="no-benign-overfitting-in-community-detection" class="level2 page-columns page-full">
<h2 class="anchored" data-anchor-id="no-benign-overfitting-in-community-detection">No “benign overfitting” in community detection</h2>
<p>Well, and how do the descriptive results fare, when their implicit generative models come to light? We compared the descriptive methods modularity maximization and Infomap with a variety of inferential ones on a corpus of over 500 empirical networks, and the results are striking:</p>
<div id="fig-overfit" class="highlight quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-overfit-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://skewed.de/lab/posts/hidden-models/dl-comp-best-randomNone-sparseTrue.svg" class="highlight img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-overfit-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: Fraction of networks in our corpus where a given model <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BM%7D_1"> (vertical axis) achieves equal or better compression than the alternative model <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BM%7D_2"> (horizontal axis).
</figcaption>
</figure>
</div>
<p>Infomap provides an inferior compression to the <em>Erdős–Rényi model</em>—the most random model of them all, and hence, one could expect, the <em>least</em> compressive—for 38% of the networks! The configuration model beats both methods in 45% (modularity) and 60% (Infomap) of the instances. Conversely, inferential methods based on variations of the stochastic block model (SBM) provide a better compression for 97% (Infomap) and 96% (modularity) of the data.<sup>5</sup> In other words, modularity and Infomap, two very popular descriptive methods, <strong>massively overfit</strong> empirical data, and should not be used to aid inferential analyses.</p>
<div class="no-row-height column-margin column-container"><div id="fn5"><p><sup>5</sup>&nbsp;Revealingly, those few instances where modularity and Infomap yield (usually marginally) superior compression, albeit with answers compatible with the inferential methods, are often for “toy” networks such as <a href="https://networks.skewed.de/net/football">US college football</a>, commonly used as simple examples in community detection papers. These networks have patterns that modularity and Infomap implicitly expect: uniformly assortativive communities with equal size and density. Given that their unrepresentative character is in diametrical opposition to how often they are used as illustrations, maybe such “toy” examples should be retired.</p></div></div><p>So, we’re not so lucky as with some kinds of statistical models that get <a href="https://en.wikipedia.org/wiki/Double_descent">regularization for free</a> as the result of an apparent act of <a href="https://arxiv.org/abs/2002.05202">divine benevolece</a>… In community detection we have to work for it, so that you (the user) <a href="https://graph-tool.skewed.de/static/doc/demos/inference/inference.html">do not have to</a>.</p>
<p>There are a lot of other goodies in the paper, but I do not want to spoil the pleasure of reading its 28 pages and 14 figures! Here’s just a sneak peek:</p>
<ol type="1">
<li><p>We show how computing the description length of modularity can be used to select the most compressive value of the resolution parameter <img src="https://latex.codecogs.com/png.latex?%5Cgamma">, and in this way solve not only its resolution limit<span class="citation" data-cites="fortunato_resolution_2007">&nbsp;[6]</span>, but also its overfitting problem<span class="citation" data-cites="guimera_modularity_2004">&nbsp;[3]</span>. To those that care: you’re welcome.</p></li>
<li><p>We show that a broad class of quality functions—that includes modularity and Infomap—amounts to a planted partition SBM likelihood with very speficic priors on the strength of assortativity and the number of groups. It seems very difficult to make assumptions (explicit or otherwise) about community structure that evades what the SBM articulates!</p></li>
<li><p>We analyze the implicit priors of modularity maximization and Infomap and they’re <strong>crazy</strong>: they show abrupt transitions in their expected values, forbid entire regions of the parameter space, show nontrivial scaling with system size, etc. It’s ironic that sometimes people complain that the SBM embodies <a href="../hypothesis-is-not-belief">unrealistic assumptions</a> about the data (not untrue—it’s a network histogram, nothing more), but have been unknowingly ingesting lethal doses of toxic, unjustifiable assumptions into their analyses this whole time.</p></li>
<li><p>We explore Bayes optimal instances of the community detection problem—i.e. instances where each corresponding method must behave optimally, and show that there’s a fundamental asymmetry between methods: a more general model such as the Nested SBM (NSBM) will behave virtually just as well for instances of the problem that are optimal for modularity, but the opposite is far from being true: for instances where the NSBM is optimal, modularity maximization performs abysmally.</p>
<p>This runs against what is arguably one of the most vacuous statements in the field: the “no free lunch” theorem for community detection<span class="citation" data-cites="peel_ground_2017">&nbsp;[7]</span>, that states that every community detection algorithm shows exactly the same performance<sup>6</sup> when averaged over “all problem instances”—considered to be fully uniform matchings between network and partition, formally defining a maximally random generative model. As <a href="../free-lunch">previosly discussed</a>, this uniform model generates problem instances that are strictly <em>incompressible</em>, therefore utterly unrepresentative of anything we want to consider either in theory or in practice.</p></li>
</ol>
<div class="no-row-height column-margin column-container"><div id="fn6"><p><sup>6</sup>&nbsp;The “same performance” that all algorithms exhibit amounts to an asymptotic accuracy of exactly zero, since in those uninformative instances an algorithm can do no better than guessing at random.</p></div></div><p>What we show for community detection is this work is valid much more broadly: One of the biggest lies ever told is that there are “model free” methods of data analysis. Not possible! The most that can be done is to <em>hide</em> models from plain sight. But with sufficiently careful reverse engineering, it might still be possible to reveal the horrors that lie beneath such obstructions.</p>
<section id="references" class="level4">
<h4 class="anchored" data-anchor-id="references">References</h4>
<div id="refs" class="references csl-bib-body" data-entry-spacing="0">
<div id="ref-peixoto_implicit_2023" class="csl-entry">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">T. P. Peixoto and A. Kirkley, <em><a href="https://doi.org/10.1103/PhysRevE.108.024309">Implicit Models, Latent Compression, Intrinsic Biases, and Cheap Lunches in Community Detection</a></em>, Physical Review E <strong>108</strong>, 024309 (2023).</div>
</div>
<div id="ref-peixoto_descriptive_2023" class="csl-entry">
<div class="csl-left-margin">[2] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1017/9781009118897">Descriptive Vs. <span>Inferential Community Detection</span> in <span>Networks</span>: <span>Pitfalls</span>, <span>Myths</span> and <span>Half-Truths</span></a></em>, Elements in the Structure and Dynamics of Complex Networks (2023).</div>
</div>
<div id="ref-guimera_modularity_2004" class="csl-entry">
<div class="csl-left-margin">[3] </div><div class="csl-right-inline">R. Guimerà, M. Sales-Pardo, and L. A. N. Amaral, <em><a href="https://doi.org/10.1103/PhysRevE.70.025101">Modularity from Fluctuations in Random Graphs and Complex Networks</a></em>, Physical Review E <strong>70</strong>, 025101 (2004).</div>
</div>
<div id="ref-chari_specious_2023" class="csl-entry">
<div class="csl-left-margin">[4] </div><div class="csl-right-inline">T. Chari and L. Pachter, <em><a href="https://doi.org/10.1371/journal.pcbi.1011288">The Specious Art of Single-Cell Genomics</a></em>, PLOS Computational Biology <strong>19</strong>, e1011288 (2023).</div>
</div>
<div id="ref-wasserstein_asa_2016" class="csl-entry">
<div class="csl-left-margin">[5] </div><div class="csl-right-inline">R. L. Wasserstein and N. A. Lazar, <em><a href="https://doi.org/10.1080/00031305.2016.1154108">The <span>ASA Statement</span> on p-<span>Values</span>: <span>Context</span>, <span>Process</span>, and <span>Purpose</span></a></em>, The American Statistician <strong>70</strong>, 129 (2016).</div>
</div>
<div id="ref-fortunato_resolution_2007" class="csl-entry">
<div class="csl-left-margin">[6] </div><div class="csl-right-inline">S. Fortunato and M. Barthélemy, <em><a href="https://doi.org/10.1073/pnas.0605965104">Resolution Limit in Community Detection</a></em>, Proceedings of the National Academy of Sciences <strong>104</strong>, 36 (2007).</div>
</div>
<div id="ref-peel_ground_2017" class="csl-entry">
<div class="csl-left-margin">[7] </div><div class="csl-right-inline">L. Peel, D. B. Larremore, and A. Clauset, <em><a href="https://doi.org/10.1126/sciadv.1602548">The Ground Truth about Metadata and Community Detection in Networks</a></em>, Science Advances <strong>3</strong>, e1602548 (2017).</div>
</div>
</div>
<hr>
</section>
<section id="comments" class="level4">
<h4 class="anchored" data-anchor-id="comments">Comments</h4>
<p>(Comments may be moderated.)</p>
<div class="discourse-excerpt" style="display: none">
<p>If you reply to this post, it will show as a comment below the original article.</p>
</div>
<div id="discourse-comments"></div>
<meta name="discourse-username" content="tiago">

<script type="text/javascript">

  const discourse_url = "https://forum.skewed.de";

  // Here, we determine the theme, and send a message to the iframe to let it know what the theme is
  // See below for how we hook up notifyFrameStyle 
  const notifyIFrameOfTheme = () => {
    const iframe = document.getElementById("discourse-embed-frame");
    if (document.body.classList.contains("quarto-dark")) {
      theme = "dark";
    } else {
      theme = "light";
    }

    if (iframe && iframe.contentWindow) {
      iframe.contentWindow.postMessage(
        {
          // Modify the line below to grab dark mode setting, depending on how you store it
          theme: theme
        },
        discourse_url
      );
    }
  };

  // Call setFrameStyle when we receive the "iframe loaded" message
  const handleMessageListener = (event) => {
    var origin = event.origin;
    if ((origin === discourse_url) && (event.data == "iframe loaded")) {
      notifyIFrameOfTheme();
    }
  };

  DiscourseEmbed = {
    discourseUrl: 'https://forum.skewed.de/',
    discourseEmbedUrl: 'https://skewed.de/lab/posts/hidden-models/',
    //className: 'discourse-excerpt',
  };
  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();

  window.addEventListener("message", handleMessageListener);
</script>
</section>
<section id="webmentionswebmentions" class="level4">
<h4 class="anchored" data-anchor-id="webmentionswebmentions">Webmentions<sup>7</sup></h4>
<div id="nomention">
<p>(Nothing yet)</p>
</div>
<div class="mentionsio">
<ul id="facepile">
</ul>
<ul id="reposts">
</ul>
<ul id="mentions">
</ul>
</div>


</section>
<div class="no-row-height column-margin column-container"><div id="fn7"><p><sup>7</sup>&nbsp;<a href="https://indieweb.org/Webmention">Webmention</a> is a standardized decentralized mechanism for conversations and interactions across the web.</p></div></div></section>


</div> ]]></description>
  <category>community detection</category>
  <category>Bayes</category>
  <category>compression</category>
  <category>MDL</category>
  <category>overfitting</category>
  <category>free lunch</category>
  <guid>https://skewed.de/lab/posts/hidden-models/</guid>
  <pubDate>Sun, 31 Mar 2024 22:00:00 GMT</pubDate>
  <media:content url="https://skewed.de/lab/posts/hidden-models/diagram.png" medium="image" type="image/png" height="88" width="144"/>
</item>
<item>
  <title>Is Bayesian inference subjective?</title>
  <dc:creator>Tiago P. Peixoto</dc:creator>
  <link>https://skewed.de/lab/posts/objective-inference/</link>
  <description><![CDATA[ 

<div class="h-entry e-content entry-content page-columns page-full">




<p>In a <a href="../inference-compression">previous blog post</a> (covering<span class="citation" data-cites="peixoto_descriptive_2023">&nbsp;[1]</span>) I discussed how inferential approaches to community detection are based on the formulation of generative models, via the definition of a likelihood <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20b%7D)"> for the network <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20A%7D"> conditioned on a partition <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20b%7D."> With this at hand, we find the best partition of the network according to the posterior distribution, using Bayes' rule, i.e.</p>
<p><span id="eq-bayes"><img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20b%7D%7C%7B%5Cboldsymbol%20A%7D)%20=%0A%5Cfrac%7BP(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20b%7D)P(%7B%5Cboldsymbol%20b%7D)%7D%7BP(%7B%5Cboldsymbol%20A%7D)%7D,%20%5Ctag%7B1%7D"></span></p>
<p>where <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20b%7D)"> is the prior probability for a partition <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20b%7D">.</p>
<p>In <a href="https://en.wikipedia.org/wiki/Bayesian_statistics">Bayesian statistics</a>, probabilities are often described as representing a state of knowledge or even as quantification of a “personal belief”<span class="citation" data-cites="de_finetti_theory_2017">&nbsp;[2]</span>. Does that mean that the results that we obtain using this method are “subjective,” and depend arbitrarily on how we choose our models and priors over parameters?</p>
<p>There’s an old debate in the statistics and philosophy literatures between “subjective” and “objective” Bayesianism, concerning primarily whether universal “non-informative” priors exist that perfectly represent the notion of maximum ignorance before any data is seen.<sup>1</sup></p>
<div class="no-row-height column-margin column-container"><div id="fn1"><p><sup>1</sup>&nbsp;The “subjective” position, as defended e.g.&nbsp;by <a href="https://en.wikipedia.org/wiki/Bruno_de_Finetti">de Finetti</a> and <a href="https://en.wikipedia.org/wiki/Leonard_Jimmie_Savage">Savage</a>, argues simply that the postulates of inductive logic make no requirement on the prior distribution, which therefore needs to be chosen according to other criteria. The “objective” camp, represented most famously by <a href="https://en.wikipedia.org/wiki/Harold_Jeffreys">Jeffreys</a> and <a href="https://en.wikipedia.org/wiki/Edwin_Thompson_Jaynes">Janyes</a>, argues in favor of additional postulates that enable the choice of universal “non-informative” priors. In the case of Jeffreys these are distributions <a href="https://en.wikipedia.org/wiki/Jeffreys_prior">invariant to reparametrization</a>, and in Jaynes’ those derived according to the <a href="https://en.wikipedia.org/wiki/Principle_of_maximum_entropy">maximum entropy principle</a>. Whether truly “non-informative” priors are indeed possible (they are not: the concept of “ignorance” does not exist in a vacuum and always requires initial choices on parametrization and constraints<span class="citation" data-cites="seidenfeld_why_1979">&nbsp;[3]</span>) is not the main issue addressed in this post. See also footnote 3.</p></div></div><p>Regardless of the outcome of this debate, I think it is not very difficult to argue that the answer to the above question is “no” — at least when operating with the colloquial meaning of “subjective” as something that is based on or influenced by personal feelings, tastes, or opinions.</p>
<p>First, it is important to distinguish between the colloquial and a more technical definition of what constitutes a “subjective” statement. According to the more technical definition, we say that a statement is subjective when its veracity is conditioned on the subject that makes the statement, without necessarily meaning that the subject is free to decide on its veracity. A good example of this type of subjectivity is time in Einstein's theory of relativity: it has a subjective nature since it will be experienced differently depending on the frame of reference of the observer. Nevertheless, this does not mean that time can be freely determined by any observer, nor that it will be influenced by her personal feelings, tastes, or opinions. In other words, a subjective statement is not the same as an <em>arbitrary</em> statement. In this sense (and only in this sense), Bayesian statistics is indeed subjective, since an inferential conclusion will depend on the data observed and set of hypotheses considered by an individual. However, given the same data and set of hypotheses, two subjects must agree on the conclusion — it is not quite an arbitrary decision. In the colloquial sense of the term, Bayesian inference is not subjective.</p>
<p>There are different ways to demonstrate this more concretely. For example, we can argue “a la Jaynes” that a “state of knowledge” is not something arbitrary, since it can be quantified and always needs to be substantiated<span class="citation" data-cites="jaynes_probability_2003">&nbsp;[4]</span>. An alternative way of showing this, and which I find the most compelling, is via the equivalence between inference and <em>compression</em>. Namely, we can write the numerator of the posterior distribution of Equation&nbsp;1 as</p>
<p><img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20b%7D)P(%7B%5Cboldsymbol%20b%7D)%20=%202%5E%7B-%5CSigma(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)%7D,"></p>
<p>where the quantity <img src="https://latex.codecogs.com/png.latex?%5CSigma(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)"> is known as the <strong>description length</strong><span class="citation" data-cites="grunwald_minimum_2007">&nbsp;[5]</span> of the network. It is computed as:</p>
<p><span id="eq-dl"><img src="https://latex.codecogs.com/png.latex?%5CSigma(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)%20=%20%5Cunderset%7B%5Cmathcal%7BD%7D(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20b%7D)%7D%7B%5Cunderbrace%7B-%5Clog_2P(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20b%7D)%7D%7D%5C,%0A%5Cunderset%7B%5Cmathcal%7BM%7D(%7B%5Cboldsymbol%20b%7D)%7D%7B%5Cunderbrace%7B-%20%5Clog_2P(%7B%5Cboldsymbol%20b%7D)%7D%7D.%20%5Ctag%7B2%7D"></span></p>
<p>The second term <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BM%7D(%7B%5Cboldsymbol%20b%7D)"> in the above equation quantifies the amount of information in bits necessary to encode the parameters of the model, while the first term <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BD%7D(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20b%7D)"> determines how many bits are necessary to encode the data (the observed network itself), once the model parameters are known. Therefore, finding the most likely network partition is equivalent to finding the one that most compresses it — giving us a compelling implementation of <a href="https://en.wikipedia.org/wiki/Occam%27s_razor">Occam's razor</a>.<sup>2</sup></p>
<div class="no-row-height column-margin column-container"><div id="fn2"><p><sup>2</sup>&nbsp;An important technical remark is that Equation&nbsp;2 only corresponds to an actual description length if the quantities involved are <a href="https://en.wikipedia.org/wiki/Probability_mass_function"><em>probability mass functions</em></a>, i.e.&nbsp;the set of possible data and parameters are discrete. This is not a limitation of the framework, it only embodies the unavoidable fact that we can only extract <em>finite</em> information from data. Hypotheses defined over continuous parameters need either to be marginalized or discretized within a finite precision in order to be converted into specific inferential statements.</p></div></div><p>The description length is not arbitrary in any way; in fact it is says something almost physical about the data. It means that if we infer the most likely model, it gives us a way of storing the data in a hard drive using <img src="https://latex.codecogs.com/png.latex?%5CSigma(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)"> bits! As we know from our daily computer usage, compression is not an arbitrary decision, nor is it influenced by our personal feelings, tastes, or opinions — otherwise we would never run out of disk space, we would be able to download files instantly, etc. <strong>In other words, we cannot arbitrarily choose which model best fits the data in the same manner we cannot choose to make our computer files arbitrarily small.</strong> If we would accept that Bayesian statistics is arbitrary, then we would need also to accept that these physical obstacles we face are also arbitrary in nature, which is a rather absurd proposition, and demonstrably incorrect.</p>
<p>As I discussed <a href="../inference-compression">previously</a>, seeking compression avoids overfitting the data since it’s not possible (asymptotically) to compress statistical noise.</p>
<p>However, the concept of compression is more generally useful than just avoiding overfitting within a class of models. In fact, the description length gives us a model-agnostic objective criterion to compare different hypotheses for the data generating process according to their plausibility — in a manner that is not only not arbitrary but also not subjective. Namely, since <a href="https://en.wikipedia.org/wiki/Shannon%27s_source_coding_theorem">Shannon's theorem</a> tells us that the best compression can be achieved asymptotically only with the true data generating model, then if we are able to find a description length for a network using a particular model, regardless of how it is parametrized, this also means that we have automatically found an <em>upper bound</em> on the optimal compression achievable. By formulating different generative models and computing their description length, we have not only an objective criterion to compare them against each other, but we also have a way to limit further what can be obtained with any other model. The result is an universal scale on which different models can be compared, as we move closer to the limit of what can be uncovered for a particular data at hand.<sup>3</sup></p>
<div class="no-row-height column-margin column-container"><div id="fn3"><p><sup>3</sup>&nbsp;Note that the existence of this universal scale is othogonal to the debate on whether it is possible to define universal “non-informative” priors. Even if the choice of model and prior is arbitrary, its resulting compression of the data will not be.</p></div></div><p>In the figure below we show the description length values with some models obtained for a protein-protein interaction network for the organism <em>Meleagris gallopavo</em> <a href="https://en.wikipedia.org/wiki/Wild_turkey">(wild turkey)</a>.</p>
<div id="fig-compressed" class="quarto-float quarto-figure quarto-figure-center anchored page-columns page-full">
<figure class="quarto-float quarto-float-fig figure page-columns page-full">
<div aria-describedby="fig-compressed-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://skewed.de/lab/posts/objective-inference/compressed.png" class="img-fluid figure-img" style="width:60.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-compressed-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Compression points towards the true model. <strong>Top:</strong> Protein-protein interaction network for the organism <em>Meleagris gallopavo</em>. The node colors indicate the best partition found with the DC-SBM/TC (there are more groups than colors, so some colors are repeated), and the edge colors indicate if they are attributed to triadic closure (red) or the DC-SBM (black). <strong>Bottom:</strong> Description length values according to different models. The unknown<sup>4</sup> true model must yield a description length value smaller than the DC-SBM/TC, and no other model should be able to provide a superior compression that is statistically significant.
</figcaption>
<div class="no-row-height column-margin column-container"><div id="fn4"><p><sup>4</sup>&nbsp;In an absolute sense, the true model is not only unkonwn, but also unknownable. What Figure&nbsp;1 shows is that our task to appoximate it asymptotically.</p></div></div></figure>
</div>
<p>In particular, we can see that with the degree-corrected stochastic block model with triadic closure (DC-SBM/TC)<span class="citation" data-cites="peixoto_disentangling_2022">&nbsp;[6]</span> we can achieve a description length that is far smaller than what would be possible with networks sampled from either the Erdős–Rényi, configuration, or planted partition (a SBM with strictly assortative communities<span class="citation" data-cites="zhang_statistical_2020">&nbsp;[7]</span> models, meaning that the inferred model is much closer to the true process that actually generated this network than the alternatives. Naturally, the actual process that generated this network is different from the DC-SBM/TC, and it likely involves, for example, mechanisms of node duplication which are not incorporated into this rather simple model. However, to the extent that the true process leaves statistically significant traces in the network structure,<sup>5</sup> computing the description length according to it should provide further compression when compared to the alternatives. Therefore, we can try to extend or reformulate our models to incorporate features that we hypothesize to be more realistic, and then verify if this in fact the case, knowing that whenever we find a more compressive model, it is moving closer to the true one — or at least to what remains detectable from it for the finite data.</p>
<div class="no-row-height column-margin column-container"><div id="fn5"><p><sup>5</sup>&nbsp;Visually inspecting Figure&nbsp;1 reveals what seems to be local symmetries in the network structure, presumably due to gene duplication. These patterns are not exploited by the SBM description, and points indeed to a possible path for further compression.</p></div></div><p>The discussion above glosses over some important technical aspects. For example, it is possible for two (or, in fact, many) models to have the same or very similar description length values. In this case, Occam's razor fails as a criterion to select between them, and we need to consider them collectively as equally valid hypotheses. This means, for example, that we would need to average over them when making specific inferential statements<span class="citation" data-cites="peixoto_revealing_2021">&nbsp;[8]</span> — selecting between them arbitrarily can be interpreted as a form of overfitting. Furthermore, there is obviously no guarantee that the true model can actually be found for any particular data. This is only possible in the asymptotic limit of “sufficient data”, which will vary depending on the actual model. Outside of this limit (which is the typical case in empirical settings, in particular when dealing with <em>sparse</em> networks), fundamental limits to inference are unavoidable, which means in practice that we will always have limited accuracy and some amount of error in our conclusions. However, when employing compression, these potential errors tend towards overly simple explanations, rather than overly complex ones. Whenever perfect accuracy is not possible, it is difficult to argue in favor of a bias in the opposite direction.</p>
<p>I emphasize that it is not possible to “cheat” when doing compression. For any particular model, the description length will have the same form</p>
<p><img src="https://latex.codecogs.com/png.latex?%5CSigma(%5Cboldsymbol%20A,%5Cboldsymbol%20%5Ctheta)%20=%0A%5Cmathcal%7BD%7D(%5Cboldsymbol%20A%7C%5Cboldsymbol%5Ctheta)%20+%20%5Cmathcal%7BM%7D(%5Cboldsymbol%20%5Ctheta),"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20%5Ctheta"> is some arbitrary set of parameters. If we constrain the model such that it becomes possible to describe the data with a number of bits <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BD%7D(%5Cboldsymbol%20A%7C%5Cboldsymbol%0A%5Ctheta)"> that is very small, this can only be achieved, in general, by increasing the number of parameters <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%5Ctheta">, such that the number of bits <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BM%7D(%5Cboldsymbol%5Ctheta)"> required to describe them will also increase. Therefore, there is no generic way to achieve compression that bypasses actually formulating a meaningful hypothesis that matches statistically significant patterns seen in the data.</p>
<p>One may wonder, therefore, if there is an automatized way of searching for hypotheses in a manner that guarantees optimal compression. The most fundamental way to formulate this question is to generalize the concept of minimum description length as follows: for any binary string <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20x"> (representing any measurable data), we define <img src="https://latex.codecogs.com/png.latex?L(%5Cboldsymbol%20x)"> as the length in bits of the shortest computer program that yields <img src="https://latex.codecogs.com/png.latex?L(%5Cboldsymbol%20x)"> as an output. The quantity <img src="https://latex.codecogs.com/png.latex?L(%5Cboldsymbol%20x)"> is know as <a href="https://en.wikipedia.org/wiki/Kolmogorov_complexity">Kolmogorov complexity</a>, and if we would be able to compute it for a binary string representing an observed network, we would be able to determine the “true model” value in Figure&nbsp;1, and hence know how far we are from the optimum.<sup>6</sup></p>
<div class="no-row-height column-margin column-container"><div id="fn6"><p><sup>6</sup>&nbsp;As mentioned before, this would not necessarily mean that we would be able to find the actual true model in a practical setting with perfect accuracy, since for a finite <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20x"> there could be many programs of the same minimal length (or close) that generate it.</p></div><div id="fn7"><p><sup>7</sup>&nbsp;There are two famous ways to prove this. One is by contradiction: if we assume that we have a program that computes <img src="https://latex.codecogs.com/png.latex?L(%5Cboldsymbol%20x)">, then we could use it as subroutine to write another program that outputs <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20x"> with a length smaller than <img src="https://latex.codecogs.com/png.latex?L(%5Cboldsymbol%20x)">. The other involves undecidabilty: if we enumerate all possible computer programs in order of increasing length and check if their outputs match <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20x">, we will eventually find programs that loop indefinitely. Deciding whether a program finishes in finite time is known as the “<a href="https://en.wikipedia.org/wiki/Halting_problem">halting problem</a>”, which has been proved to be impossible to solve. In general, it cannot be determined if a program reaches an infinite loop in a manner that avoids actually running the program and waiting for it to finish. Therefore, this rather intuitive algorithm to determine <img src="https://latex.codecogs.com/png.latex?L(%5Cboldsymbol%20x)"> will not necessarily finish for any given string <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20x">. For more details the <a href="https://en.wikipedia.org/wiki/Kolmogorov_complexity">wikipedia page</a> has a good overview.</p></div></div><p>Unfortunately, an important result in information theory is that <img src="https://latex.codecogs.com/png.latex?L(%5Cboldsymbol%0Ax)"> is not computable. This means that it is strictly impossible to write a computer program that computes <img src="https://latex.codecogs.com/png.latex?L(%5Cboldsymbol%20x)"> for any string <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%0Ax">.<sup>7</sup> This is a rather counterintuitive and frustrating fact that means that while we can keep trying, and maybe eventually even succeeding in compressing some data better than our last attempt, whether we have at any point achieved the optimal compression will remain forever <em>unknowable</em>.</p>
<p>Some interpret the uncomputability of Kolmogorov complexity as an invalidation of the overall compression approach to model selection, but I think this is fundamentally mistaken. This fact simply means that we cannot automate the discovery of optimal hypotheses, or know where the “finish line” is. However, compression is still a perfectly valid and objective criterion to judge the <em>relative</em> plausibility of competing hypotheses. This is really the best we can hope for, and there’s an upside: It means that scientists will never run out of things to do, and their capacity for creativity in formulating new hypotheses will never become obsolete!</p>
<section id="references" class="level4">
<h4 class="anchored" data-anchor-id="references">References</h4>
<div id="refs" class="references csl-bib-body" data-entry-spacing="0">
<div id="ref-peixoto_descriptive_2023" class="csl-entry">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1017/9781009118897">Descriptive Vs. <span>Inferential Community Detection</span> in <span>Networks</span>: <span>Pitfalls</span>, <span>Myths</span> and <span>Half-Truths</span></a></em>, Elements in the Structure and Dynamics of Complex Networks (2023).</div>
</div>
<div id="ref-de_finetti_theory_2017" class="csl-entry">
<div class="csl-left-margin">[2] </div><div class="csl-right-inline">B. De Finetti, <em>Theory of Probability: <span>A</span> Critical Introductory Treatment</em>, Vol. 6 (John Wiley &amp; Sons, 2017).</div>
</div>
<div id="ref-seidenfeld_why_1979" class="csl-entry">
<div class="csl-left-margin">[3] </div><div class="csl-right-inline">T. Seidenfeld, <em><a href="https://doi.org/10.1007/BF00139451">Why <span>I</span> Am Not an Objective <span>Bayesian</span>; Some Reflections Prompted by <span>Rosenkrantz</span></a></em>, Theory and Decision <strong>11</strong>, 413 (1979).</div>
</div>
<div id="ref-jaynes_probability_2003" class="csl-entry">
<div class="csl-left-margin">[4] </div><div class="csl-right-inline">E. T. Jaynes, <em>Probability <span>Theory</span>: <span>The Logic</span> of <span>Science</span></em> (Cambridge University Press, Cambridge, UK ; New York, NY, 2003).</div>
</div>
<div id="ref-grunwald_minimum_2007" class="csl-entry">
<div class="csl-left-margin">[5] </div><div class="csl-right-inline">P. D. Grünwald, <em>The <span>Minimum Description Length Principle</span></em> (The MIT Press, 2007).</div>
</div>
<div id="ref-peixoto_disentangling_2022" class="csl-entry">
<div class="csl-left-margin">[6] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevX.12.011004">Disentangling <span>Homophily</span>, <span>Community Structure</span>, and <span>Triadic Closure</span> in <span>Networks</span></a></em>, Physical Review X <strong>12</strong>, 011004 (2022).</div>
</div>
<div id="ref-zhang_statistical_2020" class="csl-entry">
<div class="csl-left-margin">[7] </div><div class="csl-right-inline">L. Zhang and T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevResearch.2.043271">Statistical Inference of Assortative Community Structures</a></em>, Physical Review Research <strong>2</strong>, 043271 (2020).</div>
</div>
<div id="ref-peixoto_revealing_2021" class="csl-entry">
<div class="csl-left-margin">[8] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevX.11.021003">Revealing <span>Consensus</span> and <span>Dissensus</span> Between <span>Network Partitions</span></a></em>, Physical Review X <strong>11</strong>, 021003 (2021).</div>
</div>
</div>
<hr>
</section>
<section id="comments" class="level4">
<h4 class="anchored" data-anchor-id="comments">Comments</h4>
<p>(Comments may be moderated.)</p>
<div class="discourse-excerpt" style="display: none">
<p>If you reply to this post, it will show as a comment below the original article.</p>
</div>
<div id="discourse-comments"></div>
<meta name="discourse-username" content="tiago">

<script type="text/javascript">

  const discourse_url = "https://forum.skewed.de";

  // Here, we determine the theme, and send a message to the iframe to let it know what the theme is
  // See below for how we hook up notifyFrameStyle 
  const notifyIFrameOfTheme = () => {
    const iframe = document.getElementById("discourse-embed-frame");
    if (document.body.classList.contains("quarto-dark")) {
      theme = "dark";
    } else {
      theme = "light";
    }

    if (iframe && iframe.contentWindow) {
      iframe.contentWindow.postMessage(
        {
          // Modify the line below to grab dark mode setting, depending on how you store it
          theme: theme
        },
        discourse_url
      );
    }
  };

  // Call setFrameStyle when we receive the "iframe loaded" message
  const handleMessageListener = (event) => {
    var origin = event.origin;
    if ((origin === discourse_url) && (event.data == "iframe loaded")) {
      notifyIFrameOfTheme();
    }
  };

  DiscourseEmbed = {
    discourseUrl: 'https://forum.skewed.de/',
    discourseEmbedUrl: 'https://skewed.de/lab/posts/objective-inference/',
    //className: 'discourse-excerpt',
  };
  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();

  window.addEventListener("message", handleMessageListener);
</script>
</section>
<section id="webmentionswebmentions" class="level4">
<h4 class="anchored" data-anchor-id="webmentionswebmentions">Webmentions<sup>8</sup></h4>
<div id="nomention">
<p>(Nothing yet)</p>
</div>
<div class="mentionsio">
<ul id="facepile">
</ul>
<ul id="reposts">
</ul>
<ul id="mentions">
</ul>
</div>


</section>
<div class="no-row-height column-margin column-container"><div id="fn8"><p><sup>8</sup>&nbsp;<a href="https://indieweb.org/Webmention">Webmention</a> is a standardized decentralized mechanism for conversations and interactions across the web.</p></div></div>

</div> ]]></description>
  <category>community detection</category>
  <category>Bayes</category>
  <category>compression</category>
  <category>MDL</category>
  <category>subjectivity</category>
  <guid>https://skewed.de/lab/posts/objective-inference/</guid>
  <pubDate>Mon, 03 Jan 2022 23:00:00 GMT</pubDate>
  <media:content url="https://skewed.de/lab/posts/objective-inference/compressed.png" medium="image" type="image/png" height="156" width="144"/>
</item>
<item>
  <title>Significant community structure via statistical tests?</title>
  <dc:creator>Tiago P. Peixoto</dc:creator>
  <link>https://skewed.de/lab/posts/significant-modularity/</link>
  <description><![CDATA[ 

<div class="h-entry e-content entry-content page-columns page-full">




<div class="page-columns page-full"><p></p><div class="no-row-height column-margin column-container"><span class="margin-aside">This post is a slightly modified version of Sec. IVC in <span class="citation" data-cites="peixoto_descriptive_2023">&nbsp;[1]</span>.</span></div></div>
<p>In a <a href="../modularity-harmful">previous blog post</a> I explained how <a href="https://en.wikipedia.org/wiki/Modularity_(networks)">modularity maximization</a> tends to overfit and find spurious community structure even in random graphs.</p>
<p>Sometimes practitioners are indeed aware that such non-inferential methods can find communities that are not supported by statistical evidence. In an attempt to extract an inferential conclusion from their results in spite of this, they compare the value of the quality function with a randomized version of the network — and if a significant discrepancy is found, they conclude that the community structure is statistically meaningful. Unfortunately, this approach is as fundamentally flawed as it is straightforward to implement.</p>
<p>The reason why the test fails is because in reality it answers a question that is different from the one intended. When we compare the value of the quality function (or any other test statistic) obtained from a network and its randomized counterpart, we can use this information to answer <em>only</em> the following question:</p>
<blockquote class="blockquote">
<p>“Can we reject the hypothesis that the observed network was sampled from a random null model?”</p>
</blockquote>
<p>No other information can be obtained from this test, including whether the <em>network partition</em> we obtained is significant. All we can determine is if the optimized value of the quality function is significant or not. The distinction between the significance of the quality function value and the network partition itself is subtle but crucial.</p>
<p>We illustrate the above difference with an example in Figure&nbsp;1 (b). This network is created by starting with a fully random Erdős-Rényi (ER) network, and adding to it a few more edges so that it has an embedded clique of six nodes. The occurrence of such a clique from an ER model is very unlikely, so if we perform a statistical test on this network that is powerful enough, we should be able to rule out that it came from the ER model with good confidence. Indeed, if we use the value of maximum modularity for this test, and compare with the values obtained for the ER model with the name number of nodes and edges (see Figure&nbsp;1 (a)), we are able to reach the correct conclusion that the null model should be rejected, since the optimized value of modularity is significantly higher for the observed network.</p>
<div id="fig-modularity-null" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-modularity-null-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://skewed.de/lab/posts/significant-modularity/modularity-test.png" class="img-fluid figure-img" style="width:90.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-modularity-null-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: The statistical significance of the maximum modularity value is not informative of the significance of the community structure. In (a) we show the distribution of optimized values of modularity for networks sampled from the Erdős-Rényi (ER) model with the same number of nodes and edges as the network shown in (b) and (c). The vertical line shows the value obtained for the partition shown in (b), indicating that the network is very unlikely to have been sampled from the ER model (<img src="https://latex.codecogs.com/png.latex?P%20=%200.002">). However, what sets this network apart from typical samples is the existence of a small clique of six nodes that would not occur in the ER model. The remaining communities found in (b) are entirely meaningless. In (c) we show the result of inferring the stochastic block model on this network, which perfectly identifies the planted clique without overfitting the rest of the network.
</figcaption>
</figure>
</div>
<p>Should we conclude therefore that the communities found in the network are significant? If we inspect Figure&nbsp;1 (b), we see that the maximum value of modularity indeed corresponds to a more-or-less decent detection of the planted clique. However, it also finds another seven completely spurious communities in the random part of the network. What is happening is clear — the planted clique is enough to increase the value of <img src="https://latex.codecogs.com/png.latex?Q"> such that it becomes a suitable test to reject the null model<sup>1</sup>, but the test is not powerful enough to verify that the communities themselves are statistically meaningful. In short, the following two statements are not synonymous:</p>
<div class="no-row-height column-margin column-container"><div id="fn1"><p><sup>1</sup>&nbsp;Note that it is possible to construct alternative examples, where instead of planting a clique, we introduce the placement of triangles, or other features that are known to increase the value of modularity, but that do not correspond to an actual community structure.</p></div></div><ol type="1">
<li>The maximum value of <img src="https://latex.codecogs.com/png.latex?Q"> is significant.</li>
<li>The corresponding network partition is significant.</li>
</ol>
<p>Conflating the two will lead to the wrong conclusion about the significance of the communities uncovered.</p>
<p>In Figure&nbsp;1 (c) we show the result of a more appropriate inferential approach, based on Bayesian inference as described in <a href="../../tiago/blog/inference-compression">a previous blog post</a>, that attempts to answer a much more relevant question: “which partition of the network into groups is more likely?” The result is able to cleanly separate the planted clique from the rest of the network, which is grouped into a single community.</p>
<p>This example also shows how the task of rejecting a null model is very oblique to Bayesian inference of generative models. The former attempts to determine what the network <em>is not</em>, while the latter what <em>it is</em>. The first task tends to be easy — we usually do not need very sophisticated approaches to determine that our data did not come from a null model, specially if our data is complex. On the other hand, even if <a href="../hypothesis-is-not-belief">approximative</a>, the second task is far more revealing, constructive, and arguably more useful in general.</p>
<section id="references" class="level4">
<h4 class="anchored" data-anchor-id="references">References</h4>
<div id="refs" class="references csl-bib-body" data-entry-spacing="0">
<div id="ref-peixoto_descriptive_2023" class="csl-entry">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1017/9781009118897">Descriptive Vs. <span>Inferential Community Detection</span> in <span>Networks</span>: <span>Pitfalls</span>, <span>Myths</span> and <span>Half-Truths</span></a></em>, Elements in the Structure and Dynamics of Complex Networks (2023).</div>
</div>
</div>
<hr>
</section>
<section id="comments" class="level4">
<h4 class="anchored" data-anchor-id="comments">Comments</h4>
<p>(Comments may be moderated.)</p>
<div class="discourse-excerpt" style="display: none">
<p>If you reply to this post, it will show as a comment below the original article.</p>
</div>
<div id="discourse-comments"></div>
<meta name="discourse-username" content="tiago">

<script type="text/javascript">

  const discourse_url = "https://forum.skewed.de";

  // Here, we determine the theme, and send a message to the iframe to let it know what the theme is
  // See below for how we hook up notifyFrameStyle 
  const notifyIFrameOfTheme = () => {
    const iframe = document.getElementById("discourse-embed-frame");
    if (document.body.classList.contains("quarto-dark")) {
      theme = "dark";
    } else {
      theme = "light";
    }

    if (iframe && iframe.contentWindow) {
      iframe.contentWindow.postMessage(
        {
          // Modify the line below to grab dark mode setting, depending on how you store it
          theme: theme
        },
        discourse_url
      );
    }
  };

  // Call setFrameStyle when we receive the "iframe loaded" message
  const handleMessageListener = (event) => {
    var origin = event.origin;
    if ((origin === discourse_url) && (event.data == "iframe loaded")) {
      notifyIFrameOfTheme();
    }
  };

  DiscourseEmbed = {
    discourseUrl: 'https://forum.skewed.de/',
    discourseEmbedUrl: 'https://skewed.de/lab/posts/significant-modularity/',
    //className: 'discourse-excerpt',
  };
  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();

  window.addEventListener("message", handleMessageListener);
</script>
</section>
<section id="webmentionswebmentions" class="level4">
<h4 class="anchored" data-anchor-id="webmentionswebmentions">Webmentions<sup>2</sup></h4>
<div id="nomention">
<p>(Nothing yet)</p>
</div>
<div class="mentionsio">
<ul id="facepile">
</ul>
<ul id="reposts">
</ul>
<ul id="mentions">
</ul>
</div>


</section>
<div class="no-row-height column-margin column-container"><div id="fn2"><p><sup>2</sup>&nbsp;<a href="https://indieweb.org/Webmention">Webmention</a> is a standardized decentralized mechanism for conversations and interactions across the web.</p></div></div>

</div> ]]></description>
  <category>community detection</category>
  <category>modularity</category>
  <category>overfitting</category>
  <category>statistical significance</category>
  <guid>https://skewed.de/lab/posts/significant-modularity/</guid>
  <pubDate>Sun, 12 Dec 2021 23:00:00 GMT</pubDate>
  <media:content url="https://skewed.de/lab/posts/significant-modularity/modularity-test.png" medium="image" type="image/png" height="54" width="144"/>
</item>
<item>
  <title>Do we need to believe in generative models?</title>
  <dc:creator>Tiago P. Peixoto</dc:creator>
  <link>https://skewed.de/lab/posts/hypothesis-is-not-belief/</link>
  <description><![CDATA[ 

<div class="h-entry e-content entry-content page-columns page-full">




<div class="page-columns page-full"><p></p><div class="no-row-height column-margin column-container"><span class="margin-aside">This post is a slightly modified version of Sec. IVH in <span class="citation" data-cites="peixoto_descriptive_2023">&nbsp;[1]</span>.</span></div></div>
<p>In two previous blog posts (<a href="../descriptive-inferential">first</a> and <a href="../inference-compression">second</a>) I advocated for the use of statistical inference for <a href="https://en.wikipedia.org/wiki/Community_structure">community detection</a> in networks, whenever our objective is of an inferential nature.</p>
<p>One possible objection to the use of statistical inference is when the generative models on which they are based are considered unrealistic for a particular kind of network. Although this type of consideration is ultimately important, it is not necessarily an obstacle. First we need to remember that realism is a matter of degree, not kind, since no model can be fully realistic, and therefore we should never be fully committed to “believe” any particular model. Because of this, an inferential approach can be used to target a particular kind of structure, and the corresponding model is formulated with this in mind, but without the need to describe other properties of the data. The <a href="https://en.wikipedia.org/wiki/Stochastic_block_model">stochastic block model</a> (SBM) is a good example of this, since it is often used with the objective of finding communities, rather than any kind of network structure. A model like the SBM is a good way to offset the regularities that relate to the community structure with the irregularities present in real networks, without requiring us to believe that in fact it generated the network.</p>
<p>Furthermore, certain kinds of models are flexible enough so that they can approximate other models. For example, a good analogy with fitting the SBM to network data is to fit a <a href="https://en.wikipedia.org/wiki/Histogram">histogram</a> to numerical data, with the node partitioning being analogous to the data binning. Although a piecewise constant model is almost never the true underlying distribution, it provides a reasonable approximation in a tractable, nonparametric manner. Because of its capacity to approximate a wide class of distributions, we certainly do not need to believe that a histogram is the true data generating process to extract meaningful inferences from it. In fact, the same can be said of the SBM in its capacity to approximate a wide class of network models <span class="citation" data-cites="olhede_network_2014">&nbsp;[2]</span>.</p>
<p>This means that we can extract useful, statistically meaningful information from data even if the models we use are <a href="https://en.wikipedia.org/wiki/Statistical_model_specification">misspecified</a>. For example, if a network is generated by a latent space model <span class="citation" data-cites="hoff_latent_2002">&nbsp;[3]</span>, and we fit a SBM to it, the communities that are obtained in this manner are not quite meaningless: they will correspond to discrete spatial regions. Hence, the inference would yield a caricature of the underlying latent space, amounting to a discretization of the true model — indeed, much like a histogram. This is very different, say, from finding communities in an Erdős–Rényi graph, which bear no relation to the true underlying model, and would be just overfitting the data. In contrast, the SBM fit to a spatial network would be approximately capturing the true model structure, in a manner that could be used to compress the data and make predictions (although not optimally).</p>
<p>Furthermore, the associated <a href="https://en.wikipedia.org/wiki/Minimum_description_length">description length</a> of a network model is a good criterion to tell whether the patterns we have found are actually simplifying our network description, without requiring the underlying model to be perfect. This happens in the same way as using a software like <a href="https://en.wikipedia.org/wiki/Gzip">gzip</a> makes our files smaller, without requiring us to believe that they are in fact generated by the Markov chain used by the underlying <a href="https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch">Lempel-Ziv</a> algorithm.</p>
<p>Of course, realism is important as soon as we demand more from the point of view of interpretation and prediction. Are the observed community structures due to homophily or triadic clusure <span class="citation" data-cites="peixoto_disentangling_2022">&nbsp;[4]</span>? Or are they due to spatial embedding <span class="citation" data-cites="hoff_latent_2002">&nbsp;[3]</span>? What models are capable of reproducing other network descriptors, together with the community structure? Which models can better reconstruct incomplete networks <span class="citation" data-cites="guimera_missing_2009 peixoto_reconstructing_2018">&nbsp;[5,6]</span>?</p>
<p>When answering these questions, we are forced to consider more detailed generative processes, and compare them. However, we are never required to <em>believe</em> them — models are always tentative, approximative, and should always be replaced by superior alternatives when these are found. Indeed, criteria such as <a href="https://en.wikipedia.org/wiki/Minimum_description_length">minimum description length</a> serve precisely to implement such a comparison between models, following the principle of <a href="https://en.wikipedia.org/wiki/Occam%27s_razor">Occam's razor</a>. Therefore, the lack of realism of any particular model cannot be used to dismiss statistical inference as an underlying methodology.</p>
<p>It should be emphasized that, fundamentally, there is no alternative. Rejecting an inferential approach based on the SBM on the grounds that it is an unrealistic model (e.g.&nbsp;because of the conditional independence of the edges being placed, or some other unpalatable assumption), but instead preferring some other non-inferential community detection method is incoherent: As we discussed <a href="../inference-compression">previously</a>, every descriptive method can be mapped to an inferential analogue, with implicit assumptions that are hidden from view. Unless one can establish that the implicit assumptions are in fact more realistic, then the comparison cannot be justified. Unrealistic assumptions should be replaced by more realistic ones, not by burying one’s head in the sand.</p>
<section id="references" class="level4">
<h4 class="anchored" data-anchor-id="references">References</h4>
<div id="refs" class="references csl-bib-body" data-entry-spacing="0">
<div id="ref-peixoto_descriptive_2023" class="csl-entry">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1017/9781009118897">Descriptive Vs. <span>Inferential Community Detection</span> in <span>Networks</span>: <span>Pitfalls</span>, <span>Myths</span> and <span>Half-Truths</span></a></em>, Elements in the Structure and Dynamics of Complex Networks (2023).</div>
</div>
<div id="ref-olhede_network_2014" class="csl-entry">
<div class="csl-left-margin">[2] </div><div class="csl-right-inline">S. C. Olhede and P. J. Wolfe, <em><a href="https://doi.org/10.1073/pnas.1400374111">Network Histograms and Universality of Blockmodel Approximation</a></em>, Proceedings of the National Academy of Sciences <strong>111</strong>, 14722 (2014).</div>
</div>
<div id="ref-hoff_latent_2002" class="csl-entry">
<div class="csl-left-margin">[3] </div><div class="csl-right-inline">P. D. Hoff, A. E. Raftery, and M. S. Handcock, <em><a href="https://doi.org/10.1198/016214502388618906">Latent <span>Space Approaches</span> to <span>Social Network Analysis</span></a></em>, Journal of the American Statistical Association <strong>97</strong>, 1090 (2002).</div>
</div>
<div id="ref-peixoto_disentangling_2022" class="csl-entry">
<div class="csl-left-margin">[4] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevX.12.011004">Disentangling <span>Homophily</span>, <span>Community Structure</span>, and <span>Triadic Closure</span> in <span>Networks</span></a></em>, Physical Review X <strong>12</strong>, 011004 (2022).</div>
</div>
<div id="ref-guimera_missing_2009" class="csl-entry">
<div class="csl-left-margin">[5] </div><div class="csl-right-inline">R. Guimerà and M. Sales-Pardo, <em><a href="https://doi.org/10.1073/pnas.0908366106">Missing and Spurious Interactions and the Reconstruction of Complex Networks</a></em>, Proceedings of the National Academy of Sciences <strong>106</strong>, 22073 (2009).</div>
</div>
<div id="ref-peixoto_reconstructing_2018" class="csl-entry">
<div class="csl-left-margin">[6] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevX.8.041011">Reconstructing <span>Networks</span> with <span>Unknown</span> and <span>Heterogeneous Errors</span></a></em>, Physical Review X <strong>8</strong>, 041011 (2018).</div>
</div>
</div>
<hr>
</section>
<section id="comments" class="level4">
<h4 class="anchored" data-anchor-id="comments">Comments</h4>
<p>(Comments may be moderated.)</p>
<div class="discourse-excerpt" style="display: none">
<p>If you reply to this post, it will show as a comment below the original article.</p>
</div>
<div id="discourse-comments"></div>
<meta name="discourse-username" content="tiago">

<script type="text/javascript">

  const discourse_url = "https://forum.skewed.de";

  // Here, we determine the theme, and send a message to the iframe to let it know what the theme is
  // See below for how we hook up notifyFrameStyle 
  const notifyIFrameOfTheme = () => {
    const iframe = document.getElementById("discourse-embed-frame");
    if (document.body.classList.contains("quarto-dark")) {
      theme = "dark";
    } else {
      theme = "light";
    }

    if (iframe && iframe.contentWindow) {
      iframe.contentWindow.postMessage(
        {
          // Modify the line below to grab dark mode setting, depending on how you store it
          theme: theme
        },
        discourse_url
      );
    }
  };

  // Call setFrameStyle when we receive the "iframe loaded" message
  const handleMessageListener = (event) => {
    var origin = event.origin;
    if ((origin === discourse_url) && (event.data == "iframe loaded")) {
      notifyIFrameOfTheme();
    }
  };

  DiscourseEmbed = {
    discourseUrl: 'https://forum.skewed.de/',
    discourseEmbedUrl: 'https://skewed.de/lab/posts/hypothesis-is-not-belief/',
    //className: 'discourse-excerpt',
  };
  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();

  window.addEventListener("message", handleMessageListener);
</script>
</section>
<section id="webmentionswebmentions" class="level4">
<h4 class="anchored" data-anchor-id="webmentionswebmentions">Webmentions<sup>1</sup></h4>
<div id="nomention">
<p>(Nothing yet)</p>
</div>
<div class="mentionsio">
<ul id="facepile">
</ul>
<ul id="reposts">
</ul>
<ul id="mentions">
</ul>
</div>


</section>
<div class="no-row-height column-margin column-container"><div id="fn1"><p><sup>1</sup>&nbsp;<a href="https://indieweb.org/Webmention">Webmention</a> is a standardized decentralized mechanism for conversations and interactions across the web.</p></div></div>

</div> ]]></description>
  <category>community detection</category>
  <category>Bayes</category>
  <category>compression</category>
  <category>MDL</category>
  <guid>https://skewed.de/lab/posts/hypothesis-is-not-belief/</guid>
  <pubDate>Tue, 07 Dec 2021 23:00:00 GMT</pubDate>
  <media:content url="https://skewed.de/lab/static/research/add_health_comm26-marginal-triadic_sbm-modesbm.png" medium="image" type="image/png" height="143" width="144"/>
</item>
<item>
  <title>No free lunch in community detection?</title>
  <dc:creator>Tiago P. Peixoto</dc:creator>
  <link>https://skewed.de/lab/posts/free-lunch/</link>
  <description><![CDATA[ 

<div class="h-entry e-content entry-content page-columns page-full">




<div class="page-columns page-full"><p></p><div class="no-row-height column-margin column-container"><span class="margin-aside">This post is a slightly modified version of Sec. IVG in <span class="citation"><span class="citation" data-cites="peixoto_descriptive_2023">&nbsp;[1]</span></span>.</span></div></div>
<p>For a wide class of optimization and learning problems there exist so-called <a href="https://en.wikipedia.org/wiki/No_free_lunch_theorem">“no-free-lunch”</a> (NFL) theorems, which broadly state that when averaged over all possible problem instances, all algorithms show equivalent performance<span class="citation" data-cites="wolpert_no_1995 wolpert_lack_1996 wolpert_no_1997">&nbsp;[2–4]</span>. Peel <em>et al</em><span class="citation" data-cites="peel_ground_2017">&nbsp;[5]</span> have proved that this is also valid for the problem of community detection, meaning that no single method can perform systematically better than any other, when averaged over “all community detection problems.” This has been occasionally interpreted as a reason to reject the claim that we should prefer certain classes of algorithms over others. This is, however, a misinterpretation of the theorem, as we will now discuss.</p>
<p>The NFL theorem for community detection is easy to state. Let us consider a generic community detection algorithm indexed by <img src="https://latex.codecogs.com/png.latex?f">, defined by the function <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%20b%7D_f(%5Cboldsymbol%20A)">, which ascribes a single partition to a network <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20A">. Peel <em>et al</em><span class="citation" data-cites="peel_ground_2017">&nbsp;[5]</span> consider an instance of the community detection problem to be an arbitrary pair <img src="https://latex.codecogs.com/png.latex?(%5Cboldsymbol%0AA,%5Cboldsymbol%20b)"> composed of a network <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20A"> and the correct partition <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20b"> that one wants to find from <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20A">. We can evaluate the accuracy of the algorithm <img src="https://latex.codecogs.com/png.latex?f"> via an error (or “loss”) function</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cepsilon%20(%5Cboldsymbol%20b,%20%5Chat%7B%5Cboldsymbol%20b%7D_f(%5Cboldsymbol%20A))"></p>
<p>which should take the smallest possible value if <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%0Ab%7D_f(%5Cboldsymbol%20A)%20=%20%5Cboldsymbol%20b">. If the error function does not have an inherent preference for any partition (it's “homogeneous”), then the NFL theorem states<span class="citation" data-cites="wolpert_lack_1996 peel_ground_2017">&nbsp;[3,5]</span>.</p>
<p><span id="eq-nfl"><img src="https://latex.codecogs.com/png.latex?%5Csum_%7B(%5Cboldsymbol%20A,%20%5Cboldsymbol%20b)%7D%5Cepsilon%20(%5Cboldsymbol%20b,%0A%5Chat%7B%5Cboldsymbol%20b%7D_f(%5Cboldsymbol%20A))%20=%20%5CLambda(%5Cepsilon),%20%5Ctag%7B1%7D"></span></p>
<p>where <img src="https://latex.codecogs.com/png.latex?%5CLambda(%5Cepsilon)"> is a value that depends only on the error function chosen, but not on the community detection algorithm <img src="https://latex.codecogs.com/png.latex?f">. In other words, when averaged over all problem instances, all algorithms have the same accuracy. This implies, therefore, that in order for one class of algorithms to perform systematically better than another, we need to restrict the universe of problems to a particular subset. This is a seemingly straightforward result, but which is unfortunately very susceptible to misinterpretation and overstatement.</p>
<p>A common criticism of this kind of NFL theorem is that it is a poor representation of the typical problems we may encounter in real domains of application, which are unlikely to be uniformly distributed across the entire problem space. Therefore, as soon as we constrain ourselves to a subset of problems that are relevant to a particular domain, then this will favor some algorithms over others — but then no algorithm will be superior for all domains. But since we are typically only interested in some domains, the NFL theorem is then arguably “theoretically sound, but practically irrelevant”<span class="citation" data-cites="schaffer_conservation_1994">&nbsp;[6]</span>. Although indeed correct, in the case of community detection this logic is arguably an understatement. This is because as soon as we restrict our domain to community detection problems that reveal something <em>informative</em> about the network structure, then we are out of reach of the NFL theorem, and some algorithms will do better than others, without evoking any particular domain of application. We demonstrate this in the following.</p>
<p>The framework of the NFL theorem operates on a liberal notion of what constitutes a community detection problem and its solution, which means for an arbitrary pair <img src="https://latex.codecogs.com/png.latex?(%5Cboldsymbol%20A,%5Cboldsymbol%20b)"> choosing the right <img src="https://latex.codecogs.com/png.latex?f"> such that <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%20b%7D_f(%5Cboldsymbol%0AA)=%5Cboldsymbol%20b."> Under this framework, algorithms are just arbitrary mappings from network to partition, and there is no necessity to articulate more specifically how they relate to the structure of the network — community detection just becomes an arbitrary game of “guess the hidden node labels.” This contrasts with how actual community detection algorithms are proposed, which attempt to match the node partitions to patterns in the network, e.g.&nbsp;assortativity, general connection preferences between groups, etc. Although the large variety of algorithms proposed for this task already reveal a lack of consensus on how to precisely define it, few would consider it meaningful to leave the class of community detection problems so wide open as to accept any matching between an arbitrary network and an arbitrary partition as a valid instance.</p>
<p>Even though we can accommodate any (deterministic) algorithm deemed valid according to any criterion under the NFL framework, most algorithms in this broader class do something else altogether. In fact, the absolute vast majority of them correspond to a maximally random matching between network and partition, which amounts to little more than just randomly guessing a partition for any given network, i.e.&nbsp;they return widely different partitions for inputs that are very similar, and overall point to no correlation between input and output.<sup>1</sup> It is not difficult to accept that these random algorithms perform equally “well” for any particular problem, or even all problems, but the NFL theorem says that they have equivalent performance even to algorithms that we may deem more meaningful. How do we make a formal distinction between algorithms that are just randomly guessing from those that are doing something coherent, that depends on discovering actual network patterns? As it turns out, there is an answer to this question that does not depend on particular domains of application: we require the solutions found to be <em>structured</em> and <em>compressive of the network</em>.</p>
<div class="no-row-height column-margin column-container"><div id="fn1"><p><sup>1</sup>&nbsp;An interesting exercise is to count how many such algorithms exist. A given community detection algorithm <img src="https://latex.codecogs.com/png.latex?f"> needs to map each of all <img src="https://latex.codecogs.com/png.latex?%5COmega(N)=2%5E%7BN%5Cchoose%202%7D"> networks of <img src="https://latex.codecogs.com/png.latex?N"> nodes to one of <img src="https://latex.codecogs.com/png.latex?%5CXi(N)=%5Csum_%7BB=1%7D%5E%7BN%7D%5Cgenfrac%5C%7B%5C%7D%7B0pt%7D%7B%7D%7BN%7D%7BB%7DB!"> labeled partitions of its nodes. Therefore, if we restrict ourselves to a single value of <img src="https://latex.codecogs.com/png.latex?N">, the total number of input-output tables is <img src="https://latex.codecogs.com/png.latex?%5CXi(N)%5E%7B%5COmega(N)%7D">. If we sample one such table uniformly at random, it will be asymptotically impossible to compress it using fewer than <img src="https://latex.codecogs.com/png.latex?%5COmega(N)%5Clog_2%5CXi(N)"> bits — a number that grows super-exponentially with <img src="https://latex.codecogs.com/png.latex?N">. As an illustration, a random community detection algorithm that works only with <img src="https://latex.codecogs.com/png.latex?N=100"> nodes would already need <img src="https://latex.codecogs.com/png.latex?10%5E%7B1479%7D"> terabytes of storage. Therefore, simply considering algorithms that humans can write and use (together with their expected inputs and outputs) already pulls us very far away from the general scenario considered by the NFL theorem.</p></div></div><p>In order to interpret the statement of the NFL theorem in this vein, it is useful to re-write Equation&nbsp;1 using an equivalent probabilistic language,</p>
<p><span id="eq-nflp"><img src="https://latex.codecogs.com/png.latex?%5Csum_%7B%5Cboldsymbol%20A,%20%5Cboldsymbol%20b%7DP(%5Cboldsymbol%20A,%5Cboldsymbol%20b)%5Cepsilon%0A(%5Cboldsymbol%20b,%20%5Chat%7B%5Cboldsymbol%20b%7D_f(%5Cboldsymbol%20A))%20=%0A%5CLambda'(%5Cepsilon),%20%5Ctag%7B2%7D"></span></p>
<p>where <img src="https://latex.codecogs.com/png.latex?%5CLambda'(%5Cepsilon)%5Cpropto%20%5CLambda(%5Cepsilon)">, and <img src="https://latex.codecogs.com/png.latex?P(%5Cboldsymbol%20A,%5Cboldsymbol%20b)%20%5Cpropto%201"> is the uniform probability of encountering a problem instance. When writing the theorem statement in this way, we notice immediately that instead of being agnostic about problem instances, it implies a <em>very specific</em> network generative model, which assumes a complete independence between network and partition. Namely, if we restrict ourselves to networks of <img src="https://latex.codecogs.com/png.latex?N"> nodes, we have then:</p>
<p><span id="eq-uniform"><img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0A%5Cbegin%7Baligned%7D%0AP(%5Cboldsymbol%20A,%5Cboldsymbol%20b)&amp;=P(%5Cboldsymbol%20A)P(%5Cboldsymbol%20b),%5C%5C%0AP(%5Cboldsymbol%20A)%20&amp;=%202%5E%7B-%7BN%5Cchoose%202%7D%7D,%5C%5C%0AP(%5Cboldsymbol%20b)%20&amp;=%20%5Cleft%5B%5Csum_%7BB=1%7D%5E%7BN%7D%5Cgenfrac%5C%7B%5C%7D%7B0pt%7D%7B%7D%7BN%7D%7BB%7DB!%5Cright%5D%5E%7B-1%7D.%0A%5Cend%7Baligned%7D%0A%5Cend%7Baligned%7D%20%5Ctag%7B3%7D"></span></p>
<p>Therefore, the NFL theorem states simply that if we sample networks and partitions from a maximally random generative model, then all algorithms will have the same average accuracy at inferring the partition from the network. This is hardly a spectacular result — indeed the Bayes-optimal algorithm in this case, i.e.&nbsp;the one derived from the posterior distribution of the true generative model and which guarantees the best accuracy on average, consists of simply guessing partitions uniformly at random, ignoring the network structure altogether.</p>
<p>The probabilistic interpretation reveals that the NFL theorem makes a very specific assumption about what kind of community detection problem we are expecting, namely one where both the network and partition are sampled independently and uniformly at random. It is important to remember that it is not possible to make “no assumption” about a problem; we are always forced to make <em>some</em> assumption, which even if implicit does not exempt it from justification, and the uniform assumption of Equation&nbsp;3 is no exception. In Figure&nbsp;1 (a) we show a typical sample from this ensemble of community detection problems.</p>
<div id="fig-nfl" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-nfl-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://skewed.de/lab/posts/free-lunch/nfl-compressive.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-nfl-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: The NFL theorem involves predominantly instances of the community detection problem that are strictly incompressible, i.e.&nbsp;the true partitions cannot be used to explain the network. In (a) we show a typical sample of the uniform problem space given by Equation&nbsp;3, for <img src="https://latex.codecogs.com/png.latex?N=100"> nodes, which yields a dense fully random network, randomly divided into <img src="https://latex.codecogs.com/png.latex?B=72"> groups. It is asymptotically impossible to use this partition to compress this network into fewer than <img src="https://latex.codecogs.com/png.latex?%5CSigma_%7B%5Ctext%7Bmin%7D%7D(%5Cboldsymbol%0A%20%20%20A%7C%5Cboldsymbol%20b)%20=%20%7BN%20%5Cchoose%202%7D%20=%204950"> bits, and therefore the partition is not learnable from the network alone with any inferential algorithm. We show also the description length of the SBM conditioned on the true partition, <img src="https://latex.codecogs.com/png.latex?%5CSigma_%7B%5Ctext%7BSBM%7D%7D(%5Cboldsymbol%20A%7C%5Cboldsymbol%20b)">, as a reference. In (b) we show an example of a community detection problem that is solvable, at least in principle, since <img src="https://latex.codecogs.com/png.latex?%5CSigma_%7B%5Ctext%7BSBM%7D%7D(%5Cboldsymbol%20A%7C%5Cboldsymbol%20b)%20%3C%0A%20%20%20%5CSigma_%7B%5Ctext%7Bmin%7D%7D(%5Cboldsymbol%20A%7C%5Cboldsymbol%20b)">. In this case, the partition can be used to inform the network structure, and potentially vice-versa. This class of problem instance has a negligible contribution to the sum in the NFL theorem in eq:nfl_, since it occurs only with an extremely small probability when sampled from the uniform model of Equation&nbsp;3. It is therefore more reasonable to state that the network in example (b) has an <em>actual</em> community structure, while the one in (a) does not.
</figcaption>
</figure>
</div>
<p>In a very concrete sense, we can state that such problem instances contain <em>no learnable community structure</em>, or in fact no learnable network structure <em>at all</em>. We say that a community structure is learnable if the knowledge of the partition <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20b"> can be used to compress the network <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20A">, i.e.&nbsp;there exists an encoding <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BH%7D"> (i.e.&nbsp;a generative model) such that</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0A%5Cbegin%7Baligned%7D%0A%5CSigma(%5Cboldsymbol%20A%7C%5Cboldsymbol%20b,%5Cmathcal%7BH%7D)%20&amp;%3C%20-%5Clog_2%20P(%5Cboldsymbol%20A),%5C%5C%0A&amp;%3C%20%7BN%5Cchoose%202%7D,%0A%5Cend%7Baligned%7D%0A%5Cend%7Baligned%7D"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?%5CSigma(%5Cboldsymbol%20A%7C%5Cboldsymbol%20b,%5Cmathcal%7BH%7D)%20=%0A-%5Clog_2P(%5Cboldsymbol%20A%7C%5Cboldsymbol%20b,%5Cmathcal%7BH%7D)"> is the description length of <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20A"> according to model <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BH%7D">, conditioned on the partition being known. However, it is a direct consequence of Shannon's source coding theorem<span class="citation" data-cites="shannon_mathematical_1948">&nbsp;[7]</span>, that for the vast majority of networks sampled from the model of Equation&nbsp;3 the inequality above cannot be fulfilled as <img src="https://latex.codecogs.com/png.latex?N%5Cto%5Cinfty">, i.e.&nbsp;the networks are incompressible.<sup>2</sup> This means that the true partition <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20b"> carries no information about the network structure, and vice versa, i.e.&nbsp;the partition is not learnable from the network. In view of this, the common interpretation of the NFL theorem as “all algorithms perform equally well” is in fact somewhat misleading, and can be more accurately phrased as “all algorithms perform equally <em>poorly</em>”, since no inferential algorithm can uncover the true community structure in most cases, at least no better than by chance alone. In other words, the universe of community detection problems considered in the NFL theorem is composed overwhelmingly of problems for which compression and explanation are not possible.<sup>3</sup> This uniformity between instances also reveals that there is no meaningful trade-off between algorithms for most instances, since all algorithms will yield the same negligible asymptotic performance, with an accuracy tending asymptotically towards zero as the number of nodes increases. In this setting, there is not only no free lunch, but in fact there is no lunch at all (see Figure&nbsp;2).</p>
<div class="no-row-height column-margin column-container"><div id="fn2"><p><sup>2</sup>&nbsp;For finite networks a positive compression might be achievable with small probability, but due to chance alone, and not in a manner that makes its structure learnable.</p></div><div id="fn3"><p><sup>3</sup>&nbsp;<span id="footnote">One</span> could argue that such a uniform model is justified by the principle of maximum entropy, which states that in the absence of prior knowledge about which problem instances are more likely, we should assume they are all equally likely <em>a priori</em>. This argument fails precisely because we <em>do</em> have sufficient prior knowledge that empirical networks are not maximally random — specially those possessing community structure, according to any meaningful definition of the term. Furthermore, it is easy to verify for each particular problem instance that the uniform assumption does not hold; either by compressing an observed network using any generative model (which should be asymptotically impossible under the uniform assumption), or performing a statistical test designed to reject the uniform null model. It is exceedingly difficult to find an empirical network for which the uniform model cannot be rejected with near-absolute confidence.</p></div></div><div id="fig-nfl-trade-off" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-nfl-trade-off-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://skewed.de/lab/posts/free-lunch/nfl-trade-off.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-nfl-trade-off-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: A common interpretation of the NFL theorem for community detection is that it reveals a necessary trade-off between algorithms: since they all have the same average performance, if one algorithm does better than another in one set of instances, it must do worse on a equal number of different instances, as depicted in panel (a). However, in the actual setting considered by the NFL theorem there is no meaningful trade-off: asymptotically, all algorithms perform maximally poorly for the vast majority of instances, as depicted in panel (b), since in these cases the network structure is uninformative of the partition. If we constrain ourselves to informative problem instances (which compose only an infinitesimal fraction of all instances), the NFL theorem is no longer applicable.
</figcaption>
</figure>
</div>
<p>If we were to restrict the space of possible community detection algorithms to those that provide actual explanations, then by definition this would imply a positive correlation between network and partition, i.e.<sup>4</sup></p>
<div class="no-row-height column-margin column-container"><div id="fn4"><p><sup>4</sup>&nbsp;Note that Equation&nbsp;4 is a necessary but not sufficient condition for the community detection problem to be solvable. An example of this are networks generated by the SBM, which are solvable only if the strength of the community structure exceeds a detectability threshold<span class="citation" data-cites="decelle_asymptotic_2011">&nbsp;[8]</span>, even if Equation&nbsp;4 is fulfilled.</p></div></div><p><span id="eq-informative"><img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0A%5Cbegin%7Baligned%7D%0AP(%5Cboldsymbol%20A,%5Cboldsymbol%20b)%20&amp;=%20P(%5Cboldsymbol%20A%7C%5Cboldsymbol%20b)P(%5Cboldsymbol%20b)%5C%5C%0A%20%20%20%20%20%20%20%20%20&amp;%5Cneq%20P(%5Cboldsymbol%20A)P(%5Cboldsymbol%20b).%0A%5Cend%7Baligned%7D%0A%5Cend%7Baligned%7D%20%5Ctag%7B4%7D"></span></p>
<p>Not only this implies a specific generative model but, as a consequence, also an <em>optimal</em> community detection algorithm, that operates based on the posterior distribution</p>
<p><img src="https://latex.codecogs.com/png.latex?P(%5Cboldsymbol%20b%7C%5Cboldsymbol%20A)%20=%20%5Cfrac%7BP(%5Cboldsymbol%20A%7C%5Cboldsymbol%20b)P(%5Cboldsymbol%20b)%7D%7BP(%5Cboldsymbol%20A)%7D."></p>
<p>Therefore, <em>learnable</em> community detection problems are invariably tied to an <em>optimal</em> class of algorithms, undermining to a substantial degree the relevance of the NFL theorem in practice. In other words, whenever there is an actual community structure in the network being considered — i.e.&nbsp;due to a systematic correlation between <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20A"> and <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20b">, such that <img src="https://latex.codecogs.com/png.latex?P(%5Cboldsymbol%20A,%5Cboldsymbol%20b)%5Cne%20P(%5Cboldsymbol%20A)P(%5Cboldsymbol%20b)"> — there will be algorithms that can exploit this correlation better than others (see Figure&nbsp;1 (b) for an example of a learnable community detection problem). Importantly, the set of learnable problems form only an infinitesimal fraction of all problem instances, with a measure that tends to zero as the number of nodes increases, and hence remain firmly out of scope of the NFL theorem. This observation has been made before, and is equally valid, in the wider context of NFL theorems beyond community detection<span class="citation" data-cites="streeter_two_2003 mcgregor_no_2006 everitt_universal_2013 lattimore_no_2013 everitt_free_2014 schurz_humes_2019">&nbsp;[9–14]</span>.</p>
<p>Note that since there are many ways to choose a nonuniform model according to Equation&nbsp;4, the optimal algorithms will still depend on the particular assumptions made via the choice <img src="https://latex.codecogs.com/png.latex?P(%5Cboldsymbol%20A,%5Cboldsymbol%20b)">. However, this does not imply that all algorithms have equal performance on compressible problem instances. If we sample a problem from the universe <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BH%7D_1">, with <img src="https://latex.codecogs.com/png.latex?P(%5Cboldsymbol%20A,%5Cboldsymbol%20b%7C%5Cmathcal%7BH%7D_1)">, but use instead two algorithms optimal in <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BH%7D_2"> and <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BH%7D_3">, respectively, their relative performances will depend on how close each of these universes is to <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BH%7D_1">, and hence will not be in general the same. In fact, if our space of universes is finite, we can compose them into a single unified universe<span class="citation" data-cites="jaynes_probability_2003">&nbsp;[15]</span> according to</p>
<p><img src="https://latex.codecogs.com/png.latex?P(%5Cboldsymbol%20A,%5Cboldsymbol%20b)%20=%20%5Csum_%7Bi=1%7D%5E%7BM%7DP(%5Cboldsymbol%20A,%5Cboldsymbol%20b%7C%5Cmathcal%7BH%7D_i)P(%5Cmathcal%7BH%7D_i),"></p>
<p>which will incur a compression penalty of at most <img src="https://latex.codecogs.com/png.latex?%5Clog_2%20M"> bits added to the description length of the optimal algorithm. This gives us a path, based on hierarchical Bayesian models and minimum description length, to achieve optimal or near-optimal performance on instances of the community detection problem that are actually solvable, simply by progressively expanding our set of hypotheses.</p>
<p>The idea that we can use compression as an inference criterion has been formalized by <a href="https://en.wikipedia.org/wiki/Solomonoff%27s_theory_of_inductive_inference">Solomonoff's theory of inductive inference</a>, which forms a rigorous induction framework based on the principle of <a href="https://en.wikipedia.org/wiki/Occam%27s_razor">Occam's razor</a>. Importantly, the expected errors of predictions achieved under this framework are provably upper-bounded by the <a href="https://en.wikipedia.org/wiki/Kolmogorov_complexity">Kolmogorov complexity</a> of the data generating process<span class="citation" data-cites="hutter_universal_2007">&nbsp;[16]</span>, making the induction framework consistent. The Kolmogorov complexity is a generalization of the description length we have been using, and it is defined by the length of the shortest binary program that generates the data. The only major limitation of Solomonoff's framework is its uncomputability, i.e.&nbsp;the impossibility of determining Kolmogorov's complexity with any algorithm. However, this impossibility does not invalidate the framework, it only means that induction cannot be fully automatized: we have a consistent criterion to compare hypotheses, but no deterministic mechanism to produce directly the best hypothesis. There are open philosophical questions regarding the universality of this inductive framework<span class="citation" data-cites="hutter_open_2009">&nbsp;[18]</span>, but whatever fundamental limitations it may have do not follow directly from NFL theorems such as the one from<span class="citation" data-cites="peel_ground_2017">&nbsp;[5]</span>. In fact, as mentioned in the footnote above, it is a rather simple task to use compression to reject the uniform hypothesis forming the basis of the NFL theorem for almost any network data.</p>
<p>Since compressive community detection problems are out of the scope of the NFL theorem, it is not meaningful to use it to justify avoiding comparisons between algorithms, on the grounds that all choices must be equally “good” in a fundamental sense. In fact, we do not need much sophistication to reject this line of argument, since the NFL theorem applies also when we are considering trivially inane algorithms, e.g.&nbsp;one that always returns the same partition for every network. The only domain where such an algorithm is as good as any other is when we have no community <em>structure</em> to begin with, which is precisely what the NFL theorem relies on.</p>
<p>Nevertheless, there are some lessons we can draw from the NFL theorem. It makes it clear that the performance of algorithms are tied directly to the <a href="https://en.wikipedia.org/wiki/Inductive_bias">inductive bias</a> adopted, which should always be made explicit. The superficial interpretation of the NFL theorem as an inherent equity between all algorithms stems from the assumption that considering all problem instances uniformly is equivalent to being free of an inductive bias, but that is not possible. The uniform assumption is itself an inductive bias, and one that it is hard to justify in virtually any context, since it involves almost exclusively unsolvable problems (from the point of view of compressibility). In contrast, considering only <em>compressible</em> problem instances is also an inductive bias, but one that relies only on Occam's razor as a guiding principle. The advantage of the latter is that it is independent of domain of application, i.e.&nbsp;we are making a statement only about whether a partition can help explaining the network, without having to specify how <em>a priori</em>.</p>
<p>In view of the above observations, it becomes easier to understand results such as of Ghasemian <em>et al</em><span class="citation" data-cites="ghasemian_evaluating_2019">&nbsp;[19]</span> who found that compressive inferential community detection methods tend to systematically outperform descriptive methods in empirical settings, when these are employed for the task of edge prediction. Even though edge prediction and community detection are not the same task, and using the former to evaluate the latter can lead in some cases to overfitting<span class="citation" data-cites="valles-catala_consistencies_2018">&nbsp;[20]</span>, typically the most compressive models will also lead to the best generalization. Therefore, the superior performance of the inferential methods is understandable, even though Ghasemian <em>et al</em> also found a minority of instances where some descriptive methods can outperform inferential ones. To the extent that these minority results cannot be attributed to overfitting, or technical issues such as insufficient MCMC equilibration, it could simply mean that the structure of these networks fall sufficiently outside of what is assumed by the inferential methods, but without it being a necessary trade-off that comes as a consequence of the NFL theorem — after all, under the uniform assumption, edge prediction is also strictly impossible, just like community detection. In other words, these results do not rule out the existence of an algorithm that works better in all cases considered, at least if their number is not too large <sup>5</sup>. In fact, this is precisely what is achieved in<span class="citation" data-cites="ghasemian_stacking_2020">&nbsp;[21]</span> via model stacking, i.e.&nbsp;a combination of several predictors into a meta-predictor that achieves systematically superior performance. This points indeed to the possibility of using universal methods to discover the latent <strong>compressive</strong> modular structure of networks, without any tension with the NFL theorem.</p>
<div class="no-row-height column-margin column-container"><div id="fn5"><p><sup>5</sup>&nbsp;It is important to distinguish the actual statement of the NFL theorem — “all algorithms perform equally well when averaged over all problem instances” — from the alternative statement: “No single algorithm exhibits strictly better performance than all others over all instances.” Although the latter is a corollary of the former, it can also be true when the former is false. In other words, a particular algorithm can be better on average over relevant problem instances, but still underperform for some of them. In fact, it would only be possible for an algorithm to strictly dominate all others if it can always achieve perfect accuracy for every instance. Otherwise, there will be at least one algorithm (e.g.&nbsp;one that always returns the same partition) that can achieve perfect accuracy for a single network where the optimal algorithm does not (“even a broken clock is right twice a day”). Therefore, sub-optimal algorithms can eventually outperform optimal ones by chance when a sufficiently large number of instances is encountered, even when the NFL theorem is not applicable (and therefore this fact is not necessarily a direct consequence of it).</p></div></div><section id="references" class="level4">
<h4 class="anchored" data-anchor-id="references">References</h4>
<div id="refs" class="references csl-bib-body" data-entry-spacing="0">
<div id="ref-peixoto_descriptive_2023" class="csl-entry">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1017/9781009118897">Descriptive Vs. <span>Inferential Community Detection</span> in <span>Networks</span>: <span>Pitfalls</span>, <span>Myths</span> and <span>Half-Truths</span></a></em>, Elements in the Structure and Dynamics of Complex Networks (2023).</div>
</div>
<div id="ref-wolpert_no_1995" class="csl-entry">
<div class="csl-left-margin">[2] </div><div class="csl-right-inline">D. H. Wolpert and W. G. Macready, No Free Lunch Theorems for Search, Technical Report SFI-TR-95-02-010, Santa Fe Institute, 1995.</div>
</div>
<div id="ref-wolpert_lack_1996" class="csl-entry">
<div class="csl-left-margin">[3] </div><div class="csl-right-inline">D. H. Wolpert, <em><a href="https://doi.org/10.1162/neco.1996.8.7.1341">The <span>Lack</span> of <span>A Priori Distinctions Between Learning Algorithms</span></a></em>, Neural Computation <strong>8</strong>, 1341 (1996).</div>
</div>
<div id="ref-wolpert_no_1997" class="csl-entry">
<div class="csl-left-margin">[4] </div><div class="csl-right-inline">D. H. Wolpert and W. G. Macready, <em>No Free Lunch Theorems for Optimization</em>, IEEE Transactions on Evolutionary Computation <strong>1</strong>, 67 (1997).</div>
</div>
<div id="ref-peel_ground_2017" class="csl-entry">
<div class="csl-left-margin">[5] </div><div class="csl-right-inline">L. Peel, D. B. Larremore, and A. Clauset, <em><a href="https://doi.org/10.1126/sciadv.1602548">The Ground Truth about Metadata and Community Detection in Networks</a></em>, Science Advances <strong>3</strong>, e1602548 (2017).</div>
</div>
<div id="ref-schaffer_conservation_1994" class="csl-entry">
<div class="csl-left-margin">[6] </div><div class="csl-right-inline">C. Schaffer, <em><a href="https://doi.org/10.1016/B978-1-55860-335-6.50039-8">A <span>Conservation Law</span> for <span>Generalization Performance</span></a></em>, in <em>Machine <span>Learning Proceedings</span> 1994</em>, edited by W. W. Cohen and H. Hirsh (Morgan Kaufmann, San Francisco (CA), 1994), pp. 259–265.</div>
</div>
<div id="ref-shannon_mathematical_1948" class="csl-entry">
<div class="csl-left-margin">[7] </div><div class="csl-right-inline">C. E. Shannon, <em>A Mathematical Theory of Communication</em>, Bell Syst Tech. J <strong>27</strong>, 623 (1948).</div>
</div>
<div id="ref-decelle_asymptotic_2011" class="csl-entry">
<div class="csl-left-margin">[8] </div><div class="csl-right-inline">A. Decelle, F. Krzakala, C. Moore, and L. Zdeborová, <em><a href="https://doi.org/10.1103/PhysRevE.84.066106">Asymptotic Analysis of the Stochastic Block Model for Modular Networks and Its Algorithmic Applications</a></em>, Physical Review E <strong>84</strong>, 066106 (2011).</div>
</div>
<div id="ref-streeter_two_2003" class="csl-entry">
<div class="csl-left-margin">[9] </div><div class="csl-right-inline">M. J. Streeter, <em><a href="https://doi.org/10.1007/3-540-45110-2_15">Two <span>Broad Classes</span> of <span>Functions</span> for <span>Which</span> a <span>No Free Lunch Result Does Not Hold</span></a></em>, in <em>Genetic and <span>Evolutionary Computation</span> — <span>GECCO</span> 2003</em>, edited by E. Cantú-Paz, J. A. Foster, K. Deb, L. D. Davis, R. Roy, U.-M. O’Reilly, H.-G. Beyer, R. Standish, G. Kendall, S. Wilson, M. Harman, J. Wegener, D. Dasgupta, M. A. Potter, A. C. Schultz, K. A. Dowsland, N. Jonoska, and J. Miller (Springer, Berlin, Heidelberg, 2003), pp. 1418–1430.</div>
</div>
<div id="ref-mcgregor_no_2006" class="csl-entry">
<div class="csl-left-margin">[10] </div><div class="csl-right-inline">S. McGregor, <em>No Free Lunch and Algorithmic Randomness</em>, in <em><span>GECCO</span></em>, Vol. 6 (2006), pp. 2–4.</div>
</div>
<div id="ref-everitt_universal_2013" class="csl-entry">
<div class="csl-left-margin">[11] </div><div class="csl-right-inline">T. Everitt, <em><a href="https://www.diva-portal.org/smash/get/diva2:780784/FULLTEXT01.pdf">Universal Induction and Optimisation: <span>No</span> Free Lunch?</a></em>, (2013).</div>
</div>
<div id="ref-lattimore_no_2013" class="csl-entry">
<div class="csl-left-margin">[12] </div><div class="csl-right-inline">T. Lattimore and M. Hutter, <em><a href="https://doi.org/10.1007/978-3-642-44958-1_17">No <span>Free Lunch</span> Versus <span>Occam</span>’s <span>Razor</span> in <span>Supervised Learning</span></a></em>, in <em>Algorithmic <span>Probability</span> and <span>Friends</span>. <span>Bayesian Prediction</span> and <span>Artificial Intelligence</span>: <span>Papers</span> from the <span>Ray Solomonoff</span> 85th <span>Memorial Conference</span>, <span>Melbourne</span>, <span>VIC</span>, <span>Australia</span>, <span>November</span> 30 – <span>December</span> 2, 2011</em>, edited by D. L. Dowe (Springer, Berlin, Heidelberg, 2013), pp. 223–235.</div>
</div>
<div id="ref-everitt_free_2014" class="csl-entry">
<div class="csl-left-margin">[13] </div><div class="csl-right-inline">T. Everitt, T. Lattimore, and M. Hutter, <em><a href="https://doi.org/10.1109/CEC.2014.6900546">Free <span>Lunch</span> for Optimisation Under the Universal Distribution</a></em>, in <em>2014 <span>IEEE Congress</span> on <span>Evolutionary Computation</span> (<span>CEC</span>)</em> (2014), pp. 167–174.</div>
</div>
<div id="ref-schurz_humes_2019" class="csl-entry">
<div class="csl-left-margin">[14] </div><div class="csl-right-inline">G. Schurz, <em>Hume’s <span>Problem Solved</span>: <span>The Optimality</span> of <span>Meta-Induction</span></em>, Illustrated edition (The MIT Press, Cambridge, Massachusetts, 2019).</div>
</div>
<div id="ref-jaynes_probability_2003" class="csl-entry">
<div class="csl-left-margin">[15] </div><div class="csl-right-inline">E. T. Jaynes, <em>Probability <span>Theory</span>: <span>The Logic</span> of <span>Science</span></em> (Cambridge University Press, Cambridge, UK ; New York, NY, 2003).</div>
</div>
<div id="ref-hutter_universal_2007" class="csl-entry">
<div class="csl-left-margin">[16] </div><div class="csl-right-inline">M. Hutter, <em><a href="https://doi.org/10.1016/j.tcs.2007.05.016">On Universal Prediction and <span>Bayesian</span> Confirmation</a></em>, Theoretical Computer Science <strong>384</strong>, 33 (2007).</div>
</div>
<div id="ref-hutter_open_2009" class="csl-entry">
<div class="csl-left-margin">[17] </div><div class="csl-right-inline">M. Hutter, <em><a href="https://doi.org/10.3390/a2030879">Open <span>Problems</span> in <span>Universal Induction</span> &amp; <span>Intelligence</span></a></em>, Algorithms <strong>2</strong>, 879 (2009).</div>
</div>
<div id="ref-montanez_why_2017" class="csl-entry">
<div class="csl-left-margin">[18] </div><div class="csl-right-inline">G. D. Montanez, <em><a href="https://www. cs. cmu. edu/~gmontane/montanez_dissertation. pdf">Why Machine Learning Works</a></em>, (2017).</div>
</div>
<div id="ref-ghasemian_evaluating_2019" class="csl-entry">
<div class="csl-left-margin">[19] </div><div class="csl-right-inline">A. Ghasemian, H. Hosseinmardi, and A. Clauset, <em><a href="https://doi.org/10.1109/TKDE.2019.2911585">Evaluating <span>Overfit</span> and <span>Underfit</span> in <span>Models</span> of <span>Network Community Structure</span></a></em>, IEEE Transactions on Knowledge and Data Engineering 1 (2019).</div>
</div>
<div id="ref-valles-catala_consistencies_2018" class="csl-entry">
<div class="csl-left-margin">[20] </div><div class="csl-right-inline">T. Vallès-Català, T. P. Peixoto, M. Sales-Pardo, and R. Guimerà, <em><a href="https://doi.org/10.1103/PhysRevE.97.062316">Consistencies and Inconsistencies Between Model Selection and Link Prediction in Networks</a></em>, Physical Review E <strong>97</strong>, 062316 (2018).</div>
</div>
<div id="ref-ghasemian_stacking_2020" class="csl-entry">
<div class="csl-left-margin">[21] </div><div class="csl-right-inline">A. Ghasemian, H. Hosseinmardi, A. Galstyan, E. M. Airoldi, and A. Clauset, <em><a href="https://doi.org/10.1073/pnas.1914950117">Stacking Models for Nearly Optimal Link Prediction in Complex Networks</a></em>, Proceedings of the National Academy of Sciences <strong>117</strong>, 23393 (2020).</div>
</div>
</div>
<hr>
</section>
<section id="comments" class="level4">
<h4 class="anchored" data-anchor-id="comments">Comments</h4>
<p>(Comments may be moderated.)</p>
<div class="discourse-excerpt" style="display: none">
<p>If you reply to this post, it will show as a comment below the original article.</p>
</div>
<div id="discourse-comments"></div>
<meta name="discourse-username" content="tiago">

<script type="text/javascript">

  const discourse_url = "https://forum.skewed.de";

  // Here, we determine the theme, and send a message to the iframe to let it know what the theme is
  // See below for how we hook up notifyFrameStyle 
  const notifyIFrameOfTheme = () => {
    const iframe = document.getElementById("discourse-embed-frame");
    if (document.body.classList.contains("quarto-dark")) {
      theme = "dark";
    } else {
      theme = "light";
    }

    if (iframe && iframe.contentWindow) {
      iframe.contentWindow.postMessage(
        {
          // Modify the line below to grab dark mode setting, depending on how you store it
          theme: theme
        },
        discourse_url
      );
    }
  };

  // Call setFrameStyle when we receive the "iframe loaded" message
  const handleMessageListener = (event) => {
    var origin = event.origin;
    if ((origin === discourse_url) && (event.data == "iframe loaded")) {
      notifyIFrameOfTheme();
    }
  };

  DiscourseEmbed = {
    discourseUrl: 'https://forum.skewed.de/',
    discourseEmbedUrl: 'https://skewed.de/lab/posts/free-lunch/',
    //className: 'discourse-excerpt',
  };
  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();

  window.addEventListener("message", handleMessageListener);
</script>
</section>
<section id="webmentionswebmentions" class="level4">
<h4 class="anchored" data-anchor-id="webmentionswebmentions">Webmentions<sup>6</sup></h4>
<div id="nomention">
<p>(Nothing yet)</p>
</div>
<div class="mentionsio">
<ul id="facepile">
</ul>
<ul id="reposts">
</ul>
<ul id="mentions">
</ul>
</div>


</section>
<div class="no-row-height column-margin column-container"><div id="fn6"><p><sup>6</sup>&nbsp;<a href="https://indieweb.org/Webmention">Webmention</a> is a standardized decentralized mechanism for conversations and interactions across the web.</p></div></div>

</div> ]]></description>
  <category>community detection</category>
  <category>free lunch</category>
  <category>inference</category>
  <category>compression</category>
  <category>Bayes</category>
  <guid>https://skewed.de/lab/posts/free-lunch/</guid>
  <pubDate>Mon, 06 Dec 2021 23:00:00 GMT</pubDate>
  <media:content url="https://skewed.de/lab/posts/free-lunch/nfl-trade-off.png" medium="image" type="image/png" height="60" width="144"/>
</item>
<item>
  <title>Modularity maximization considered harmful</title>
  <dc:creator>Tiago P. Peixoto</dc:creator>
  <link>https://skewed.de/lab/posts/modularity-harmful/</link>
  <description><![CDATA[ 

<div class="h-entry e-content entry-content page-columns page-full">




<div class="page-columns page-full"><p></p><div class="no-row-height column-margin column-container"><span class="margin-aside">This post is a continuation of the previous <a href="../inference-compression">two</a> <a href="../descriptive-inferential">posts</a>, and a slightly modified version of chapter III in <span class="citation" data-cites="peixoto_descriptive_2023">&nbsp;[1]</span>.</span></div></div>
<p>The most widespread method for community detection is modularity maximization <span class="citation" data-cites="newman_modularity_2006">&nbsp;[2]</span>, which happens also to be one of the most problematic. This method is based on the modularity function,</p>
<p><span id="eq-Q"><img src="https://latex.codecogs.com/png.latex?Q(%5Cboldsymbol%20A,%5Cboldsymbol%20b)%20=%20%5Cfrac%7B1%7D%7B2E%7D%5Csum_%7Bij%7D%5Cleft(A_%7Bij%7D%20-%0A%5Cfrac%7Bk_ik_j%7D%7B2E%7D%5Cright)%5Cdelta_%7Bb_i,b_j%7D%20%5Ctag%7B1%7D"></span></p>
<p>where <img src="https://latex.codecogs.com/png.latex?A_%7Bij%7D%5Cin%5C%7B0,1%5C%7D"> is an entry of the adjacency matrix, <img src="https://latex.codecogs.com/png.latex?k_i=%5Csum_jA_%7Bij%7D"> is the degree of node <img src="https://latex.codecogs.com/png.latex?i">, <img src="https://latex.codecogs.com/png.latex?b_i"> is the group membership of node <img src="https://latex.codecogs.com/png.latex?i">, and <img src="https://latex.codecogs.com/png.latex?E"> is the total number of edges. The method consists in finding the partition <img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%20b%7D"> that maximizes <img src="https://latex.codecogs.com/png.latex?Q(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)">,</p>
<p><span id="eq-qmax"><img src="https://latex.codecogs.com/png.latex?%5Chat%7B%5Cboldsymbol%20b%7D%20=%20%5Cunderset%7B%5Cboldsymbol%20b%7D%7B%5Coperatorname%7Bargmax%7D%7D%5C;%0AQ(%5Cboldsymbol%20A,%5Cboldsymbol%20b).%20%5Ctag%7B2%7D"></span></p>
<p>The motivation behind the modularity function is that it compares the existence of an edge <img src="https://latex.codecogs.com/png.latex?(i,j)"> to the probability of it existing according to a null model, <img src="https://latex.codecogs.com/png.latex?P_%7Bij%7D%20=%20k_ik_j/2E">, namely that of the configuration model <span class="citation" data-cites="fosdick_configuring_2018">&nbsp;[3]</span> (or more precisely, the Chung-Lu model <span class="citation" data-cites="chung_connected_2002">&nbsp;[4]</span>). The intuition for this method is that we should consider a partition of the network meaningful if the occurrence of edges between nodes of the same group exceeds what we would expect with a random null model without communities.</p>
<p>Despite its widespread adoption, this approach suffers from a variety of serious conceptual and practical flaws, which have been documented extensively <span class="citation" data-cites="guimera_modularity_2004">&nbsp;[9]</span>. The most problematic one is that it <em>purports</em> to use an inferential criterion—a deviation from a null generative model—but is in fact merely descriptive. As has been recognized very early, this method categorically fails in its own stated goal, since it always finds high-scoring partitions in networks sampled from its own null model <span class="citation" data-cites="guimera_modularity_2004">&nbsp;[5]</span>.</p>
<p>The reason for this failure is that the method does not take into account the deviation from the null model in a statistically consistent manner. The modularity function is just a re-scaled version of the assortativity coefficient <span class="citation" data-cites="newman_mixing_2003">&nbsp;[10]</span>, a correlation measure of the community assignments seen at the endpoints of edges in the network. We should expect such a correlation value to be close to zero for a partition that is determined <em>before</em> the edges of the network are placed according to the null model, or equivalently, for a partition chosen at random. However, it is quite a different matter to find a partition that <em>optimizes</em> the value of <img src="https://latex.codecogs.com/png.latex?Q(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)">, after the network is observed. The deviation from a null model computed in Equation&nbsp;1 completely ignores the optimization step of Equation&nbsp;2, although it is a crucial part of the algorithm. As a result, the method of modularity maximization tends to massively overfit, and find spurious communities even in networks sampled from its null model. We are searching for patterns of correlations in a random graph, and most of the time we will find them. This is a pitfall known as <a href="https://en.wikipedia.org/wiki/Data_dredging">“data dredging”</a> or <a href="https://en.wikipedia.org/wiki/Data_dredging">“p-hacking”</a>, where one searches exhaustively for different patterns in the same data and reports only those that are deemed significant, according to a criterion that does not take into account the fact that we are doing this search in the first place.</p>
<p>We demonstrate this problem in Figure&nbsp;1, where we show the distribution of modularity values obtained with a uniform configuration model with <img src="https://latex.codecogs.com/png.latex?k_i=5"> for every node <img src="https://latex.codecogs.com/png.latex?i">, considering both a random partition and the one that maximizes <img src="https://latex.codecogs.com/png.latex?Q(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)">. While for a random partition we find what we would expect, i.e.&nbsp;a value of <img src="https://latex.codecogs.com/png.latex?Q(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)"> close to zero, for the optimized partition the value is substantially larger. Inspecting the optimized partition in Figure&nbsp;1 (c), we see that it corresponds indeed to 15 seemingly clear assortative communities—which by construction bear no relevance to how the network was generated. They have been dredged out of randomness by the optimization procedure.</p>
<div id="fig-randomQ" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-randomQ-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://skewed.de/lab/posts/modularity-harmful/modularity_fail.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-randomQ-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Modularity maximization systematically overfits, and finds spurious structures even its own null model. In this example we consider a random network model with <img src="https://latex.codecogs.com/png.latex?N%E2%80%84=%E2%80%8410%5E3"> nodes, with every node having degree <img src="https://latex.codecogs.com/png.latex?5">. (a) Distribution of modularity values for a partition into 15 groups chosen at random, and for the optimized value of modularity, for <img src="https://latex.codecogs.com/png.latex?5000"> networks sampled from the same model. (b) Adjacency matrix of a sample from the model, with the nodes ordered according to a random partition. (c) Same as (b), but with the nodes ordered according to the partition that maximizes modularity.
</figcaption>
</figure>
</div>
<p>Somewhat paradoxically, another problem with modularity maximization is that in addition to systematically overfitting, it also systematically <em>underfits</em>. This occurs via the so-called “resolution limit”: in a connected network<sup>1</sup> the method cannot find more than <img src="https://latex.codecogs.com/png.latex?%5Csqrt%7B2E%7D"> communities <span class="citation" data-cites="fortunato_resolution_2007">&nbsp;[6]</span>, even if they seem intuitive or can be found by other methods. An example of this is shown in Figure&nbsp;2, where for a network generated with the SBM containing 30 communities, modularity maximization finds only 18, while an inferential approach has no problems finding the true structure. There are attempts to counteract the resolution limit by introducing a “resolution parameter” to the modularity function, but they are in general ineffective <span class="citation" data-cites="peixoto_descriptive_2023">&nbsp;[see 1]</span>.</p>
<div class="no-row-height column-margin column-container"><div id="fn1"><p><sup>1</sup>&nbsp;Modularity maximization, like many descriptive community detection methods, will always place connected components in different communities. This is another clear distinction with inferential approaches, since fully random models—without latent community structure—can generate disconnected networks if they are sufficiently sparse. From an inferential point of view, it is therefore incorrect to assume that every connected component must belong to a different community.</p></div></div><div id="fig-resolution" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-resolution-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://skewed.de/lab/posts/modularity-harmful/modularity_resolution.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-resolution-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: The resolution limit of modularity maximization prevents small communities from being identified, even if there is sufficient statistical evidence to support them. Panel (a) shows a network with <img src="https://latex.codecogs.com/png.latex?B%E2%80%84=%E2%80%8430"> communities sampled from an assortative SBM parametrization. The colors indicate the <img src="https://latex.codecogs.com/png.latex?18"> communities found with modularity maximization, where several pairs of true communities are merged together. Panel (b) shows the inference result of an assortative SBM <span class="citation" data-cites="zhang_statistical_2020">&nbsp;[11]</span>, recovering the true communities with perfect accuracy. Panels (c) and (d) show the results for a similar model where a larger community has been introduced. In (c) we see the results of modularity maximization, which not only merges the smaller communities together, but also splits the larger community into several spurious ones — thus both underfitting and overfitting different parts of the network at the same time. In (d) we see the result obtained by inferring the SBM, which once again finds the correct answer.
</figcaption>
</figure>
</div>
<p>These two problems—overfitting and underfitting—can occur in tandem, such that portions of the network dominated by randomness are spuriously revealed to contain communities, whereas other portions with clear modular structure can have those obstructed. The result is a very unreliable method to capture the structure of heterogeneous networks. We demonstrate this in Figure&nbsp;2 (c) and (d)</p>
<p>In addition to these major problems, modularity maximization also often possesses a degenerate landscape of solutions, with very different partitions having similar values of <img src="https://latex.codecogs.com/png.latex?Q(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)"> <span class="citation" data-cites="good_performance_2010">&nbsp;[7]</span>. In these situations the partition with maximum value of modularity can be a poor representative of the entire set of high-scoring solutions and depend on idiosyncratic details of the data rather than general patterns—which can be interpreted as a different kind of overfitting.</p>
<p>The combined effects of underfitting and overfitting can make the results obtained with the method unreliable and difficult to interpret. As a demonstration of the systematic nature of the problem, in Figure&nbsp;3 (a) we show the number of communities obtained using modularity maximization for 263 empirical networks of various sizes and belonging to different domains, obtained from the <a href="https://networks.skewed.de">Netzschleuder repository</a>. Since the networks considered are all connected, the values are always below <img src="https://latex.codecogs.com/png.latex?%5Csqrt%7B2E%7D">, due to the resolution limit; but otherwise they are well distributed over the allowed range. However, in Figure&nbsp;3 (b) we show the same analysis, but for a version of each network that is fully randomized, while preserving the degree sequence. In this case, the number of groups remains distributed in the same range (sometimes even exceeding the resolution limit, because the randomized versions can end up disconnected). As Figure&nbsp;3 (c) shows, the number of groups found for the randomized networks is strongly correlated with the original ones, despite the fact that the former have no latent community structure. This is a strong indication of the substantial amount of noise that is incorporated into the partitions found with the method.</p>
<div id="fig-Qrand" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-Qrand-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://skewed.de/lab/posts/modularity-harmful/modularity_random.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Qrand-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;3: Modularity maximization incorporates a substantial amount of noise into its results. (a) Number of groups found using modularity maximization for 263 empirical networks as a function of the number of edges. The dashed line corresponds to the <img src="https://latex.codecogs.com/png.latex?%5Csqrt%7B2E%7D"> upper bound due to the resolution limit. (b) The same as in (a) but with randomized versions of each network. (c) Correspondence between the number of groups of the original and randomized network. The dashed line shows the diagonal.
</figcaption>
</figure>
</div>
<p>The systematic overfitting of modularity maximization—as well as other descriptive methods such as Infomap—has been also demonstrated recently in <span class="citation" data-cites="ghasemian_evaluating_2019">&nbsp;[12]</span>, from the point of view of edge prediction, on a separate empirical dataset of 572 networks from various domains.</p>
<p>Although many of the problems with modularity maximization were long known, for some time there were no principled solutions to them, but this is no longer the case. In the table below we summarize some of the main problems with modularity and how they are solved with inferential approaches.</p>
<table class="caption-top table">
<colgroup>
<col style="width: 48%">
<col style="width: 50%">
</colgroup>
<tbody>
<tr class="odd">
<td style="text-align: left;"><strong>Problem</strong></td>
<td style="text-align: left;"><strong>Principled solution via inference</strong></td>
</tr>
<tr class="even">
<td style="text-align: left;">Modularity maximization overfits, and finds modules in fully random networks. <span class="citation" data-cites="guimera_modularity_2004">&nbsp;[5]</span></td>
<td style="text-align: left;">Bayesian inference of the SBM is designed from the ground to avoid this problem in a principled way and systematically succeeds <span class="citation" data-cites="peixoto_bayesian_2019">&nbsp;[13]</span>.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Modularity maximization has a resolution limit, and finds at most <img src="https://latex.codecogs.com/png.latex?%5Csqrt%7B2E%7D"> groups in connected networks <span class="citation" data-cites="fortunato_resolution_2007">&nbsp;[6]</span></td>
<td style="text-align: left;">Inferential approaches with hierarchical priors <span class="citation" data-cites="peixoto_hierarchical_2014">&nbsp;[14]</span> <span class="citation" data-cites="peixoto_nonparametric_2017">&nbsp;[15]</span> or strictly assortative structures <span class="citation" data-cites="zhang_statistical_2020">&nbsp;[11]</span> do not have any appreciable resolution limit, and can find a maximum number of groups that scales as <img src="https://latex.codecogs.com/png.latex?O(N/%5Clog%20N)">. Importantly, this is achieved without sacrificing the robustness against overfitting.</td>
</tr>
<tr class="even">
<td style="text-align: left;">Modularity maximization has a characteristic scale, and tends to find communities of similar size; in particular with the same sum of degrees.</td>
<td style="text-align: left;">Hierarchical priors can be specifically chosen to be <em>a priori</em> agnostic about characteristic sizes, densities of groups and degree sequences <span class="citation" data-cites="peixoto_nonparametric_2017">&nbsp;[15]</span>, such that these are not imposed, but instead obtained from inference, in an unbiased way.</td>
</tr>
<tr class="odd">
<td style="text-align: left;">Modularity maximization can only find strictly assortative communities.</td>
<td style="text-align: left;">Inferential approaches can be based on any generative model. The general SBM will find any kind of mixing pattern in an unbiased way, and has no problems identifying modular structure in bipartite networks, core-periphery networks, and any mixture of these or other patterns. There are also specialized versions for bipartite <span class="citation" data-cites="larremore_efficiently_2014">&nbsp;[16]</span>, core-periphery <span class="citation" data-cites="zhang_identification_2015">&nbsp;[17]</span>, and assortative patterns <span class="citation" data-cites="zhang_statistical_2020">&nbsp;[11]</span>, if these are being searched exclusively.</td>
</tr>
<tr class="even">
<td style="text-align: left;">The solution landscape of modularity maximization is often degenerate, with many different solutions with close to the same modularity value <span class="citation" data-cites="good_performance_2010">&nbsp;[7]</span>, and with no clear way of how to select between them.</td>
<td style="text-align: left;">Inferential methods are characterized by a posterior distribution of partitions. The consensus or dissensus between the different solutions <span class="citation" data-cites="peixoto_revealing_2021">&nbsp;[18]</span> can be used to determine how many cohesive hypotheses can be extracted from inference, and to what extent is the model being used a poor or a good fit for the network.</td>
</tr>
</tbody>
</table>
<p>Because of the above problems, the use of modularity maximization should be discouraged, since it is demonstrably not fit for purpose as an inferential method. As a consequence, the use of modularity maximization in any recent network analysis can be arguably considered a “red flag” that strongly indicates methodological carelessness. In the absence of secondary evidence supporting the alleged community structures found, or extreme care to counteract the several limitations of the method, the safest assumption is that the results obtained with that method tend to contain a substantial amount of noise, rendering any inferential conclusion derived from them highly suspicious.</p>
<p>As a final note, we focus on modularity here not only for its widespread adoption but also because of its emblematic character. At a fundamental level, all of its shortcoming are shared with any descriptive method in the literature—to varied but always non-negligible degrees.</p>
<section id="references" class="level4">
<h4 class="anchored" data-anchor-id="references">References</h4>
<div id="refs" class="references csl-bib-body" data-entry-spacing="0">
<div id="ref-peixoto_descriptive_2023" class="csl-entry">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1017/9781009118897">Descriptive Vs. <span>Inferential Community Detection</span> in <span>Networks</span>: <span>Pitfalls</span>, <span>Myths</span> and <span>Half-Truths</span></a></em>, Elements in the Structure and Dynamics of Complex Networks (2023).</div>
</div>
<div id="ref-newman_modularity_2006" class="csl-entry">
<div class="csl-left-margin">[2] </div><div class="csl-right-inline">M. E. J. Newman, <em><a href="https://doi.org/10.1073/pnas.0601602103">Modularity and Community Structure in Networks</a></em>, Proceedings of the National Academy of Sciences <strong>103</strong>, 8577 (2006).</div>
</div>
<div id="ref-fosdick_configuring_2018" class="csl-entry">
<div class="csl-left-margin">[3] </div><div class="csl-right-inline">B. Fosdick, D. Larremore, J. Nishimura, and J. Ugander, <em><a href="https://doi.org/10.1137/16M1087175">Configuring <span>Random Graph Models</span> with <span>Fixed Degree Sequences</span></a></em>, SIAM Review <strong>60</strong>, 315 (2018).</div>
</div>
<div id="ref-chung_connected_2002" class="csl-entry">
<div class="csl-left-margin">[4] </div><div class="csl-right-inline">F. Chung and L. Lu, <em><a href="https://doi.org/10.1007/PL00012580">Connected <span>Components</span> in <span>Random Graphs</span> with <span>Given Expected Degree Sequences</span></a></em>, Annals of Combinatorics <strong>6</strong>, 125 (2002).</div>
</div>
<div id="ref-guimera_modularity_2004" class="csl-entry">
<div class="csl-left-margin">[5] </div><div class="csl-right-inline">R. Guimerà, M. Sales-Pardo, and L. A. N. Amaral, <em><a href="https://doi.org/10.1103/PhysRevE.70.025101">Modularity from Fluctuations in Random Graphs and Complex Networks</a></em>, Physical Review E <strong>70</strong>, 025101 (2004).</div>
</div>
<div id="ref-fortunato_resolution_2007" class="csl-entry">
<div class="csl-left-margin">[6] </div><div class="csl-right-inline">S. Fortunato and M. Barthélemy, <em><a href="https://doi.org/10.1073/pnas.0605965104">Resolution Limit in Community Detection</a></em>, Proceedings of the National Academy of Sciences <strong>104</strong>, 36 (2007).</div>
</div>
<div id="ref-good_performance_2010" class="csl-entry">
<div class="csl-left-margin">[7] </div><div class="csl-right-inline"><span class="nocase">B. H. Good, Y.-A. de Montjoye, and A. Clauset</span>, <em><a href="https://doi.org/10.1103/PhysRevE.81.046106">Performance of Modularity Maximization in Practical Contexts</a></em>, Physical Review E <strong>81</strong>, 046106 (2010).</div>
</div>
<div id="ref-fortunato_community_2010" class="csl-entry">
<div class="csl-left-margin">[8] </div><div class="csl-right-inline">S. Fortunato, <em><a href="https://doi.org/16/j.physrep.2009.11.002">Community Detection in Graphs</a></em>, Physics Reports <strong>486</strong>, 75 (2010).</div>
</div>
<div id="ref-fortunato_community_2016" class="csl-entry">
<div class="csl-left-margin">[9] </div><div class="csl-right-inline">S. Fortunato and D. Hric, <em><a href="https://doi.org/10.1016/j.physrep.2016.09.002">Community Detection in Networks: <span>A</span> User Guide</a></em>, Physics Reports (2016).</div>
</div>
<div id="ref-newman_mixing_2003" class="csl-entry">
<div class="csl-left-margin">[10] </div><div class="csl-right-inline">M. E. J. Newman, <em><a href="http://link.aps.org/abstract/PRE/v67/e026126">Mixing Patterns in Networks</a></em>, Phys. Rev. E <strong>67</strong>, 026126 (2003).</div>
</div>
<div id="ref-zhang_statistical_2020" class="csl-entry">
<div class="csl-left-margin">[11] </div><div class="csl-right-inline">L. Zhang and T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevResearch.2.043271">Statistical Inference of Assortative Community Structures</a></em>, Physical Review Research <strong>2</strong>, 043271 (2020).</div>
</div>
<div id="ref-ghasemian_evaluating_2019" class="csl-entry">
<div class="csl-left-margin">[12] </div><div class="csl-right-inline">A. Ghasemian, H. Hosseinmardi, and A. Clauset, <em><a href="https://doi.org/10.1109/TKDE.2019.2911585">Evaluating <span>Overfit</span> and <span>Underfit</span> in <span>Models</span> of <span>Network Community Structure</span></a></em>, IEEE Transactions on Knowledge and Data Engineering 1 (2019).</div>
</div>
<div id="ref-peixoto_bayesian_2019" class="csl-entry">
<div class="csl-left-margin">[13] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1002/9781119483298.ch11">Bayesian <span>Stochastic Blockmodeling</span></a></em>, in <em>Advances in <span>Network Clustering</span> and <span>Blockmodeling</span></em> (John Wiley &amp; Sons, Ltd, 2019), pp. 289–332.</div>
</div>
<div id="ref-peixoto_hierarchical_2014" class="csl-entry">
<div class="csl-left-margin">[14] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevX.4.011047">Hierarchical <span>Block Structures</span> and <span>High-Resolution Model Selection</span> in <span>Large Networks</span></a></em>, Physical Review X <strong>4</strong>, 011047 (2014).</div>
</div>
<div id="ref-peixoto_nonparametric_2017" class="csl-entry">
<div class="csl-left-margin">[15] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevE.95.012317">Nonparametric <span>Bayesian</span> Inference of the Microcanonical Stochastic Block Model</a></em>, Physical Review E <strong>95</strong>, 012317 (2017).</div>
</div>
<div id="ref-larremore_efficiently_2014" class="csl-entry">
<div class="csl-left-margin">[16] </div><div class="csl-right-inline">D. B. Larremore, A. Clauset, and A. Z. Jacobs, <em><a href="https://doi.org/10.1103/PhysRevE.90.012805">Efficiently Inferring Community Structure in Bipartite Networks</a></em>, Physical Review E <strong>90</strong>, 012805 (2014).</div>
</div>
<div id="ref-zhang_identification_2015" class="csl-entry">
<div class="csl-left-margin">[17] </div><div class="csl-right-inline">X. Zhang, T. Martin, and M. E. J. Newman, <em><a href="https://doi.org/10.1103/PhysRevE.91.032803">Identification of Core-Periphery Structure in Networks</a></em>, Physical Review E <strong>91</strong>, 032803 (2015).</div>
</div>
<div id="ref-peixoto_revealing_2021" class="csl-entry">
<div class="csl-left-margin">[18] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevX.11.021003">Revealing <span>Consensus</span> and <span>Dissensus</span> Between <span>Network Partitions</span></a></em>, Physical Review X <strong>11</strong>, 021003 (2021).</div>
</div>
</div>
<hr>
</section>
<section id="comments" class="level4">
<h4 class="anchored" data-anchor-id="comments">Comments</h4>
<p>(Comments may be moderated.)</p>
<div class="discourse-excerpt" style="display: none">
<p>If you reply to this post, it will show as a comment below the original article.</p>
</div>
<div id="discourse-comments"></div>
<meta name="discourse-username" content="tiago">

<script type="text/javascript">

  const discourse_url = "https://forum.skewed.de";

  // Here, we determine the theme, and send a message to the iframe to let it know what the theme is
  // See below for how we hook up notifyFrameStyle 
  const notifyIFrameOfTheme = () => {
    const iframe = document.getElementById("discourse-embed-frame");
    if (document.body.classList.contains("quarto-dark")) {
      theme = "dark";
    } else {
      theme = "light";
    }

    if (iframe && iframe.contentWindow) {
      iframe.contentWindow.postMessage(
        {
          // Modify the line below to grab dark mode setting, depending on how you store it
          theme: theme
        },
        discourse_url
      );
    }
  };

  // Call setFrameStyle when we receive the "iframe loaded" message
  const handleMessageListener = (event) => {
    var origin = event.origin;
    if ((origin === discourse_url) && (event.data == "iframe loaded")) {
      notifyIFrameOfTheme();
    }
  };

  DiscourseEmbed = {
    discourseUrl: 'https://forum.skewed.de/',
    discourseEmbedUrl: 'https://skewed.de/lab/posts/modularity-harmful/',
    //className: 'discourse-excerpt',
  };
  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();

  window.addEventListener("message", handleMessageListener);
</script>
</section>
<section id="webmentionswebmentions" class="level4">
<h4 class="anchored" data-anchor-id="webmentionswebmentions">Webmentions<sup>2</sup></h4>
<div id="nomention">
<p>(Nothing yet)</p>
</div>
<div class="mentionsio">
<ul id="facepile">
</ul>
<ul id="reposts">
</ul>
<ul id="mentions">
</ul>
</div>


</section>
<div class="no-row-height column-margin column-container"><div id="fn2"><p><sup>2</sup>&nbsp;<a href="https://indieweb.org/Webmention">Webmention</a> is a standardized decentralized mechanism for conversations and interactions across the web.</p></div></div>

</div> ]]></description>
  <category>community detection</category>
  <category>modularity</category>
  <category>inference</category>
  <category>Bayes</category>
  <category>SBM</category>
  <guid>https://skewed.de/lab/posts/modularity-harmful/</guid>
  <pubDate>Sun, 05 Dec 2021 23:00:00 GMT</pubDate>
  <media:content url="https://skewed.de/lab/posts/modularity-harmful/modularity_fail.png" medium="image" type="image/png" height="52" width="144"/>
</item>
<item>
  <title>Inferring, explaining, and compressing</title>
  <dc:creator>Tiago P. Peixoto</dc:creator>
  <link>https://skewed.de/lab/posts/inference-compression/</link>
  <description><![CDATA[ 

<div class="h-entry e-content entry-content page-columns page-full">




<div class="page-columns page-full"><p></p><div class="no-row-height column-margin column-container"><span class="margin-aside">This is a continuation of the <a href="../../descriptive-inferential">previous blog post</a>, and slightly modified version of chapter II in <span class="citation" data-cites="peixoto_descriptive_2023">&nbsp;[1]</span>.</span></div></div>
<p>Inferential approaches to community detection (see <span class="citation" data-cites="peixoto_bayesian_2019">&nbsp;[2]</span> for a detailed introduction) are designed to provide explanations for network data in a principled manner. They are based on the formulation of generative models that include the notion of community structure in the rules of how the edges are placed. More formally, they are based on the definition of a likelihood <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20b%7D)"> for the network <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20A%7D"> conditioned on a partition <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20b%7D">, and the inference is obtained via the posterior distribution, according to Bayes' rule, i.e.</p>
<p><span id="eq-bayes"><img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20b%7D%7C%7B%5Cboldsymbol%20A%7D)%20=%20%5Cfrac%7BP(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%0Ab%7D)P(%7B%5Cboldsymbol%20b%7D)%7D%7BP(%7B%5Cboldsymbol%20A%7D)%7D,%20%5Ctag%7B1%7D"></span></p>
<p>where <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20b%7D)"> is the prior probability for a partition <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20b%7D">. Overwhelmingly, the models used for this purpose are variations of the stochastic block model (SBM) <span class="citation" data-cites="holland_stochastic_1983">&nbsp;[3]</span>, where in addition to the node partition, it takes the probability of edges being placed between the different groups as an additional set of parameters. A particularly expressive variation is the degree-corrected SBM (DC-SBM) <span class="citation" data-cites="karrer_stochastic_2011">&nbsp;[4]</span>, with a marginal likelihood given by <span class="citation" data-cites="peixoto_nonparametric_2017">&nbsp;[5]</span>.</p>
<p><span id="eq-dcsbm-marginal"><img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20b%7D)%20=%20%5Csum_%7B%5Cboldsymbol%20e,%20%5Cboldsymbol%0Ak%7DP(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20k%7D,%7B%5Cboldsymbol%20e%7D,%7B%5Cboldsymbol%0Ab%7D)P(%7B%5Cboldsymbol%20k%7D%7C%7B%5Cboldsymbol%20e%7D,%7B%5Cboldsymbol%20b%7D)P(%7B%5Cboldsymbol%0Ae%7D%7C%7B%5Cboldsymbol%20b%7D),%20%5Ctag%7B2%7D"></span></p>
<p>where <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20e%7D=%5C%7Be_%7Brs%7D%5C%7D"> is a matrix with elements <img src="https://latex.codecogs.com/png.latex?e_%7Brs%7D"> specifying how many edges go between groups <img src="https://latex.codecogs.com/png.latex?r"> and <img src="https://latex.codecogs.com/png.latex?s">, and <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20k=%5C%7Bk_i%5C%7D"> are the degrees of the nodes. Therefore, this model specifies that, conditioned on a partition <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20b%7D">, first the edge counts <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20e%7D"> are sampled from a prior distribution <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%0Ae%7D%7C%7B%5Cboldsymbol%20b%7D)">, followed by the degrees from the prior <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20k%7D%7C%7B%5Cboldsymbol%20e%7D,%7B%5Cboldsymbol%20b%7D)">, and finally the network is wired together according to the probability <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20k%7D,%7B%5Cboldsymbol%20e%7D,%7B%5Cboldsymbol%0Ab%7D)">, which respects the constraints given by <img src="https://latex.codecogs.com/png.latex?%5Cboldsymbol%20k">, <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20e%7D">, and <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20b%7D">. See Figure&nbsp;1 (a) for a illustration of this process.</p>
<div id="fig-dcsbm" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-dcsbm-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://skewed.de/lab/posts/inference-compression/generative.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-dcsbm-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Inferential community detection considers a generative process (a),where the unobserved model parameters are sampled from prior distributions. In the case of the DC-SBM, these are the priors for the partition <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20b%7D)">, the number of edges between groups <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20e%7D%7C%7B%5Cboldsymbol%20b%7D)">, and the node degrees, <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20k%7D%7C%7B%5Cboldsymbol%20e%7D,%7B%5Cboldsymbol%20b%7D)">. Finally, the network itself is sampled from its model, <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%0Ak%7D,%7B%5Cboldsymbol%20e%7D,%7B%5Cboldsymbol%20b%7D)">. The inference procedure (b) consists on inverting the generative process given an observed network <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20A%7D">, corresponding to a posterior distribution <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20b%7D%7C%7B%5Cboldsymbol%20A%7D)">, which then can be summarized by a marginal probability that a node belongs to a given group (represented as pie charts on the nodes).
</figcaption>
</figure>
</div>
<p>This model formulation includes fully random networks as the special case when we have a single group. Together with the Bayesian approach, the use of this model will inherently favor a more parsimonious account of the data, whenever it does not warrant a more complex description — amounting to a formal implementation of Occam's razor. This is best seen by making a formal connection with information theory, and noticing that we can write the numerator of Equation&nbsp;1 as</p>
<p><img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20b%7D)P(%7B%5Cboldsymbol%20b%7D)%20=%202%5E%7B-%5CSigma(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)%7D,"></p>
<p>where the quantity <img src="https://latex.codecogs.com/png.latex?%5CSigma(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)"> is known as the <em>description length</em> <span class="citation" data-cites="grunwald_minimum_2007">&nbsp;[6]</span> of the network. It is computed as:<sup>1</sup></p>
<div class="no-row-height column-margin column-container"><div id="fn1"><p><sup>1</sup>&nbsp;Note that the sum in Equation&nbsp;2 vanishes because only one term is non-zero given a fixed network <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20A%7D">.</p></div></div><p><span id="eq-dl_dcsbm"><img src="https://latex.codecogs.com/png.latex?%5CSigma(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)%20=%20%5Cunderset%7B%5Cmathcal%7BD%7D(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20k%7D,%7B%5Cboldsymbol%20e%7D,%7B%5Cboldsymbol%20b%7D)%7D%7B%5Cunderbrace%7B-%5Clog_2P(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20k%7D,%7B%5Cboldsymbol%20e%7D,%7B%5Cboldsymbol%20b%7D)%7D%7D%5C,%0A%5Cunderset%7B%5Cmathcal%7BM%7D(%7B%5Cboldsymbol%20k%7D,%7B%5Cboldsymbol%20e%7D,%7B%5Cboldsymbol%20b%7D)%7D%7B%5Cunderbrace%7B-%5Clog_2P(%7B%5Cboldsymbol%20k%7D%7C%7B%5Cboldsymbol%20e%7D,%7B%5Cboldsymbol%20b%7D)%20-%20%5Clog_2%20P(%7B%5Cboldsymbol%20e%7D%7C%7B%5Cboldsymbol%20b%7D)%20-%20%5Clog_2P(%7B%5Cboldsymbol%20b%7D)%7D%7D.%20%5Ctag%7B3%7D"></span></p>
<p>The second set of terms <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BM%7D(%7B%5Cboldsymbol%20k%7D,%7B%5Cboldsymbol%0Ae%7D,%7B%5Cboldsymbol%20b%7D)"> in the above equation quantifies the amount of information in bits necessary to encode the parameters of the model <sup>2</sup>. The first term <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BD%7D(%7B%5Cboldsymbol%0AA%7D%7C%7B%5Cboldsymbol%20k%7D,%7B%5Cboldsymbol%20e%7D,%7B%5Cboldsymbol%20b%7D)"> determines how many bits are necessary to encode the network itself, once the model parameters are known. This means that if Bob wants to communicate to Alice the structure of a network <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20A%7D">, he first needs to transmit <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BM%7D(%7B%5Cboldsymbol%20k%7D,%7B%5Cboldsymbol%0Ae%7D,%7B%5Cboldsymbol%20b%7D)"> bits of information to describe the parameters <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20b%7D">, <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20e%7D">, and <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20k%7D">, and then finally transmit the remaining <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BD%7D(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20k%7D,%7B%5Cboldsymbol%0Ae%7D,%7B%5Cboldsymbol%20b%7D)"> bits to describe the network itself. Then, Alice will be able to understand the message by first decoding the parameters <img src="https://latex.codecogs.com/png.latex?(%7B%5Cboldsymbol%20k%7D,%7B%5Cboldsymbol%20e%7D,%7B%5Cboldsymbol%20b%7D)"> from the first part of the message, and using that knowledge to obtain the network <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20A%7D"> from the second part, without any errors.</p>
<div class="no-row-height column-margin column-container"><div id="fn2"><p><sup>2</sup>&nbsp;If a value <img src="https://latex.codecogs.com/png.latex?x"> occurs with probability <img src="https://latex.codecogs.com/png.latex?P(x)">, this means that in order to transmit it in a communication channel we need to answer at least <img src="https://latex.codecogs.com/png.latex?-%5Clog_2P(x)"> yes-or-no questions to decode its value exactly. Therefore we need to answer one yes-or-no question for a value with <img src="https://latex.codecogs.com/png.latex?P(x)=1/2">, zero questions for <img src="https://latex.codecogs.com/png.latex?P(x)=1">, and <img src="https://latex.codecogs.com/png.latex?%5Clog_2N"> questions for uniformly distributed values with <img src="https://latex.codecogs.com/png.latex?P(x)=1/N">. This value is called “information content”, and essentially measures the degree of “surprise” when encountering a value sampled from a distribution. See <span class="citation" data-cites="mackay_information_2003">&nbsp;[7]</span> for a thorough but accessible introduction to information theory and its relation to inference.</p></div></div><p>What the above connection shows is that there is a formal equivalence between <em>inferring</em> the communities of a network and <em>compressing</em> it. This happens because finding the most likely partition <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20b%7D"> from the posterior <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%0Ab%7D%7C%7B%5Cboldsymbol%20A%7D)"> is equivalent to minimizing the description length <img src="https://latex.codecogs.com/png.latex?%5CSigma(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)"> used by Bob to transmit a message to Alice containing the whole network.</p>
<p>Data compression amounts to formal implementation of Occam's razor because it penalizes models that are too complicated: if we want to describe a network using many communities, then the model part of the description length <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BM%7D(%7B%5Cboldsymbol%20k%7D,%7B%5Cboldsymbol%20e%7D,%7B%5Cboldsymbol%20b%7D)"> will be large, and Bob will need many bits to transmit the model parameters to Alice. However, increasing the complexity of the model will also <span class="title-ref">reduce</span> the first term <img src="https://latex.codecogs.com/png.latex?%5Cmathcal%7BD%7D(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20k%7D,%7B%5Cboldsymbol%20e%7D,%7B%5Cboldsymbol%0Ab%7D)">, since there are fewer networks that are compatible with the bigger set of constraints, and hence Bob will need a shorter second part of the message to convey the network itself once the parameters are known. Compression (and hence inference), therefore, is a balancing act between model complexity and quality of fit, where an increase in the former is <em>only</em> justified when it results in <em>an even larger</em> increase of the second, such that the total description length is minimized.</p>
<p>The reason why the compression approach avoids overfitting the data is due to a powerful fact from information theory, known as <a href="https://en.wikipedia.org/wiki/Shannon%27s_source_coding_theorem">Shannon's source coding theorem</a> <span class="citation" data-cites="shannon_mathematical_1948">&nbsp;[8]</span>, which states that it is impossible to compress data sampled from a distribution <img src="https://latex.codecogs.com/png.latex?P(x)"> using fewer bits per symbol than the entropy of the distribution, <img src="https://latex.codecogs.com/png.latex?H=-%5Csum_xP(x)%5Clog_2P(x)">. In our context, this means that it is impossible, for example, to compress a fully random network using a SBM with more than one group.<sup>3</sup> This means, for example, that when encountered with an example like in the figure we considered in the previous <a href="../descriptive-inferential#fig-infvsdesc">blog post</a>, inferential methods will detect a single community comprising all nodes in the network, since any further division does not provide any increased compression, or equivalently, no augmented explanatory power. From the inferential point of view, a partition like in the <a href="../descriptive-inferential#fig-generation">previous figure</a> (b) <em>overfits</em> the data, since it incorporates irrelevant random features — a.k.a. “noise” — into its description.</p>
<div class="no-row-height column-margin column-container"><div id="fn3"><p><sup>3</sup>&nbsp;More accurately, this becomes impossible only when the network becomes asymptotically infinite; for finite networks the probability of compression is only vanishingly small.</p></div></div><p>In Figure&nbsp;2 (a) is shown an example of the results obtained with an inferential community detection algorithm, for a network sampled from the SBM. As shown in Figure&nbsp;2 (b), the obtained partitions are still valid when carried over to an independent sample of the model, because the algorithm is capable of separating the general underlying pattern from the random fluctuations. As a consequence of this separability, this kind of algorithm does not find communities in fully random networks, which are composed only of “noise.”</p>
<div id="fig-inferential" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-inferential-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://skewed.de/lab/posts/inference-compression/sbm.png" class="img-fluid figure-img">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-inferential-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: Inferential community detection aims to find a partition of the network according to a fit of a generative model that can explain its structure. In (a) is shown a network sampled from a stochastic block model (SBM) with 6 groups, and where the group assignments were hidden from view. The node colors show the groups found via Bayesian inference of the SBM. In (b) is shown another network sampled from same SBM, together with the same partition found in (a), showing that it carries a substantial explanatory power.
</figcaption>
</figure>
</div>
<section id="role-of-inferential-approaches-in-community-detection" class="level3">
<h3 class="anchored" data-anchor-id="role-of-inferential-approaches-in-community-detection">Role of inferential approaches in community detection</h3>
<p>Inferential approaches based on the SBM have an old history, and were introduced for the study of social networks in the early 80's <span class="citation" data-cites="holland_stochastic_1983">&nbsp;[3]</span>. But despite such an old age, and having appeared repeatedly in the literature over the years (also under different names in other contexts), they entered the mainstream community detection literature rather late, arguably after the influential paper by Karrer and Newman that introduced the DC-SBM <span class="citation" data-cites="karrer_stochastic_2011">&nbsp;[4]</span> in 2011, at a point where descriptive approaches were already dominating. However, despite the dominance of descriptive methods, the existence of inferential <em>criteria</em> was already long noticeable. In fact, in a well-known attempt to systematically compare the quality of a variety of descriptive community detection methods, the authors of <span class="citation" data-cites="lancichinetti_benchmark_2008">&nbsp;[9]</span> proposed the now so-called LFR benchmark, offered as a more realistic alternative to the simpler Newman-Girvan benchmark <span class="citation" data-cites="girvan_community_2002">&nbsp;[10]</span> introduced earlier. Both are in fact generative models, essentially particular cases of the DC-SBM, containing a “ground truth” community label assignment, against which the results of various algorithms are supposed to be compared. Clearly, this is an inferential evaluation criterion, although, historically, virtually all of the methods compared against that benchmark are descriptive in nature <span class="citation" data-cites="lancichinetti_community_2009">&nbsp;[11]</span> (these studies were conducted mostly before inferential approaches had gained more traction). The use of such a criterion already betrays that the answer to the <a href="../descriptive-inferential#litmus">litmus test</a> considered in the previous post would be “yes,” and therefore descriptive approaches are fundamentally unsuitable for the task. In contrast, methods based on statistical inference are not only more principled, but in fact provably optimal in the inferential scenario, in the sense that all conceivable algorithms can obtain either equal or worse performance, but none can do better <span class="citation" data-cites="decelle_asymptotic_2011">&nbsp;[12]</span>.</p>
<p>The conflation one often finds between descriptive and inferential goals in the literature of community detection likely stems from the fact that while it is easy to define benchmarks in the inferential setting, it is substantially more difficult to do so in a descriptive setting. Given any descriptive method (modularity maximization, Infomap, Markov stability, etc.) it is usually problematic to determine for which network these methods are optimal (or even if one exists), and what would be a canonical output that would be unambiguously correct. In fact, the difficulty with establishing these fundamental references already serve as evidence that the task itself is ill-defined. On the other hand, taking an inferential route forces one to <em>start with the right answer</em>, via a well-specified generative model that articulates what <em>the communities actually mean</em> with respect to the network structure. Based on this precise definition, one then <em>derives</em> the optimal detection method by employing Bayes' rule.</p>
<p>It is also useful to observe that inferential analyses of aspects of the network other than directly its structure might still be only descriptive of the structure itself. A good example of this is the modelling of dynamics that take place on a network, such as a random walk. This is precisely the case of the <a href="https://www.mapequation.org">Infomap method</a>, which models a simulated teleporting random walk on a network in an inferential manner, using for that a division of the network into groups. While this approach can be considered inferential with respect to an artificial dynamics, it is still only descriptive when it comes to the actual network structure (and will suffer the same problems, such a finding communities in fully random networks). Communities found in this way could be useful for particular tasks, such as to identify groups of nodes that would be similarly affected by a diffusion process. This could be used, for example, to prevent or facilitate the diffusion by removing or adding edges between the identified groups. In this setting, the answer to the <a href="../descriptive-inferential#litmus">litmus test</a> would also be “no”, since what is important is how the network “is” (i.e.&nbsp;how a random walk behaves on it), not how it came to be, or if its features are there by chance alone. Once more, the important issue to remember is that the groups identified in this manner cannot be interpreted as having any explanatory power about the network structure itself, and cannot be used reliably to extract inferential conclusions from it. We are firmly in a descriptive, not inferential setting with respect to the network structure.</p>
<p>Another important difference between inferential and descriptive approaches is worth mentioning. Descriptive approaches are tied to very particular contexts, and cannot be directly compared to one another. This has caused great consternation in the literature, since there is a vast number of such methods, and little robust methodology on how to compare them. Indeed, why should we expect that the modules found by optimizing task scheduling should be comparable to those that optimize the description of a dynamics? In contrast, inferential approaches all share the same underlying context: they attempt to explain the network structure; they vary only in how this is done. They are, therefore, amenable to principled <em>model selection</em> procedures, designed to evaluate which is the most appropriate fit for any particular network, even if the models used operate with very different parametrizations. In this situation, the multiplicity of different models available becomes a boon rather than a hindrance, since they all contribute to a bigger toolbox we have at our disposal when trying to understand empirical observations.</p>
<p>Finally, inferential approaches offer additional advantages that make them more suitable as part a scientific pipeline. In particular, they can be naturally extended to accommodate measurement uncertainties <span class="citation" data-cites="peixoto_reconstructing_2018">&nbsp;[13]</span> — an unavoidable property of empirical data, which descriptive methods almost universally fail to consider. This information can be used not only to propagate the uncertainties to the community assignments <span class="citation" data-cites="peixoto_revealing_2021">&nbsp;[14]</span> but also to reconstruct the missing or noisy measurements of the network itself <span class="citation" data-cites="guimera_missing_2009">&nbsp;[15]</span>. Furthermore, inferential approaches can be coupled with even more indirect observations such as time-series on the nodes <span class="citation" data-cites="hoffmann_community_2020">&nbsp;[16]</span>, instead of a direct measurement of the edges of the network, such that the network itself is reconstructed, not only the community structure <span class="citation" data-cites="peixoto_network_2019">&nbsp;[17]</span>. All these extensions are possible because inferential approaches give us more than just a division of the network into groups; they give us a model estimate of the network, containing insights about its formation mechanism.</p>
</section>
<section id="behind-every-description-there-is-an-implicit-generative-model" class="level3 page-columns page-full">
<h3 class="anchored" data-anchor-id="behind-every-description-there-is-an-implicit-generative-model">Behind every description there is an implicit generative model</h3>
<p>From a purely mathematical perspective, there is actually no formal distinction between descriptive and inferential methods, because every descriptive method can be mapped to an inferential one, according to some implicit model. Therefore, whenever we are attempting to interpret the results of a descriptive community detection method in an inferential way — i.e.&nbsp;make a statement about how the network came to be — we cannot in fact avoid making <em>implicit</em> assumptions about the model generating process that lies behind it. (At first this statement seems to undermine the distinction we have been making between descriptive and inferential methods, but in fact this is not the case, as we will see below.)</p>
<p>It is not difficult to demonstrate that it is possible to formulate any conceivable community detection method as a particular inferential method. Let us consider an arbitrary quality function</p>
<p><img src="https://latex.codecogs.com/png.latex?W(%7B%5Cboldsymbol%20A%7D,%20%7B%5Cboldsymbol%20b%7D)%20%5Cin%20%5Cmathbb%7BR%7D"></p>
<p>which is used to perform community detection via the optimization</p>
<p><span id="eq-opt"><img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20b%7D%5E*%20=%20%5Cunderset%7B%5Cboldsymbol%20b%7D%7B%5Coperatorname%7Bargmax%7D%7D%5C;%0AW(%7B%5Cboldsymbol%20A%7D,%20%7B%5Cboldsymbol%20b%7D).%20%5Ctag%7B4%7D"></span></p>
<p>We can then interpret the quality function <img src="https://latex.codecogs.com/png.latex?W(%7B%5Cboldsymbol%20A%7D,%0A%7B%5Cboldsymbol%20b%7D)"> as the “Hamiltonian” of a posterior distribution</p>
<p><img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20b%7D%7C%7B%5Cboldsymbol%20A%7D)%20=%20%5Cfrac%7B%5Cmathrm%7Be%7D%5E%7B%5Cbeta%20W(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)%7D%7D%7BZ(%7B%5Cboldsymbol%20A%7D)%7D,"></p>
<p>with normalization <img src="https://latex.codecogs.com/png.latex?Z(%7B%5Cboldsymbol%20A%7D)=%5Csum_%7B%5Cboldsymbol%20b%7D%5Cmathrm%7Be%7D%5E%7B%5Cbeta%20W(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)%7D">. By making <img src="https://latex.codecogs.com/png.latex?%5Cbeta%5Cto%5Cinfty"> we recover the optimization of Equation&nbsp;4, or we may simply try to find the most likely partition according to the posterior, in which case <img src="https://latex.codecogs.com/png.latex?%5Cbeta%3E0"> remains an arbitrary parameter. Therefore, employing Bayes' rule in the opposite direction, we obtain the following effective generative model:</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0A%5Cbegin%7Baligned%7D%0AP(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20b%7D)%0A&amp;=%20%5Cfrac%7BP(%7B%5Cboldsymbol%20b%7D%7C%7B%5Cboldsymbol%20A%7D)P(%7B%5Cboldsymbol%20A%7D)%7D%7BP(%7B%5Cboldsymbol%20b%7D)%7D,%5C%5C%0A&amp;=%20%5Cfrac%7B%5Cmathrm%7Be%7D%5E%7B%5Cbeta%20W(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)%7D%7D%7BZ(%7B%5Cboldsymbol%20A%7D)%7D%5Cfrac%7BP(%7B%5Cboldsymbol%20A%7D)%7D%7BP(%7B%5Cboldsymbol%20b%7D)%7D,%0A%5Cend%7Baligned%7D%0A%5Cend%7Baligned%7D"></p>
<p>where <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20A%7D)%20=%20%5Csum_%7B%5Cboldsymbol%20b%7DP(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20b%7D)P(%7B%5Cboldsymbol%20b%7D)"> is the marginal distribution over networks, and <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20b%7D)"> is the prior distribution for the partition. Due to the normalization of <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20b%7D)"> we have the following constraint that needs to be fulfilled:</p>
<p><span id="eq-wconstraint"><img src="https://latex.codecogs.com/png.latex?%5Csum_%7B%5Cboldsymbol%20A%7D%5Cfrac%7B%5Cmathrm%7Be%7D%5E%7B%5Cbeta%20W(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)%7D%7D%7BZ(%7B%5Cboldsymbol%20A%7D)%7DP(%7B%5Cboldsymbol%20A%7D)%20=%20P(%7B%5Cboldsymbol%20b%7D).%20%5Ctag%7B5%7D"></span></p>
<p>Therefore, not all choices of <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20A%7D)"> and <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20b%7D)"> are compatible with the posterior distribution and the exact possibilities will depend on the actual shape of <img src="https://latex.codecogs.com/png.latex?W(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)">. However, one choice that is always possible is</p>
<p><img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20A%7D)%20=%20%5Cfrac%7BZ(%7B%5Cboldsymbol%20A%7D)%7D%7B%5CXi%7D,%5Cqquad%20P(%7B%5Cboldsymbol%20b%7D)%20=%20%5Cfrac%7B%5COmega(%7B%5Cboldsymbol%20b%7D)%7D%7B%5CXi%7D,"></p>
<p>with <img src="https://latex.codecogs.com/png.latex?%5COmega(%7B%5Cboldsymbol%20b%7D)=%5Csum_%7B%5Cboldsymbol%20A%7D%5Cmathrm%7Be%7D%5E%7B%5Cbeta%20W(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)%7D"> and <img src="https://latex.codecogs.com/png.latex?%5CXi=%5Csum_%7B%5Cboldsymbol%20A,%5Cboldsymbol%20b%7D%5Cmathrm%7Be%7D%5E%7B%5Cbeta%20W(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)%7D">. Taking this choice leads to the effective generative model</p>
<p><img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20A%7D%7C%7B%5Cboldsymbol%20b%7D)%20=%20%5Cfrac%7B%5Cmathrm%7Be%7D%5E%7B%5Cbeta%20W(%7B%5Cboldsymbol%0AA%7D,%7B%5Cboldsymbol%20b%7D)%7D%7D%7B%5COmega(%7B%5Cboldsymbol%20b%7D)%7D."></p>
<p>Therefore, inferentially interpreting a community detection algorithm with a quality function <img src="https://latex.codecogs.com/png.latex?W(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)"> is equivalent to assuming the generative model <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%0AA%7D%7C%7B%5Cboldsymbol%20b%7D)"> and prior <img src="https://latex.codecogs.com/png.latex?P(%7B%5Cboldsymbol%20b%7D)"> above. Furthermore, this also means that any arbitrary community detection algorithm implies a description length<sup>4</sup> given (in nats) by</p>
<div class="no-row-height column-margin column-container"><div id="fn4"><p><sup>4</sup>&nbsp;The description length of Equation&nbsp;6 is only valid if there are no further parameters in the quality function <img src="https://latex.codecogs.com/png.latex?W(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)"> other than <img src="https://latex.codecogs.com/png.latex?%7B%5Cboldsymbol%20b%7D"> that are being optimized.</p></div></div><p><span id="eq-dl-W"><img src="https://latex.codecogs.com/png.latex?%5CSigma(%7B%5Cboldsymbol%20A%7D,%7B%5Cboldsymbol%20b%7D)%20=%20-%5Cbeta%20W(%7B%5Cboldsymbol%0AA%7D,%7B%5Cboldsymbol%20b%7D)%20+%20%5Cln%5Csum_%7B%5Cboldsymbol%20A',%7B%5Cboldsymbol%20b%7D'%7D%5Cmathrm%7Be%7D%5E%7B%5Cbeta%0AW(%7B%5Cboldsymbol%20A%7D',%7B%5Cboldsymbol%20b%7D')%7D.%20%5Ctag%7B6%7D"></span></p>
<p>What the above shows is that <strong>there is no such thing as a “model-free” community detection method</strong>, since they are all equivalent to the inference of <em>some</em> generative model. The only difference to a direct inferential method is that in that case the modelling assumptions are made explicitly, inviting rather than preventing scrutiny. Most often, the effective model and prior that are equivalent to an <em>ad hoc</em> community detection method will be difficult to interpret, justify, or even compute.</p>
<p>Furthermore there is no guarantee that the obtained description length of Equation&nbsp;6 will yield a competitive or even meaningful compression. In particular, there is no guarantee that this effective inference will not overfit the data. Although we mentioned in the previous section that inference and compression are equivalent, the compression achieved when considering a particular generative model is constrained by the assumptions encoded in its likelihood and prior. If these are poorly chosen, no actual compression might be achieved, for example when comparing to the one obtained with a fully random model. This is precisely what happens with descriptive community detection methods: they overfit because their implicit modelling assumptions do not accommodate the possibility that a network may be fully random, or contain a balanced mixture of structure and randomness.</p>
<p>Since we can always interpret any community detection method as inferential, is it still meaningful to categorize some methods as descriptive? Arguably yes, because directly inferential approaches make their generative models and priors explicit, while for a descriptive method we need to extract them from back-engineering. Explicit modelling allows us to make judicious choices about the model and prior that reflect the kinds of structures we want to detect, relevant scales or lack thereof, and many other aspects that improve their performance in practice, and our understanding of the results. With implicit assumptions we are “flying blind”, relying substantially on serendipity and trial-and-error — not always with great success.</p>
<p>It is not uncommon to find criticisms of inferential methods due to a perceived implausibility of the generative models used — such as the conditional independence of the placement of the edges present in the SBM — although these assumptions are also present, but only <em>implicitly</em>, in other methods, like modularity maximization (see <span class="citation" data-cites="peixoto_descriptive_2023">&nbsp;[1]</span>).</p>
<p>The above inferential interpretation is not specific to community detection, but is in fact valid for any learning problem. The set of explicit or implicit assumptions that must come with any learning algorithm is called an <a href="https://en.wikipedia.org/wiki/Inductive_bias">“inductive bias”</a>. An algorithm is expected to function optimally only if its inductive bias agrees with the actual instances of the problems encountered. It is important to emphasize that no algorithm can be free of an inductive bias, we can only chose <em>which</em> intrinsic assumptions we make about how likely we are to encounter a particular kind of data, not <em>whether</em> we are making an assumption. Therefore, it is particularly problematic when a method does not articulate explicitly what these assumptions are, since even if they are hidden from view, they exist nonetheless, and still need to be scrutinized and justified. This means we should be particularly skeptical of the impossible claim that a learning method is “model free”, since this denomination is more likely to signal an unwillingness to expose the underlying modelling assumptions, which could potentially be revealed as unappealing and fragile when eventually forced to come under scrutiny.</p>
<section id="references" class="level4">
<h4 class="anchored" data-anchor-id="references">References</h4>
<div id="refs" class="references csl-bib-body" data-entry-spacing="0">
<div id="ref-peixoto_descriptive_2023" class="csl-entry">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1017/9781009118897">Descriptive Vs. <span>Inferential Community Detection</span> in <span>Networks</span>: <span>Pitfalls</span>, <span>Myths</span> and <span>Half-Truths</span></a></em>, Elements in the Structure and Dynamics of Complex Networks (2023).</div>
</div>
<div id="ref-peixoto_bayesian_2019" class="csl-entry">
<div class="csl-left-margin">[2] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1002/9781119483298.ch11">Bayesian <span>Stochastic Blockmodeling</span></a></em>, in <em>Advances in <span>Network Clustering</span> and <span>Blockmodeling</span></em> (John Wiley &amp; Sons, Ltd, 2019), pp. 289–332.</div>
</div>
<div id="ref-holland_stochastic_1983" class="csl-entry">
<div class="csl-left-margin">[3] </div><div class="csl-right-inline">P. W. Holland, K. B. Laskey, and S. Leinhardt, <em><a href="https://doi.org/16/0378-8733(83)90021-7">Stochastic Blockmodels: <span>First</span> Steps</a></em>, Social Networks <strong>5</strong>, 109 (1983).</div>
</div>
<div id="ref-karrer_stochastic_2011" class="csl-entry">
<div class="csl-left-margin">[4] </div><div class="csl-right-inline">B. Karrer and M. E. J. Newman, <em><a href="https://doi.org/10.1103/PhysRevE.83.016107">Stochastic Blockmodels and Community Structure in Networks</a></em>, Physical Review E <strong>83</strong>, 016107 (2011).</div>
</div>
<div id="ref-peixoto_nonparametric_2017" class="csl-entry">
<div class="csl-left-margin">[5] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevE.95.012317">Nonparametric <span>Bayesian</span> Inference of the Microcanonical Stochastic Block Model</a></em>, Physical Review E <strong>95</strong>, 012317 (2017).</div>
</div>
<div id="ref-grunwald_minimum_2007" class="csl-entry">
<div class="csl-left-margin">[6] </div><div class="csl-right-inline">P. D. Grünwald, <em>The <span>Minimum Description Length Principle</span></em> (The MIT Press, 2007).</div>
</div>
<div id="ref-mackay_information_2003" class="csl-entry">
<div class="csl-left-margin">[7] </div><div class="csl-right-inline">D. J. C. MacKay, <em>Information <span>Theory</span>, <span>Inference</span> and <span>Learning Algorithms</span></em>, First Edition (Cambridge University Press, 2003).</div>
</div>
<div id="ref-shannon_mathematical_1948" class="csl-entry">
<div class="csl-left-margin">[8] </div><div class="csl-right-inline">C. E. Shannon, <em>A Mathematical Theory of Communication</em>, Bell Syst Tech. J <strong>27</strong>, 623 (1948).</div>
</div>
<div id="ref-lancichinetti_benchmark_2008" class="csl-entry">
<div class="csl-left-margin">[9] </div><div class="csl-right-inline">A. Lancichinetti, S. Fortunato, and F. Radicchi, <em><a href="https://doi.org/10.1103/PhysRevE.78.046110">Benchmark Graphs for Testing Community Detection Algorithms</a></em>, Physical Review E <strong>78</strong>, 046110 (2008).</div>
</div>
<div id="ref-girvan_community_2002" class="csl-entry">
<div class="csl-left-margin">[10] </div><div class="csl-right-inline">M. Girvan and M. E. J. Newman, <em><a href="https://doi.org/10.1073/pnas.122653799">Community Structure in Social and Biological Networks</a></em>, Proceedings of the National Academy of Sciences <strong>99</strong>, 7821 (2002).</div>
</div>
<div id="ref-lancichinetti_community_2009" class="csl-entry">
<div class="csl-left-margin">[11] </div><div class="csl-right-inline">A. Lancichinetti and S. Fortunato, <em><a href="https://doi.org/10.1103/PhysRevE.80.056117">Community Detection Algorithms: <span>A</span> Comparative Analysis</a></em>, Physical Review E <strong>80</strong>, 056117 (2009).</div>
</div>
<div id="ref-decelle_asymptotic_2011" class="csl-entry">
<div class="csl-left-margin">[12] </div><div class="csl-right-inline">A. Decelle, F. Krzakala, C. Moore, and L. Zdeborová, <em><a href="https://doi.org/10.1103/PhysRevE.84.066106">Asymptotic Analysis of the Stochastic Block Model for Modular Networks and Its Algorithmic Applications</a></em>, Physical Review E <strong>84</strong>, 066106 (2011).</div>
</div>
<div id="ref-peixoto_reconstructing_2018" class="csl-entry">
<div class="csl-left-margin">[13] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevX.8.041011">Reconstructing <span>Networks</span> with <span>Unknown</span> and <span>Heterogeneous Errors</span></a></em>, Physical Review X <strong>8</strong>, 041011 (2018).</div>
</div>
<div id="ref-peixoto_revealing_2021" class="csl-entry">
<div class="csl-left-margin">[14] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevX.11.021003">Revealing <span>Consensus</span> and <span>Dissensus</span> Between <span>Network Partitions</span></a></em>, Physical Review X <strong>11</strong>, 021003 (2021).</div>
</div>
<div id="ref-guimera_missing_2009" class="csl-entry">
<div class="csl-left-margin">[15] </div><div class="csl-right-inline">R. Guimerà and M. Sales-Pardo, <em><a href="https://doi.org/10.1073/pnas.0908366106">Missing and Spurious Interactions and the Reconstruction of Complex Networks</a></em>, Proceedings of the National Academy of Sciences <strong>106</strong>, 22073 (2009).</div>
</div>
<div id="ref-hoffmann_community_2020" class="csl-entry">
<div class="csl-left-margin">[16] </div><div class="csl-right-inline">T. Hoffmann, L. Peel, R. Lambiotte, and N. S. Jones, <em><a href="https://doi.org/10.1126/sciadv.aav1478">Community Detection in Networks Without Observing Edges</a></em>, Science Advances <strong>6</strong>, eaav1478 (2020).</div>
</div>
<div id="ref-peixoto_network_2019" class="csl-entry">
<div class="csl-left-margin">[17] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevLett.123.128301">Network <span>Reconstruction</span> and <span>Community Detection</span> from <span>Dynamics</span></a></em>, Physical Review Letters <strong>123</strong>, 128301 (2019).</div>
</div>
</div>
<hr>
</section>
<section id="comments" class="level4">
<h4 class="anchored" data-anchor-id="comments">Comments</h4>
<p>(Comments may be moderated.)</p>
<div class="discourse-excerpt" style="display: none">
<p>If you reply to this post, it will show as a comment below the original article.</p>
</div>
<div id="discourse-comments"></div>
<meta name="discourse-username" content="tiago">

<script type="text/javascript">

  const discourse_url = "https://forum.skewed.de";

  // Here, we determine the theme, and send a message to the iframe to let it know what the theme is
  // See below for how we hook up notifyFrameStyle 
  const notifyIFrameOfTheme = () => {
    const iframe = document.getElementById("discourse-embed-frame");
    if (document.body.classList.contains("quarto-dark")) {
      theme = "dark";
    } else {
      theme = "light";
    }

    if (iframe && iframe.contentWindow) {
      iframe.contentWindow.postMessage(
        {
          // Modify the line below to grab dark mode setting, depending on how you store it
          theme: theme
        },
        discourse_url
      );
    }
  };

  // Call setFrameStyle when we receive the "iframe loaded" message
  const handleMessageListener = (event) => {
    var origin = event.origin;
    if ((origin === discourse_url) && (event.data == "iframe loaded")) {
      notifyIFrameOfTheme();
    }
  };

  DiscourseEmbed = {
    discourseUrl: 'https://forum.skewed.de/',
    discourseEmbedUrl: 'https://skewed.de/lab/posts/inference-compression/',
    //className: 'discourse-excerpt',
  };
  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();

  window.addEventListener("message", handleMessageListener);
</script>
</section>
<section id="webmentionswebmentions" class="level4">
<h4 class="anchored" data-anchor-id="webmentionswebmentions">Webmentions<sup>5</sup></h4>
<div id="nomention">
<p>(Nothing yet)</p>
</div>
<div class="mentionsio">
<ul id="facepile">
</ul>
<ul id="reposts">
</ul>
<ul id="mentions">
</ul>
</div>


</section>
<div class="no-row-height column-margin column-container"><div id="fn5"><p><sup>5</sup>&nbsp;<a href="https://indieweb.org/Webmention">Webmention</a> is a standardized decentralized mechanism for conversations and interactions across the web.</p></div></div></section>


</div> ]]></description>
  <category>community detection</category>
  <category>description</category>
  <category>inference</category>
  <category>Bayes</category>
  <category>MDL</category>
  <category>SBM</category>
  <guid>https://skewed.de/lab/posts/inference-compression/</guid>
  <pubDate>Thu, 02 Dec 2021 23:00:00 GMT</pubDate>
  <media:content url="https://skewed.de/lab/posts/inference-compression/generative.png" medium="image" type="image/png" height="106" width="144"/>
</item>
<item>
  <title>Descriptive vs. inferential community detection</title>
  <dc:creator>Tiago P. Peixoto</dc:creator>
  <link>https://skewed.de/lab/posts/descriptive-inferential/</link>
  <description><![CDATA[ 

<div class="h-entry e-content entry-content page-columns page-full">




<div class="page-columns page-full"><p></p><div class="no-row-height column-margin column-container"><span class="margin-aside">This post is a slightly modified version of chapter II in <span class="citation" data-cites="peixoto_descriptive_2023">&nbsp;[1]</span>.</span></div></div>
<p><a href="https://en.wikipedia.org/wiki/Community_structure">Community detection</a> is the task of dividing a network — typically one which is large — into many smaller groups of nodes that have a similar contribution to the overall network structure. With such a division, we can better summarize the large-scale structure of a network by describing how these groups are connected, instead of each individual node. This simplified description can be used to digest an otherwise intractable representation of a large system, providing insight into its most important patterns, how they relate to its function, and the underlying mechanisms responsible for its formation.</p>
<p>At a very fundamental level, community detection methods can be divided into two main categories: “descriptive” and “inferential.”</p>
<p><strong>Descriptive methods</strong> attempt to find communities according to some context-dependent notion of a good division of the network into groups. These notions are based on the patterns that can be identified in the network via an exhaustive algorithm, but without taking into consideration the possible rules that were used to create them. These patterns are used only to <span class="title-ref">describe</span> the network, not to explain it. Usually, these approaches do not articulate precisely what constitutes community structure to begin with, and focus instead only on how to detect them. For this kind of method, concepts of statistical significance, parsimony and generalizability are usually not evoked.</p>
<p><strong>Inferential methods</strong>, on the other hand, start with an explicit definition of what constitutes community structure, via a generative model for the network. This model describes how a <span class="title-ref">latent</span> (i.e.&nbsp;not observed) partition of the nodes would affect the placement of the edges. The inference consists on reversing this procedure to determine which node partitions are more likely to have been responsible for the observed network. The result of this is a “fit” of a model to data, that can be used as a tentative explanation of how it came to be. The concepts of statistical significance, parsimony and generalizability arise naturally and can be quantitatively assessed in this context. See e.g. <span class="citation" data-cites="peixoto_bayesian_2019">&nbsp;[2]</span>.</p>
<p>Descriptive community detection methods are by far the most numerous, and those that are in most widespread use. However, this contrasts with the current state-of-the-art, which is composed in large part of inferential approaches. Here we point out the major differences between them and discuss how to decide which is more appropriate, and also why one should in general favor the inferential varieties whenever the objective is derive interpretations from data.</p>
<section id="describing-vs.-explaining" class="level3">
<h3 class="anchored" data-anchor-id="describing-vs.-explaining">Describing vs.&nbsp;explaining</h3>
<p>We begin by observing that descriptive clustering approaches are the method of choice in certain contexts. For instance, such approaches arise naturally when the objective is to divide a network into two or more parts as a means to solve a variety of optimization problems. Arguably, the most classic example of this is the design of <a href="https://en.wikipedia.org/wiki/Very_Large_Scale_Integration">Very Large Scale Integrated Circuits (VLSI)</a>. The task is to combine millions of transistors into a single physical microprocessor chip. Transistors that connect to each other must be placed together to take less space, consume less power, reduce latency, and reduce the risk of cross-talk with other nearby connections. To achieve this, the initial stage of a VLSI process involves the partitioning of the circuit into many smaller modules with few connections between them, in a manner that enables their efficient spatial placement, i.e.&nbsp;by positioning the transistors in each module close together and those in different modules farther apart.</p>
<p>Another notable example is parallel task scheduling, a problem that appears in computer science and operations research. The objective is to distribute processes (i.e.&nbsp;programs, or tasks in general) between different processors, so they can run at the same time. Since processes depend on the partial results of other processes, this forms a dependency network, which then needs to be divided such that the number of dependencies across processors is minimized. The optimal division is the one where all tasks are able to finish in the shortest time possible.</p>
<p>Both examples above, and others, have motivated a large literature on <a href="https://en.wikipedia.org/wiki/Graph_partition">“graph partitioning”</a> dating back to the 70s, which covers a family of problems that play an important role in computer science and algorithmic complexity theory.</p>
<p>Although reminiscent of graph partitioning, and sharing with it many algorithmic similarities, community detection is used more broadly with a different goal <span class="citation" data-cites="fortunato_community_2016">&nbsp;[3]</span>. Namely, the objective is to perform <span class="title-ref">data analysis</span>, where one wants to extract scientific understanding from empirical observations. The communities identified are usually directly used for representation and/or interpretation of the data, rather than as a mere device to solve a particular optimization problem. In this context, a merely descriptive approach will fail at giving us a meaningful insight into the data, and can be misleading, as we will discuss in the following.</p>
<p>We illustrate the difference between descriptive and inferential approaches in Figure&nbsp;1. We first make an analogy with the famous “face” seen on images of the <a href="https://en.wikipedia.org/wiki/Cydonia_(Mars)">Cydonia Mensae</a> region of the planet Mars. A merely descriptive account of the image can be made by identifying the facial features seen, which most people immediately recognize. However, an inferential description of the same image would seek instead to <em>explain</em> what is being seen. The process of explanation must invariably involve at its core an application of the law of parsimony, or <a href="https://en.wikipedia.org/wiki/Occam%27s_razor">Occam's razor</a>. This principle predicates that when considering two hypotheses compatible with an observation, the simplest one must prevail. Employing this logic results in the conclusion that what we are seeing is in fact a regular mountain, without denying that it looks like a face in that picture, but just accidentally. In other words, the “facial” description is not useful as an explanation, as it emerges out of random features rather than exposing any underlying mechanism.</p>
<div id="fig-infvsdesc" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-infvsdesc-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://skewed.de/lab/posts/descriptive-inferential/descriptive.png" class="img-fluid figure-img" style="width:60.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-infvsdesc-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Difference between descriptive and inferential approaches to data analysis. As an analogy, on the top row we see two representations of the <em>Cydonia Mensae</em> region on Mars. On the top left is a descriptive account of what we see in the picture, namely a face. On the top right is an inferential of representation of what lies behind it, namely a mountain. (We show a more recent image of the same region with a higher resolution to represent an inferential interpretation of the figure on the left.) More concretely, on the bottom row we see two representations of the same network. On the bottom left we see a descriptive division into 13 assortative communities. On the bottom right we see an inferential representation as a fully random network, with no communities, since this is a more likely model of how this network was formed (see Figure&nbsp;2).
</figcaption>
</figure>
</div>
<p>Going out of the analogy and back to the problem of community detection, in the bottom of Figure&nbsp;1 we see a descriptive and an inferential account of an example network. The descriptive one is a division of the nodes into 13 assortative communities, which would be identified with many descriptive community detection methods available in the literature. Indeed, we can inspect visually that these groups form assortative communities, and most people would agree that these communities are really there, according to most definitions in use: these are groups of nodes with many more internal edges than external ones. However, an inferential account of the same network would reveal something else altogether. Specifically, it would explain this network as the outcome of a process where the edges are placed at random, without the existence of any communities. The communities that we see in Figure&nbsp;1 (a) are just a byproduct of this random process, and therefore carry no explanatory power. In fact, this is exactly how the network in this example was generated, i.e.&nbsp;by choosing a specific degree sequence and connecting the edges uniformly at random.</p>
<p>In Figure&nbsp;2 (a) we illustrate in more detail how the network in Figure&nbsp;1 was generated: The degrees of the nodes are fixed, forming “stubs” or “half-edges”, which are then paired uniformly at random forming the edges of the network. In Figure&nbsp;2 (b), like in Figure&nbsp;1, the node colors show the partition found with descriptive community detection methods. However, this network division carries no explanatory power beyond what is contained in the degree sequence of the network, since it is generated otherwise uniformly at random. This becomes evident in Figure&nbsp;2 (c), where we show another network sampled from the same generative process, i.e.&nbsp;another random pairing, but partitioned according to the same division as in Figure&nbsp;2 (b). Since the nodes are paired uniformly at random, constrained only by their degree, this will create new apparent “communities” that are always uncorrelated with one another. Like the “face” on Mars, they can be seen and described, but they cannot explain.</p>
<div id="fig-generation" class="quarto-float quarto-figure quarto-figure-center anchored">
<figure class="quarto-float quarto-float-fig figure">
<div aria-describedby="fig-generation-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<img src="https://skewed.de/lab/posts/descriptive-inferential/generative.png" class="img-fluid figure-img" style="width:60.0%">
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-generation-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: Descriptive community detection finds a partition of the network according to an arbitrary criterion that bears in general no relation to the rules that were used to generate it. In (a) is shown the generative model we consider, where first a degree sequence is given to the nodes (forming “stubs”, or “half-edges”) which then are paired uniformly at random, forming a graph. In (b) is shown a realization of this model. The node colors show the partition found with virtually any descriptive community detection method. In (c) is shown another network sampled from the same model, together with the same partition found in (b), which is completely uncorrelated with the new apparent communities seen, since they are the mere byproduct of the random placement of the edges. An inferential approach would find only a single community in both (b) and (c), since no partition of the nodes is relevant for the underlying generative model.
</figcaption>
</figure>
</div>
<p>We emphasize that the communities found in Figure&nbsp;2 (b) are indeed really there from a descriptive point of view, and they can in fact be useful for a variety of tasks. For example, the <em>cut</em> given by the partition, i.e.&nbsp;the number of edges that go between different groups, is only 13, which means that we need only to remove this number of edges to break the network into (in this case) 13 smaller components. Depending on context, this kind of information can be used to prevent a widespread epidemic, hinder undesired communication, or, as we have already discussed, distribute tasks among processors and design a microchip. However, what these communities <em>cannot</em> be used for is to <em>explain</em> the data. In particular, a conclusion that would be completely incorrect is that the nodes that belong to the same group would have a larger probability of being connected between themselves. As shown in Figure&nbsp;2 (a), this is clearly not the case, as the observed “communities” arise by pure chance, without any preference between the nodes.</p>
</section>
<section id="sec-litmus" class="level2 page-columns page-full">
<h2 class="anchored" data-anchor-id="sec-litmus">To infer or to describe? A litmus test</h2>
<p>Given the above differences, and the fact that both inferential and descriptive approaches have their uses depending on context, we are left with the question: Which approach is more appropriate for a given task at hand? In order to help answering this question, independent of the particular context, it is useful to consider the following “litmus test”:</p>
<blockquote class="blockquote">
<p>Q: “Would the usefulness of our conclusions change if we learn, after obtaining the communities, that the network being analyzed is completely random?”</p>
<p>If the answer is “yes”, then an inferential approach is needed.</p>
<p>If the answer is “no”, then an inferential approach is not required.</p>
</blockquote>
<p>If the answer to the above question is “yes”, then an inferential approach is warranted, since the conclusions depend on an interpretation of how the data were generated. Otherwise, a purely descriptive approach may be appropriate since considerations about generative processes are not relevant.</p>
<p>It is important to understand that the relevant question in this context is not whether the network being analyzed is <em>actually</em> fully random, <sup>1</sup> since this is rarely the case for empirical networks. Instead, considering this hypothetical scenario serves as a test to evaluate if our task requires us to separate between actual latent community structure (i.e.&nbsp;those that are responsible for the network formation), from those that arise completely out of random fluctuations, and hence carry no explanatory power. Furthermore, most empirical networks, even if not fully random, like most interesting data, are better explained by a mixture of structure and randomness, and a method that cannot tell those apart cannot be used for inferential purposes.</p>
<div class="no-row-height column-margin column-container"><div id="fn1"><p><sup>1</sup>&nbsp;“Fully random” here means sampled form a random graph model, like the Erdős-Rényi model, the configuration model, or some other null model where whatever communities we may ascribe to the nodes play no role in the placement of the edges.</p></div><div id="fn2"><p><sup>2</sup>&nbsp;Although this is certainly true at a first instance, we can also argue that properly understanding <em>why</em> a certain partition was possible in the first place would be useful for reproducibility and to aid the design of future instances of the problem. For these purposes, an inferential approach would be more appropriate.</p></div></div><p>Returning to the VLSI and task scheduling examples we considered in the previous section, it is clear that the answer to the litmus test above would be “no”, since it hardly matters how the network was generated and how we should interpret the partition found, as long as the integrated circuit can be manufactured and function efficiently, or the tasks finish in the minimal time. Interpretation and explanations are simply not the primary goals in these cases.<sup>2</sup></p>
<p>However, it is safe to say that in network data analyses very often the answer to the question above question would be “yes.” Typically, community detection methods are used to try to understand the overall large-scale network structure, determine the prevalent mixing patterns, make simplifications and generalizations, all in a manner that relies on statements about what lies behind the data, e.g.&nbsp;whether nodes were more or less likely to be connected to begin with. A majority of conclusions reached would be severely undermined if one would discover that the underlying network is in fact fully random. This means that these analyses are at a grave peril when using purely descriptive methods, since they are likely to be <em>overfitting</em> the data — i.e.&nbsp;confusing randomness with underlying structure.</p>
<section id="references" class="level4">
<h4 class="anchored" data-anchor-id="references">References</h4>
<div id="refs" class="references csl-bib-body" data-entry-spacing="0">
<div id="ref-peixoto_descriptive_2023" class="csl-entry">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1017/9781009118897">Descriptive Vs. <span>Inferential Community Detection</span> in <span>Networks</span>: <span>Pitfalls</span>, <span>Myths</span> and <span>Half-Truths</span></a></em>, Elements in the Structure and Dynamics of Complex Networks (2023).</div>
</div>
<div id="ref-peixoto_bayesian_2019" class="csl-entry">
<div class="csl-left-margin">[2] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1002/9781119483298.ch11">Bayesian <span>Stochastic Blockmodeling</span></a></em>, in <em>Advances in <span>Network Clustering</span> and <span>Blockmodeling</span></em> (John Wiley &amp; Sons, Ltd, 2019), pp. 289–332.</div>
</div>
<div id="ref-fortunato_community_2016" class="csl-entry">
<div class="csl-left-margin">[3] </div><div class="csl-right-inline">S. Fortunato and D. Hric, <em><a href="https://doi.org/10.1016/j.physrep.2016.09.002">Community Detection in Networks: <span>A</span> User Guide</a></em>, Physics Reports (2016).</div>
</div>
</div>
<hr>
</section>
<section id="comments" class="level4">
<h4 class="anchored" data-anchor-id="comments">Comments</h4>
<p>(Comments may be moderated.)</p>
<div class="discourse-excerpt" style="display: none">
<p>If you reply to this post, it will show as a comment below the original article.</p>
</div>
<div id="discourse-comments"></div>
<meta name="discourse-username" content="tiago">

<script type="text/javascript">

  const discourse_url = "https://forum.skewed.de";

  // Here, we determine the theme, and send a message to the iframe to let it know what the theme is
  // See below for how we hook up notifyFrameStyle 
  const notifyIFrameOfTheme = () => {
    const iframe = document.getElementById("discourse-embed-frame");
    if (document.body.classList.contains("quarto-dark")) {
      theme = "dark";
    } else {
      theme = "light";
    }

    if (iframe && iframe.contentWindow) {
      iframe.contentWindow.postMessage(
        {
          // Modify the line below to grab dark mode setting, depending on how you store it
          theme: theme
        },
        discourse_url
      );
    }
  };

  // Call setFrameStyle when we receive the "iframe loaded" message
  const handleMessageListener = (event) => {
    var origin = event.origin;
    if ((origin === discourse_url) && (event.data == "iframe loaded")) {
      notifyIFrameOfTheme();
    }
  };

  DiscourseEmbed = {
    discourseUrl: 'https://forum.skewed.de/',
    discourseEmbedUrl: 'https://skewed.de/lab/posts/descriptive-inferential/',
    //className: 'discourse-excerpt',
  };
  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();

  window.addEventListener("message", handleMessageListener);
</script>
</section>
<section id="webmentionswebmentions" class="level4">
<h4 class="anchored" data-anchor-id="webmentionswebmentions">Webmentions<sup>3</sup></h4>
<div id="nomention">
<p>(Nothing yet)</p>
</div>
<div class="mentionsio">
<ul id="facepile">
</ul>
<ul id="reposts">
</ul>
<ul id="mentions">
</ul>
</div>


</section>
<div class="no-row-height column-margin column-container"><div id="fn3"><p><sup>3</sup>&nbsp;<a href="https://indieweb.org/Webmention">Webmention</a> is a standardized decentralized mechanism for conversations and interactions across the web.</p></div></div></section>


</div> ]]></description>
  <category>community detection</category>
  <category>description</category>
  <category>inference</category>
  <category>Bayes</category>
  <category>SBM</category>
  <guid>https://skewed.de/lab/posts/descriptive-inferential/</guid>
  <pubDate>Wed, 01 Dec 2021 23:00:00 GMT</pubDate>
  <media:content url="https://skewed.de/lab/posts/descriptive-inferential/descriptive.png" medium="image" type="image/png" height="152" width="144"/>
</item>
<item>
  <title>Is network reconstruction impossible?</title>
  <dc:creator>Tiago P. Peixoto</dc:creator>
  <link>https://skewed.de/lab/posts/thats-unpossible/</link>
  <description><![CDATA[ 

<div class="h-entry e-content entry-content page-columns page-full">




<p>I have been getting some questions about a 2018 paper <span class="citation" data-cites="chang_estimation_2020">&nbsp;[1]</span> by Jinyuan Chang, Eric D. Kolaczyk, and Qiwei Yao that deals with reconstruction of noisy networks, i.e.&nbsp;networks that are measured with uncertainty, so that true edges may not be observed or fake ones may be spuriously introduced. Among other things, they state:</p>
<blockquote class="blockquote">
<p>“Under a simple model of network error, we show that consistent estimation of [subgraph] densities is impossible when the rates of error are unknown and only a single network is observed.”</p>
</blockquote>
<p>This seems like a contradiction of a paper of mine <span class="citation" data-cites="peixoto_reconstructing_2018">&nbsp;[2]</span> where I presented a method to do precisely what is considered impossible in the above statement: reconstruct networks from single measurements, when the error rates are unknown. So, where lies the problem?</p>
<p>Let us begin by defining the reconstruction scenario, which is fairly simple. Suppose we observe a noisy network <img src="https://latex.codecogs.com/png.latex?X">, obtained by measuring a true network <img src="https://latex.codecogs.com/png.latex?A">, subject to the error rates <img src="https://latex.codecogs.com/png.latex?p"> and <img src="https://latex.codecogs.com/png.latex?q">, such that</p>
<p><img src="https://latex.codecogs.com/png.latex?%5Cbegin%7Baligned%7D%0AP(X_%7Bij%7D%7CA_%7Bij%7D,p,q)%20=%0A%5Cbegin%7Bcases%7D%0A%20%20%20%20p%5E%7B1-X_%7Bij%7D%7D(1-p)%5E%7BX_%7Bij%7D%7D,%20&amp;%20%5Ctext%7B%20if%20%7D%20A_%7Bij%7D%20=%201,%5C%5C%0A%20%20%20%20q%5E%7BX_%7Bij%7D%7D(1-q)%5E%7B1-X_%7Bij%7D%7D,%20&amp;%20%5Ctext%7B%20if%20%7D%20A_%7Bij%7D%20=%200.%0A%5Cend%7Bcases%7D%0A%5Cend%7Baligned%7D"></p>
<p>In other words, <img src="https://latex.codecogs.com/png.latex?p"> is the probability of observing a missing edge, and <img src="https://latex.codecogs.com/png.latex?q"> is the probability of observing a spurious edge.</p>
<p>The reconstruction task is to obtain an estimate of <img src="https://latex.codecogs.com/png.latex?A"> based only on <img src="https://latex.codecogs.com/png.latex?X">, without knowing either <img src="https://latex.codecogs.com/png.latex?p"> or <img src="https://latex.codecogs.com/png.latex?q">. (Note that this reconstruction would also inherently give us an estimate for <img src="https://latex.codecogs.com/png.latex?p"> and <img src="https://latex.codecogs.com/png.latex?q">.)</p>
<p>Chang et al.&nbsp;consider estimators of subgraph densities that operate on the observed network <img src="https://latex.codecogs.com/png.latex?X">, in a manner that makes no explicit assumption about how the data are generated. Essentially they claim that not knowing the true values of <img src="https://latex.codecogs.com/png.latex?A">, <img src="https://latex.codecogs.com/png.latex?p">, and <img src="https://latex.codecogs.com/png.latex?q">, it is impossible to say anything about either of these values from <img src="https://latex.codecogs.com/png.latex?X"> alone.</p>
<p>It is important to understand that it is not in fact possible to make “no assumptions” about how data are generated. Assumptions are always made; they can only be implicit or explicit. Implicit assumptions, i.e. those that are hidden from view, are not exempt from justification. So-called “frequentist” estimators that make no explicit reference to a prior distribution are in fact formally equivalent to Bayesian estimators with a uniform prior, i.e.&nbsp;assuming that all parameters values are equally likely. In the case where the parameter is a graph, this means that our prior expectation is that <img src="https://latex.codecogs.com/png.latex?A"> is not only fully random, but in fact also <em>dense</em>, i.e.&nbsp;with a mean degree <img src="https://latex.codecogs.com/png.latex?%5Cleft%3Ck%5Cright%3E=N/2">, where <img src="https://latex.codecogs.com/png.latex?N"> is the number of nodes. Is this a reasonable assumption?</p>
<p>In <span class="citation" data-cites="peixoto_reconstructing_2018">&nbsp;[2]</span> we take instead a <a href="https://en.wikipedia.org/wiki/Bayesian_statistics">Bayesian</a> approach, where we are explicit about our assumptions, yielding a posterior distribution for the reconstruction,</p>
<p><img src="https://latex.codecogs.com/png.latex?P(A%7CX)%20=%20%5Cfrac%7BP(X%7CA)P(A)%7D%7BP(X)%7D."></p>
<p>In this setting, we can recover the “impossibility” result of Chung et al by choosing the prior <img src="https://latex.codecogs.com/png.latex?P(A)"> as a constant. But this is not what should be done; instead we should choose a prior <img src="https://latex.codecogs.com/png.latex?P(A)"> that makes <em>as little commitment as possible</em> about the network structure before we see any data. Note that this is very different from choosing a uniform prior! A uniform prior would in fact be a very strong commitment, that is overwhelmingly likely to be wrong in almost every empirical setting. Instead, we need a nonparametric hierarchical model that includes everything from fully random to very structured networks as special cases, in a manner that encapsulates the kinds of data that we are likely to find.</p>
<p>In order to illustrate intuitively why this makes sense, let us consider a particular instance of the problem. Suppose that, without knowing the true network <img src="https://latex.codecogs.com/png.latex?A"> and the noise magnitudes <img src="https://latex.codecogs.com/png.latex?p"> and <img src="https://latex.codecogs.com/png.latex?q">, we observe the following noisy network <img src="https://latex.codecogs.com/png.latex?X">:</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/thats-unpossible/lattice.svg" class="img-fluid figure-img" style="width:70.0%"></p>
<figcaption>A mysterious noisy network. What lies behind it?</figcaption>
</figure>
</div>
<p>From pure intuition, when observing the above network, we would like to immediately claim that it is close to the true network, and that the noise magnitudes are low. Why? Because we know that a perfect lattice is unlikely to be formed by chance alone (i.e.&nbsp;from a uniform prior). Our intuitive prior knows that such things called lattices exist, and that when they occur, they look exactly like the figure above. And also, when the true network is a lattice, a high value of either <img src="https://latex.codecogs.com/png.latex?p"> or <img src="https://latex.codecogs.com/png.latex?q"> would destroy its pristine structure. The final conclusion is that the reconstruction of this network is not only possible, but in fact not very difficult.</p>
<p>The work <span class="citation" data-cites="peixoto_reconstructing_2018">&nbsp;[2]</span> puts the above intuition on firmer terms by choosing the prior <img src="https://latex.codecogs.com/png.latex?P(A)"> to match an unknown stochastic block model (SBM)<span class="citation" data-cites="peixoto_bayesian_2019">&nbsp;[3]</span>. This model includes the “fully random” assumption as a special case, but is also capable of modelling a wide variety of structural patterns. Is this a realistic assumption? As it turns out, it is sufficiently generic to make the reconstruction possible in many cases, even when the model is not fully realistic.</p>
<p>As an example, we can consider the perfect lattice considered above. Below is the reconstructed version of this presumed noisy network, according to the method of <span class="citation" data-cites="peixoto_reconstructing_2018">&nbsp;[2]</span> (see the <a href="https://graph-tool.skewed.de/static/doc/demos/inference/inference.html#measured-networks">HOWTO</a>):</p>
<div class="quarto-figure quarto-figure-center">
<figure class="figure">
<p><img src="https://skewed.de/lab/posts/thats-unpossible/reconstructed.svg" class="img-fluid figure-img" style="width:70.0%"></p>
<figcaption>A mystery revealed.</figcaption>
</figure>
</div>
<p>The thickness of the edge corresponds to the marginal posterior probability. Essentially, we conclude that the observed network is perfectly accurate, conforming to our intuition. The colors on the nodes shown above correspond to the node partition found with the SBM. Note that this is a very coarse and arguably <a href="https://www.youtube.com/watch?v=xRgYaS0yMTw">displeasing</a> generative model for this network, which would be generated by it with a very low probability. Nevertheless, even with such misspecification, the model is enough to detect that the underlying network is far from random, and enable reconstruction. The posterior estimates for the noise magnitudes are <img src="https://latex.codecogs.com/png.latex?p=0.002(2)"> and <img src="https://latex.codecogs.com/png.latex?q=3(3)%5Ctimes10%5E%7B-7%7D">; indeed quite small. Not bad!</p>
<p>Of course, in <span class="citation" data-cites="peixoto_reconstructing_2018">&nbsp;[2]</span> we consider situations where reconstruction is made for higher noise magnitudes, and also for real networks. But the above already serves to show that reconstruction from single measurements is indeed possible.</p>
<p>This should not be an earth-shattering conclusion. After all, single-measurement reconstructions of noisy images, time-series, and other high-dimensional objects are commonplace. Why not of networks? The key here is to abandon the idea that a network (like an image or a time-series) is a “singleton” <img src="https://latex.codecogs.com/png.latex?N=1"> object, and instead view it as a heterogeneous population of objects — namely the individual edges and nodes. And we should make assumptions that, while being agnostic about <em>which</em> kinds of pattern there should be, also allow for them to be detected in the first place.</p>
<section id="references" class="level4">
<h4 class="anchored" data-anchor-id="references">References</h4>
<div id="refs" class="references csl-bib-body" data-entry-spacing="0">
<div id="ref-chang_estimation_2020" class="csl-entry">
<div class="csl-left-margin">[1] </div><div class="csl-right-inline">J. Chang, E. D. Kolaczyk, and Q. Yao, <em><a href="http://arxiv.org/abs/1803.02488">Estimation of Subgraph Density in Noisy Networks</a></em>, arXiv:1803.02488 [Stat] (2020).</div>
</div>
<div id="ref-peixoto_reconstructing_2018" class="csl-entry">
<div class="csl-left-margin">[2] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1103/PhysRevX.8.041011">Reconstructing <span>Networks</span> with <span>Unknown</span> and <span>Heterogeneous Errors</span></a></em>, Physical Review X <strong>8</strong>, 041011 (2018).</div>
</div>
<div id="ref-peixoto_bayesian_2019" class="csl-entry">
<div class="csl-left-margin">[3] </div><div class="csl-right-inline">T. P. Peixoto, <em><a href="https://doi.org/10.1002/9781119483298.ch11">Bayesian <span>Stochastic Blockmodeling</span></a></em>, in <em>Advances in <span>Network Clustering</span> and <span>Blockmodeling</span></em> (John Wiley &amp; Sons, Ltd, 2019), pp. 289–332.</div>
</div>
</div>
<hr>
</section>
<section id="comments" class="level4">
<h4 class="anchored" data-anchor-id="comments">Comments</h4>
<p>(Comments may be moderated.)</p>
<div class="discourse-excerpt" style="display: none">
<p>If you reply to this post, it will show as a comment below the original article.</p>
</div>
<div id="discourse-comments"></div>
<meta name="discourse-username" content="tiago">

<script type="text/javascript">

  const discourse_url = "https://forum.skewed.de";

  // Here, we determine the theme, and send a message to the iframe to let it know what the theme is
  // See below for how we hook up notifyFrameStyle 
  const notifyIFrameOfTheme = () => {
    const iframe = document.getElementById("discourse-embed-frame");
    if (document.body.classList.contains("quarto-dark")) {
      theme = "dark";
    } else {
      theme = "light";
    }

    if (iframe && iframe.contentWindow) {
      iframe.contentWindow.postMessage(
        {
          // Modify the line below to grab dark mode setting, depending on how you store it
          theme: theme
        },
        discourse_url
      );
    }
  };

  // Call setFrameStyle when we receive the "iframe loaded" message
  const handleMessageListener = (event) => {
    var origin = event.origin;
    if ((origin === discourse_url) && (event.data == "iframe loaded")) {
      notifyIFrameOfTheme();
    }
  };

  DiscourseEmbed = {
    discourseUrl: 'https://forum.skewed.de/',
    discourseEmbedUrl: 'https://skewed.de/lab/posts/thats-unpossible/',
    //className: 'discourse-excerpt',
  };
  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
    d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
  })();

  window.addEventListener("message", handleMessageListener);
</script>
</section>
<section id="webmentionswebmentions" class="level4">
<h4 class="anchored" data-anchor-id="webmentionswebmentions">Webmentions<sup>1</sup></h4>
<div id="nomention">
<p>(Nothing yet)</p>
</div>
<div class="mentionsio">
<ul id="facepile">
</ul>
<ul id="reposts">
</ul>
<ul id="mentions">
</ul>
</div>


</section>
<div class="no-row-height column-margin column-container"><div id="fn1"><p><sup>1</sup>&nbsp;<a href="https://indieweb.org/Webmention">Webmention</a> is a standardized decentralized mechanism for conversations and interactions across the web.</p></div></div>

</div> ]]></description>
  <category>inference</category>
  <category>reconstruction</category>
  <category>Bayes</category>
  <category>SBM</category>
  <guid>https://skewed.de/lab/posts/thats-unpossible/</guid>
  <pubDate>Thu, 28 Oct 2021 22:00:00 GMT</pubDate>
  <media:content url="https://skewed.de/lab/posts/thats-unpossible/reconstructed.svg" medium="image" type="image/svg+xml"/>
</item>
</channel>
</rss>
