{'fraction_non_alphanumeric': 0.03056872037914692, 'fraction_numerical': 0.00900473933649289, 'mean_word_length': 4.850112632126148, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Thermodynamics of network model fitting with spectral entropies

An information theoretic approach inspired by quantum statistical mechanics was recently proposed as a means to optimize network models and to assess their likelihood against synthetic and real-world networks. Importantly, this method does not rely on specific topological features or network descriptors, but leverages entropy-based measures of network distance. Entertaining the analogy with thermodynamics, we provide a physical interpretation of model hyperparameters and propose analytical procedures for their estimate. These results enable the practical application of this novel and powerful framework to network model inference. We demonstrate this method in synthetic networks endowed with a modular structure, and in real-world brain connectivity networks.


I. INTRODUCTION
Many natural and artificial phenomena can be represented as networks of interacting elements. The mathematical framework of network theory can be applied across disciplines, ranging from sociology to neuroscience, and provides a powerful means to investigate a variety of diverse phenomena [1]. Unveiling the structural and organizational principles of complex networks often implies comparison with statistical network models. Generative models, for example, describe mechanisms of network wiring and evolution [2,3], or the constraints that may have contributed to shaping the network topology during its development [4]. Null models are used to describe maximally random networks with specific features, for example prescribed sequences of node degrees [5].
Maximum likelihood approaches have been proposed to compare the ability of different models to describe real-world networks and to optimize model parameters to best fit experimental networks. These methods are designed to assign the same probability to networks satisfying the same set of constraint, but hardly can take into account the whole network structure [6].
Recently, an information theoretic framework inspired by quantum statistical mechanics principles has been proposed as a tool to assess and optimize network models [7]. This approach relies on the minimization of the relative entropy based on the network spectral properties. Importantly, this relative entropy does not depend on a distribution of specific descriptors, but considers the network as a whole. However, this representation introduces an external, tunable hyperparameter β: the optimal estimate from the relative entropy minimization procedure critically depends on the choice of β, a major limitation to the practical use of this framework.
Relative entropy is a central concept in thermodynamics of information (see review [8]) and is defined on the basis of the density matrix. In light of this thermodynamic analogy, here we build a physical interpretation of this approach to network optimization and fitting, where β plays the role of an inverse temperature. This provides criteria for a rigorous selection of the optimal β, and enables the practical application of relative entropy minimization in the optimal reconstruction of parameters for different network models.
The paper is structured as follows. First, we present the theoretical framework of classical maximum entropy null models as a way to generate maximally random ensemble of networks with given constraints. We move on to briefly discussing how the Erdős-Rényi random graph and the configuration model emerge naturally from these ideas.
Within the settings of spectral entropies, we propose a new practical optimization method based on an approximation of the Laplacian spectrum and give a concise closed form expression for the gradients of relative entropy with respect to the model parameters. We continue discussing a thermodynamic interpretation of the meaning of relative entropy optimization in terms of irreversible processes.
We calculate analytically the optimal temperature parameter of the Erdős-Rényi and planted partition models. Furthermore, we generalize this result to more complex models with the help of numerical simulations showing the advantages of the spectral entropy approach with respect to other maximum likelihood methods.
Finally, we demonstrate the use of spectral entropies for the optimization of a generative model of neural connectivity in a real-world dataset.

II. MODELS OF COMPLEX NETWORKS
We summarize here a few definitions which are necessary to make this paper self-contained. Let us consider arXiv:1801.06009v2 [cond-mat.stat-mech] 4 Jun 2018 here simple binary undirected graphs G = (V, E) with |V| = n number of nodes and |E| = m number of links.
The adjacency matrix is denoted as A = {a ij } and the (combinatorial) graph Laplacian as L = D − A, where D is the diagonal matrix of the node degrees. Notably, the (combinatorial) Laplacian matrix associated with an undirected graph is a semi-positive definite matrix, meaning that all its eigenvalues λ 1 ≥ . . . ≥ λ n = 0 are positive (or zero) and real. A random graph model is an ensemble of networks randomly defined in the probability space Ω and distributed around some specific network property. For example, in the Gilbert random graph model the probability distribution P (G) is sharply peaked in P (G) = 1/Ω for graphs with n nodes and exactly m edges, and is zero otherwise [1]. This distribution is well described in statistical mechanics as the microcanonical ensemble, as it enforces the constraints strictly.
However, given the combinatorial complexity of dealing with the micro-canonical description, it is easier to fix the average value of observables of interest rather than working with exact constraints. This approach gives rise to the canonical ensemble of random graphs [1,9]. This type of models has the same role in the study of complex networks as the Boltzmann distribution in classical statistical mechanics; it gives the maximally uninformed prediction of some network properties subject to the imposed constraints. These ideas can be dated back to the Jaynes' maximum entropy principle [10]. In this sense, the maximally random ensemble of graphs satisfying the imposed topological constraints on average also takes the name of the Exponential Random Graph Model (ERGM) [1] or p * -model in the social sciences [5]. In its simplest implementation, the ERGM results in the Erdős-Rényi [11] model, where the link probability is constant.
On the other hand, if one wants to generate the maximally random network that maintains the desired degree sequence {k i }, the resulting ensemble is called the Undirected Binary Configuration Model (UBCM) [9,12,13]. Being the degree an entirely local topological property, it is affected by the intrinsic properties of vertices. For this reason, one can assign a hidden variable x i ≥ 0 to each node. Its value acts as a fitness score, which is hypothesized to be proportional to the expected node degree [12]. If two nodes have a high fitness score, they are more likely to be connected by a link. In this model one can describe the link probability as the normalized product of their scores [9,13,14], resulting in the following expected link probability: The values of x i are obtained by numerical optimization of a specifically designed likelihood function [13,15]. In this framework, the hidden variables x i are the Lagrange multipliers of the constrained problem that ensures the expected degree k i = ∑ i =j a ij of the vertex i equals on average its empirical value k i . Interestingly this model highlights the fermionic properties of the links, as they are modeled like particles with only two states, namely the link being present or not. If the network is sufficiently random, the degreesequence alone can model the higher order patterns like the clustering coefficient or the average nearest neighbor degree. However, deviations of other graph theoretical measures between model and empirical network are indicative of genuine higher-order patterns, like clustering or rich clubs, not simply accountable by the degree sequence alone [14,15].

III. SPECTRAL ENTROPIES FRAMEWORK
A measure of complexity is central to the understanding of differences and similarities between networks, and to decode the information that they represent. Supported by the seminal demonstration that the von Neumann entropy of a properly defined density matrix may be used for network comparison [7], in this paper we address the unsolved problem of inverse temperature selection and show that the result of model fitting strongly depend on it.
The first observation that an appropriately normalized graph Laplacian can be treated as a density matrix of a quantum system, is credited to the authors of reference [16]. Indeed, the Laplacian spectrum encloses a number of important topological properties of the graph [17][18][19][20]. For instance, the multiplicity of the zero eigenvalue corresponds to the number of connected components, the multiplicity of each eigenvalue is related to graph symmetries [19][20][21], the concept of expanders and isoperimetric number are connected to the first and second largest eigenvalues [22,23]. Moreover, the graph Laplacian appears often in the study of random walkers [24,25], diffusion [26], combinatorics [27], and a large number of other applications [19,27].
After the first demonstration that a graph can be always represented as a uniform mixture of pure density matrices [16], at least two different definitions of quantum density for complex networks have been used [7,28]. Adopting the notation of quantum physics, the von Neumann density matrix ρ is a Hermitian and positive definite matrix with unitary trace, that admits a spectral decomposition as: for an orthonormal basis {|φ i } and eigenvalues λ i (ρ). Thus, a density matrix can be represented as a convex combination of pure states [28]. The von Neumann entropy of the density operator ρ can be expressed as the Shannon entropy of its eigenvalues [29]: where log(·) is the principal matrix logarithm [30] when the argument is a matrix. The von Neumann entropy of the density matrix is bounded between 0 and log n [29].
We adopt the quantum statistical mechanics perspective [7], where the von Neumann density matrix ρ of a complex network is built considering a quantum system with Hamiltonian L in thermal contact with a heat bath at constant temperature In the perspective of Jaynes' maximum entropy framework [31], the state of maximum uncertainty about the system, constrained by the conditions Tr [ρ] = 1 and L = Tr [ρL] is described by the quantum Gibbs-Boltzmann distribution: where here e (·) is the matrix exponential when the argument is a matrix and the denominator is the so-called partition function of the system, i.e. the sum over all possible configurations of the ensemble, and is denoted by Z = Tr e −βL . Borrowing the terminology of statistical physics, thermal averages of any graph-theoretical measure O over the ensemble defined by ρ are obtained as: The choice of this density matrix for complex networks is supported by the observation that previous definitions of entropy [16,28] in graph theory resulted in violation of sub-additivity [7,32], a central property of entropy [29]. The strength of this definition of von Neumann entropy for graphs lies in the possibility to establish a connection between quantum statistical mechanics and the realm of networks. Moreover, this approach closely resembles the one taken in the study of diffusion on networks [25], where β is no longer interpreted as an inverse temperature of the external heat bath, but rather as the diffusion time of a random walker [33,34]. This renders the idea that the network properties can be explored at different scales by varying β [25,32,35].

IV. MODEL OPTIMIZATION
The application of the previously introduced concepts from information theory and statistical mechanics to complex networks, offers many intriguing possibilities, the most important one being the quantification of the amount of shared information between graphs and model fitting. The relative entropy S(ρ σ) between two density matrices ρ and σ is a nonnegative quantity that measures the expected amount of information lost when σ is used instead of ρ [7,29] and it is defined as: From the linearity of the trace operator, it is apparent that Eq. (6) consists of two terms. The first term is the negative value of entropy of the empirical density ρ. The second term log L = − Tr [ρ log σ] can be seen as the expected log-likelihood ratio between densities ρ and σ [7,29,36]. For this reason we can also express Eq. (6) as: Indeed Eq. (7) can be thought as a measure to quantify the discrepancy between the density matrix ρ of an observed network and the model density matrix.
In these settings, model optimization corresponds to finding the optimal parametersθ via minimization of the expectation of the relative entropy over all graphs with parameters θ:θ Rigorous calculation of the expected relative entropy requires the knowledge of the spectral properties of the model Laplacian. These can be obtained via application of random matrix theory or by Monte Carlo sampling [37][38][39]. However in this case a continuous gradient based optimization cannot be applied as the relative entropy is no longer differentiable. Other methods, like simulated annealing or stochastic optimization [40,41] can be applied in this case, with substantial computational burden. Here, for simplicity we use a different approach.
As any random graph model depends on some parameters θ = {θ 1 , . . . , θ k }, the model Laplacian is a matrix of random variables, where its elements are drawn from some distribution with parameters θ. For example, in the Erdős-Rényi random graph, the Laplacian off-diagonal elements are Bernoulli random variables with expectation −p, while the diagonal elements are binomial random variables with expectation (n − 1)p. Hence, we denote the expectation operator of the model Laplacian L(θ) at fixed parameters θ as E θ [L(θ)].
As discussed in the appendix A we approximate the expected relative entropy of Eq. 8 with the relative entropy between the observed density and the density of the expected model Laplacian: The accuracy of the approximation in Eq. 9 is higher for large networks with low sparsity. Finally, as the expected Laplacian E θ [L] depends continuously on the parameters θ, we can use continuous optimization methods based on the analytically computed gradients with components (see Appendix B for detailed calculation): (10) This last equation is the basis of the following sections and enables application of gradient based optimization methods.

A. Thermodynamic interpretation
The Klein inequality states that the quantum relative entropy of two density matrices is always non negative, and zero only in the case ρ = σ [29]. It is interesting to rework the expression for the relative entropy by making use of thermodynamic quantities [8,42]. For notational clarity here we set L σ := E θ [L(θ)]. We denote the Helmholtz free energies F ρ , F σ of the two systems described by densities ρ and σ(E θ [L(θ)]) as: The partition functions are computed as Z ρ = Tr e −βL ρ , Z σ = Tr e −βL σ . The ensemble averages of the empirical and model Laplacians are L ρ ρ = Tr ρL ρ and L σ ρ = Tr [ρL σ ], where · ρ indicates thermal averaging with respect to the canonical distribution pertaining to the Laplacian of the observed network L ρ . After rearrangement of the terms, the expression for the relative entropy described in Eq. (6) becomes: This expression is indeed general for any two density matrices and not only in the settings discussed above. Clearly, the Klein inequality implies the following condition, also known as Gibbs' inequality in statistical physics [42]: As the right hand side is independent on the parameters θ, the minimum relative entropy is obtained by direct minimization of the left-hand side of Eq. (12). This expression has a profound physical interpretation [8,42,43]. Let us consider a system with Hamiltonian L σ (θ * ) where the parameters θ * are fixed. This system is in equilibrium at temperature 1/β with a heat bath and its density matrix is σ * := σ(θ * ). Suppose we are given a sampling procedure to create real networks from the system described by the density σ * . Naturally, the properties of a sampled network will slightly deviate from its ensemble average. Indeed, except for a few trivial cases, the density ρ of a single network sampled from σ * will never be perfectly equal to σ * .
Thus, the generation of a random graph instance given a model described by Hamiltonian L σ can be interpreted as a sudden perturbation where the Hamiltonian of the system is driven from L σ to L ρ . In the general case this corresponds to an irreversible transformation, except for graphs where there are no possible rewirings preserving the given constraints, up to node permutations.
In this sense, minimization of the relative entropy is equivalent to finding a set of parametersθ such that the work required to bring the system described by ρ to a state σ(θ) is minimum. However,θ is not guaranteed to be equal to θ * due to irreversibility of the sampling. In order to precisely reconstruct the parametersθ = θ * , minimization of relative entropy averaged over the whole set of samples is therefore needed.
The inverse temperature β plays the role of a resolution parameter allowing one to compare two networks at different scales [7,32]. Therefore, for maximum entropy models with linear constraints, the optimal β tends to zero, as we are comparing the lowest order properties of the networks, linearly dependent on the adjacency matrix. On the other hand, for β tending to zero, the two density matrices ρ and σ tend to identity, so any choice of the parameters trivially yields zero relative entropy. Hence, to guide the optimization towards a non-trivial solution, one must start with some initial guess of β 0 , isothermically find a local minimum, and afterwards decrease β. Eventually, as β tends to zero, the optimal solution will change slowly while making the relative entropy as small as possible. Here, for the Erdős-Rényi and the planted partition model, we show analytically that correct reconstruction of the empirical density parameters is possible only in the limit β → 0.

B. Erdős-Rényi random graph
The Erdős-Rényi random graph is the simplest example of random graph model [11]. Each pair of nodes is connected by a link with constant probability p. Hence, the expected adjacency matrix and the Laplacian can be written as E[A σ ] = p(1 − I) and E[L σ ] = (n − 1)pI − p(1 − I), where 1 is the n × n matrix of ones and I is the identity matrix. In this case it is possible to analytically find the optimum solution for the problem of relative entropy minimization. The partition function Z σ (n, p) and the ensemble average of the expected Laplacian Tr [ρE [L]] of the model are: where R(n, β) = Tr [1ρ] = ∑ n i,j ρ ij is the grand sum of density matrix. Both Z ρ and F ρ are observation dependent quantities and must be evaluated numerically from the observed network. Finding the minimum of the left hand side of Eq. (12) corresponds to setting to zero its derivative with respect to p: Solving for p we can find an analytical expression for the optimal densityp that can be reconstructed by the model:p The reconstruction of the observed empirical density p * = 2m * /(n(n − 1)) is only possible in the limit β → 0. It can be shown, with the help of computer algebra system, that: We also extended the same calculations to the plantedpartition model, the simplest extension of the Erdős-Rényi model to networks presenting a community structure [44].

C. Planted partition model
In the planted partition model, the nodal block membership vector c i ∈ {0, . . . , b} specifies to which one of the b blocks the node i belongs and it has the role of a hyper-parameter. The model parameters are the intrablock and interblock link densities p in and p out . The expected adjacency matrix E[A] and Laplacian E[L] are: where δ = {δ c i ,c j } is the block assignment matrix. Analogous calculations as in the Erdős-Rényi case can be analytically performed in the planted partition model with exactly b blocks of the same size. In this case the partition function of the model Z σ (p in , p out ) becomes: Setting the gradients of relative entropy (10) to zero, results in a system of two equations: An analytical solution is possible for b = 2 blocks: where R is the grand-sum of ρ and Q = Tr [δρ]. As in the previous case, the empirical intra-block and inter-block densities p * in and p * out can be reconstructed only in the limit of infinite temperature: Unfortunately, though, the calculations performed for these two last examples cannot be straightforwardly extended to the configuration model (UBCM) and other more complex variants of the exponential random graph model, as the expression of the partition function Z σ for general models is too complex for a fully analytical treatment. Therefore, we rely on numerical simulations to show that the limit β → 0 yields a correct reconstruction of model parameters for the UBCM.

D. Configuration model
In the Undirected binary configuration model (UBCM) the model parameters are the hidden variables x = {x i }. Given some network with fixed degree sequence, we can consider its Laplacian L ρ as the Laplacian of a graph sampled from the UBCM ensemble. Importantly, being L ρ a realization of a random graph ensemble, we cannot expect to be able to reconstruct exactly the parameters x * which generated that network. As a demonstration of this concept we generated a random network with n = 40 nodes and a degree sequence sampled from the uniform distribution.
Starting from a random solution x(t 0 , β 0 ), we minimized the relative entropy at an initial guess of β 0 1 to obtain the new solution x(t 1 , β 0 ). This procedure was repeated gradually decreasing β at each iteration, until the solution was not changing considerably, for β close to 0.
As a measure of convergence, we chose the difference of the total number of links, which in thermodynamic interpretation equals to half the difference of the total energies: ∆m = (Tr [E[L σ ]] − Tr L ρ )/2. The bigger the absolute value of ∆m, the less similar the empirical network is from the average realization of the ensemble.
In Figure 1A we plotted the spectral entropies of the empirical network (red line) and the fitted model at optimal solutionx (blue line) as a function of β. Figure 1B shows the difference in the number of links ∆m as a function of β. At the optimal solution for β → 0, there is a small deviation in total number of links (∆m ≈ −3.64). This is explained by the irreversibility of the sampling process, that implies inability to precisely reconstruct the true parameters x * from only one sample. However, the deviation of the reconstructed parametersx from x * can be reduced with enough samples of the random graph ensemble, as shown in Figure 1 (panels C and D).
As a second example we chose a toy network consisting of a number of cliques of increasing size connected in a ring, and one of its degree-preserving random rewiring ( Figure 2C,F). In the ordered case, the clique structure cannot be accounted by a first-order average model alone, making that specific instance highly unlikely in our framework when sampling from the configuration model. Therefore, following the fitting procedure described above, one can see a significant difference in the number of links between model and data ∆m even at a very small beta Figure 2B. In other words, in the ordered case, the degree sequence alone cannot explain the differences in the spectral entropies, thus indicating the presence of genuine regular patterns that substantially alter the properties of diffusion of the random walker defined by the density matrix. Indeed, this difference reflects the intrinsic inability of the model to account for the characteristic structure of the underlying network.
After fitting, non vanishing ∆m serves as an indicator of the presence of ordered patterns in the given network that are not explained by this model alone. To test this idea we applied the same optimization technique to the degree-preserving randomly rewired network in Fig-ure 2F, and plotted the results in Figure 2D,E. In this case the random rewiring made the empirical network more adherent to the optimal reconstruction by the model and the difference in the total number of links at β close to zero is much smaller than in the ordered case. This is also evident by the better adherence in the spectral entropies, as shown in Figure 2D.
Importantly, the spectral entropy optimization framework described above can be applied to descriptive network models other than those described by the exponential random graph model.

V. SPATIAL MODELS
The embedding of a network in a two or three dimensional space has bearings on its topological properties. When the formation of links has a cost associated with distance, the model must accomodate additional spatial constraints, which introduce correlation between topological and geometrical organization [45]. An example is represented by neural networks, in which communication between neurons implies a metabolic cost that depends on their distance [46,47]. The material and metabolic constraints of neuronal wiring are factors that contributed to shaping brain architecture [46,48,49]. Computational and empirical studies converged on the result that a multiscale organization of modules inside modules is the one that satisfies the constraints imposed by minimization of energetic cost and spatial embedding [46,47,50,51]. Here, wiring cost includes the physical volume of axons and synapses, the energetic demand for signal transmission, additional processing cost for noise correction over long distance signaling and sustenance of the necessary neuroglia that support neuronal activities [46]. Therefore, it is tempting to assume that the expected number of neural fibers between two areas could be expressed as a decreasing function of their length. With this hypothesis in mind, we verified the ability of our optimization approach to work with a simple descriptive model of the observed neural connectivity in the macaque cortex [52,53]. The model, called Exponential Distance Rule (EDR), is a dense weighted network model describing the decline in the expected number of axonal projections w ij as a function of the inter-areal distances d ij and a tunable decay parameter ∈ R: where C is a normalization constant. Here, the distances d ij are measured along the shortest path connecting areas via white matter, approximating the axonal distance [52]. We used a dataset of cortico-cortical connectivity generated from retrograde tracing experiments in the macaque  Figure 1: Normalized von Neumann entropy and reconstruction error of a random network (top panels) and its ensemble average with the same degree sequence (bottom panels). In panels A,D the red curves are the spectral entropy of the observed network described by density ρ, blue curves are the spectral entropies of the model network at optimum parameters σ(θ). In panel B a systematic error exists at every β (even in the limit β → 0): in the spectral framework the UBCM cannot fit all the specific properties of the highly ordered network. On the other hand, an ensemble average network has a structure that can be better reconstructed by the UBCM, as shown by the error ∆m going to zero in Panel E.
brain [52,53]. Following the procedure introduced in the previous sections, we fitted the macaque connectome network with the EDR model. Differently from the random graph models described in previous sections, we found an optimal inverse-temperature parameter β that minimizes the reconstruction error, as shown in Figure 3B. At this optimal β * ≈ 3.05 the reconstructed decay pa-rameter˜ = 0.1505 [mm] −1 is comparable to the values obtained by the three methods applied in the original paper from Ref [53]. The non-vanishing difference in total weights between reconstructed and object networks indicates that the model cannot account completely for the structures such as the high density core observed in the connectome [53]. Hence, a non-zero optimal value for β suggests the existence of a scale at which the model best describes the topological properties of the network.

VI. CONCLUSION
The spectral entropies framework enables comparing networks taking into account the whole structure at multiple scales. However, this approach introduces a hyperparameter β that plays the role of an inverse temperature, and whose tuning is critical for the correct estimate of the model parameters.
Leveraging a thermodynamic analogy, we have shown that the optimal value of the hyperparameter is model dependent and reflects the scales at which the model best describes the empirical network. Moreover, we have described procedures to determine β for the model parameter optimization and for a tractable approximation of the expected relative entropy.
Specifically, we focused on three examples from the exponential random graph model, namely the Erdős-Rényi, a planted partition and undirected binary configuration model. In the Erdős-Rényi model and in the planted par-  Figure 2: Normalized von Neumann entropy and reconstruction error of two networks: a ring of cliques (top panels) and its degree-preserving random rewiring (bottom panels). In panels A,D the red curves are the spectral entropy of the observed network described by density ρ, blue curves are the spectral entropies of the model network at optimum parameters σ(θ). In panel B a systematic error exists at every β (even in the limit β → 0): the UBCM cannot fit all the specific properties of the highly ordered network. On the other hand, a degree preserving rewired network has a structure that can be better reconstructed by the UBCM, as shown by the error ∆m going to zero in Panel E.
tition model, we analytically demonstrated that correct reconstruction is possible only in the infinite temperature limit. In the configuration model this hypothesis was verified numerically. The presence of ordered structures unaccounted for by the model is reflected in a bias of the total energy, corresponding to the total number of links in the reconstructed network. Motivated by these findings in synthetic networks, we applied the spectral entropy framework to a real-world network of the macaque brain structural connectome. A structural connectome is a spatial network whose development is thought to be constrained by geometrical and wiring cost factors. Hence, we evaluated an exponential distance rule model that assumes that the weight of interareal connections is a decreasing function of distance. We demonstrate the existence of a non-zero optimal value of β for the computation of model parameters. However, the residual energy bias indicates the network structure at certain scales cannot be described by the exponential distance rule model alone.
The procedures demonstrated here make it possible to use relative entropy methods for practical applications to the study of models of real-world networks, effectively realizing a conceptual step from classical maximum likelihood methods to their density matrix based counterparts.

ACKNOWLEDGMENTS
This project has received funding from the European Union's Horizon 2020 Research and Innovation Program under grant agreement No 668863.

Appendix A: Approximation of expected relative entropy
We can exploit the commutativity and linearity of the trace and expectation operators to obtain a simpler ex-  Figure 3: Normalized von Neumann entropy and reconstruction error of the macaque brain connectivity network (panel C). In panel A the red curve is the spectral entropy of the observed network described by density ρ, blue curve is the spectral entropy of the model network at optimum parameter σ(θ). The optimal hyperparameter β is found in panel B where the reconstruction error ∆m achieve its minimum denoted by a red dot.
pression for the expected relative entropy: ]. An analytical estimate of the expected Laplacian as function of the parameters θ can readily be obtained, but computation of the expected log-partition function E θ [log Z(θ)] is more difficult and requires techniques from random matrix theory [37][38][39]. This is clear as the trace of a matrix is equal to the sum of its eigenvalues, yielding: We can estimate the expected log-partition function by means of matrix concentration arguments [54,55]. A random matrix is said to concentrate when, given some spectral norm, one can tightly bound the spectral norm of the difference from its expected value [56]. In the case of network-related matrices, the eigenvalues of the Laplacian and those of its expectation are strictly related and can be tightly bounded with high probability [55,57,58]. This approximation becomes more precise, the larger and denser the graphs are [59,60], an effect of the concentration of measure phenomenon. Therefore, following the ideas presented in references [55,57] that apply in our same settings, we replace λ i (L(θ)) with their counterparts from the expected Laplacian λ i (E θ [L]). Substituting back, we recover an expression that involves the relative entropy between the observed density and the density of the expected Laplacian: so we can simply compute the second term involving the log-trace by standard calculus tools. After some algebraic manipulation, we finally arrive to the expression for the derivative of the relative entropy with respect to the model parameters as described in the main text: