diff --git "a/data_all_eng_slimpj/shuffled/split2/finalzzlxut" "b/data_all_eng_slimpj/shuffled/split2/finalzzlxut" new file mode 100644--- /dev/null +++ "b/data_all_eng_slimpj/shuffled/split2/finalzzlxut" @@ -0,0 +1,5 @@ +{"text":"\\section{\\@startsection {section}{1}{\\z@}{-3ex \\@plus -1ex \\@minus -.2ex}{2ex \\@plus.2ex}{\\normalfont\\large\\bfseries}}\n\\renewcommand\\subsection{\\@startsection{subsection}{2}{\\z@}{-2.5ex\\@plus -1ex \\@minus -.2ex}{1.5ex \\@plus .2ex}{\\normalfont\\normalsize\\bfseries}}\n\\renewcommand\\subsubsection{\\@startsection{subsubsection}{3}{\\z@}{-2ex\\@plus -1ex \\@minus -.2ex}{1ex \\@plus .2ex}{\\normalfont\\normalsize\\bfseries}}\n \\renewcommand\\paragraph{\\@startsection{paragraph}{4}{\\z@}{1.5ex \\@plus.5ex \\@minus.2ex}{-1em}{\\normalfont\\normalsize\\bfseries}}\n\\renewcommand\\subparagraph{\\@startsection{subparagraph}{5}{\\parindent} {1.5ex \\@plus.5ex \\@minus .2ex} {-1em} {\\normalfont\\normalsize\\bfseries}}\n\\makeatother\n\\renewcommand{\\thefootnote}{\\fnsymbol{footnote}}\t\n\\newcommand{\\mathcal{P}}{\\mathcal{P}}\n\\newcommand{\\RP}[1]{\\mathcal{P}\\!\\langle#1\\rangle}\n\\newcommand{\\mathcal{Q}}{\\mathcal{Q}}\n\\newcommand{\\mathcal{C}}{\\mathcal{C}}\n\\newcommand{\\mathbb{N}}{\\mathbb{N}}\n\\DeclarePairedDelimiter\\ceil\\lceil\\rceil\n\\DeclarePairedDelimiter\\floor\\lfloor\\rfloor\n\\renewcommand{\\geq}{\\geqslant}\n\\renewcommand{\\leq}{\\leqslant}\n\n\\begin{document}\n\n{\\Large\\bfseries\\boldmath\\scshape Bad News for Chordal Partitions}\n\n\\medskip\nAlex Scott\\footnotemark[3] \\quad\nPaul Seymour\\footnotemark[4] \\quad\nDavid R. Wood\\footnotemark[5]\n\n\\DateFootnote\n\n\\footnotetext[3]{Mathematical Institute, University of Oxford, Oxford, U.K.\\ (\\texttt{scott@maths.ox.ac.uk}).}\n\n\\footnotetext[4]{Department of Mathematics, Princeton University, New Jersey, U.S.A. (\\texttt{pds@math.princeton.edu}). Supported by ONR grant N00014-14-1-0084 and NSF grant DMS-1265563.}\n\n\\footnotetext[5]{School of Mathematical Sciences, Monash University, Melbourne, Australia\\\\ (\\texttt{david.wood@monash.edu}). Supported by the Australian Research Council.}\n\n\\emph{Abstract.} Reed and Seymour [1998] asked whether every graph has a partition into induced connected non-empty bipartite subgraphs such that the quotient graph is chordal. If true, this would have significant ramifications for Hadwiger's Conjecture. We prove that the answer is `no'. In fact, we show that the answer is still `no' for several relaxations of the question.\n\n\\bigskip\n\n\\medskip\n\n\\hrule\n\n\\bigskip\n\n\\renewcommand{\\thefootnote}{\\arabic{footnote}}\t\n\\section{Introduction}\n\nHadwiger's Conjecture \\citep{Hadwiger43} says that for all $t\\geq 0$ every graph with no $K_{t+1}$-minor is $t$-colourable. This conjecture is easy for $t\\leq 3$, is equivalent to the 4-colour theorem for $t=4$, is true for $t=5$ \\citep{RST-Comb93}, and is open for $t\\geq 6$. The best known upper bound on the chromatic number is $O(t\\sqrt{\\log t})$, independently due to \\citet{Kostochka82,Kostochka84} and \\citet{Thomason84,Thomason01}. This conjecture is widely considered to be one of the most important open problems in graph theory; see \\citep{SeymourHC} for a survey. \n\nThroughout this paper, we employ standard graph-theoretic definitions (see \\citep{Diestel4}), with one important exception: we say that a graph $G$ \\emph{contains} a graph $H$ if $H$ is isomorphic to an induced subgraph of $G$. \n \nMotivated by Hadwiger's Conjecture, \\citet{ReedSeymour-JCTB98} introduced the following definitions\\footnote{\\citet{ReedSeymour-JCTB98} used different terminology: `chordal decomposition' instead of chordal partition, and `touching pattern' instead of quotient.}. A \\emph{vertex-partition}, or simply \\emph{partition}, of a graph $G$ is a set $\\mathcal{P}$ of non-empty induced subgraphs of $G$ such that each vertex of $G$ is in exactly one element of $\\mathcal{P}$. Each element of $\\mathcal{P}$ is called a \\emph{part}. The \\emph{quotient} of $\\mathcal{P}$ is the graph, denoted by $G\/\\mathcal{P}$, with vertex set $\\mathcal{P}$ where distinct parts $P,Q\\in \\mathcal{P}$ are adjacent in $G\/\\mathcal{P}$ if and only if some vertex in $P$ is adjacent in $G$ to some vertex in $Q$. A partition of $G$ is \\emph{connected} if each part is connected. We (almost) only consider connected partitions. In this case, the quotient is the minor of $G$ obtained by contracting each part into a single vertex. A partition is \\emph{chordal} if it is connected and the quotient is chordal (that is, contains no induced cycle of length at least four). Every graph has a chordal partition (with a 1-vertex quotient). Chordal partitions are a useful tool when studying graphs $G$ with no $K_{t+1}$ minor. Then for every connected partition $\\mathcal{P}$ of $G$, the quotient $G\/\\mathcal{P}$ contains no $K_{t+1}$, so if in addition $\\mathcal{P}$ is chordal, then $G\/\\mathcal{P}$ is $t$-colourable (since chordal graphs are perfect). \\citet{ReedSeymour-JCTB98} asked the following question (repeated in \\citep{KawaReed08,SeymourHC}). \n\n\\begin{ques} \n\\label{ChordalPartition}\nDoes every graph have a chordal partition such that each part is bipartite?\n\\end{ques} \n\nIf true, this would imply that every graph with no $K_{t+1}$-minor is $2t$-colourable, by taking the product of the $t$-colouring of the quotient with the 2-colouring of each part. This would be a major breakthrough for Hadwiger's Conjecture. The purpose of this note is to answer Reed and Seymour's question in the negative. In fact, we show the following stronger result. \n\n\\begin{thm}\n\\label{NoChordal}\nFor every integer $k\\geq 1$ there is a graph $G$, such that for every chordal partition $\\mathcal{P}$ of $G$, some part of $\\mathcal{P}$ contains $K_k$. \nMoreover, for every integer $t\\geq 4$ there is a graph $G$ with tree-width at most $t-1$ (and thus with no $K_{t+1}$-minor) such that \nfor every chordal partition $\\mathcal{P}$ of $G$, some part of $\\mathcal{P}$ contains a complete graph on at least $\\floor{(3t-11)^{1\/3}}$ vertices. \n\\end{thm}\n\n\\cref{NoChordal} says that it is not possible to find a chordal partition in which each part has bounded chromatic number. What if we work with a larger class of partitions? The following natural class arises. A partition of a graph is \\emph{perfect} if it is connected and the quotient graph is perfect. If $\\mathcal{P}$ is a perfect partition of a $K_{t+1}$-minor free graph $G$, then $G\/\\mathcal{P}$ contains no $K_{t+1}$ and is therefore $t$-colourable. So if every part of $\\mathcal{P}$ has small chromatic number, then we can control the chromatic number of $G$. We are led to the following relaxation of \\cref{ChordalPartition}: does every graph have a perfect partition in which every part has bounded chromatic number? Unfortunately, this is not the case.\n\n\\begin{thm}\n\\label{NoPerfect}\nFor every integer $k\\geq 1$ there is a graph $G$, such that for every perfect partition $\\mathcal{P}$ of $G$, some part of $\\mathcal{P}$ contains $K_k$. \nMoreover, for every integer $t\\geq 6 $ there is a graph $G$ with tree-width at most $t-1$ (and thus with no $K_{t+1}$-minor), \nsuch that for every perfect partition $\\mathcal{P}$ of $G$, some part of $\\mathcal{P}$ contains a complete graph on at least $\\floor{(\\frac{3}{2}t-8)^{1\/3}}$\n vertices. \n\\end{thm}\n\n\\cref{NoChordal,NoPerfect} say that it is hopeless to improve on the $O(t\\sqrt{\\log t})$ bound for the chromatic number of $K_t$-minor-free graphs using chordal or perfect partitions directly. Indeed, the best possible upper bound on the chromatic number using the above approach would be $O(t^{4\/3})$ (since the quotient is $t$-colourable, and the best possible upper bound on the chromatic number of the parts would be $O(t^{1\/3})$.)\\ \n\nWhat about using an even larger class of partitions? Chordal graphs contain no 4-cycle, and perfect graphs contain no 5-cycle. These are the only properties of chordal and perfect graphs used in the proofs of \\cref{NoChordal,NoPerfect}. Thus the following result is a qualitative generalisation of both \\cref{NoChordal,NoPerfect}. It says that there is no hereditary class of graphs for which the above colouring strategy works.\n\n\\begin{thm}\n\\label{General}\nFor every integer $k\\geq 1$ and graph $H$, there is a graph $G$, such that for every connected partition $\\mathcal{P}$ of $G$, either some part of $\\mathcal{P}$ contains $K_k$ or the quotient $G\/\\mathcal{P}$ contains $H$. \n\\end{thm}\n\n\nBefore presenting the proofs, we mention some applications of chordal partitions and related topics. Chordal partitions have proven to be a useful tool in the study of the following topics for $K_{t+1}$-minor-free graphs: cops and robbers pursuit games \\citep{Andreae86}, fractional colouring \\citep{ReedSeymour-JCTB98,KawaReed08}, generalised colouring numbers \\citep{HOQRS17}, and defective and clustered colouring \\citep{vdHW}. These papers show that every graph with no $K_{t+1}$ minor has a chordal partition in which each part has desirable properties. For example, in \\citep{ReedSeymour-JCTB98}, each part has a stable set on at least half the vertices, and in \\citep{vdHW}, each part has maximum degree $O(t)$ and is 2-colourable with monochromatic components of size $O(t)$. \n\nSeveral papers \\citep{DMW05,KP-DM08,Wood-JGT06} have shown that graphs with tree-width $k$ have chordal partitions in which the quotient is a tree, and each part induces a subgraph with tree-width $k-1$, amongst other properties. Such partitions have been used for queue and track layouts \\citep{DMW05} and non-repetitive graph colouring \\citep{KP-DM08}. A \\emph{tree partition} is a (not necessarily connected) partition of a graph whose quotient is a tree; these have also been widely studied \\citep{Edenbrandt86,Halin91,Seese85,Wood09,DO95,DO96,BodEng-JAlg97,Bodlaender-DMTCS99}. Here the goal is to have few vertices in each part of the partition. For example, a referee of \\citep{DO95} proved that every graph with tree-width $k$ and maximum degree $\\Delta$ has a tree partition with $O(k\\Delta)$ vertices in each part. \n\n\\section{Chordal Partitions: Proof of \\cref{NoChordal}}\n\nLet $\\mathcal{P}=\\{P_1,\\dots,P_m\\}$ be a partition of a graph $G$, and let $X$ be an induced subgraph of $G$. Then the \\emph{restriction} of $\\mathcal{P}$ to $X$ is the partition of $X$ defined by $$\\RP{X} := \\{G[V(P_i)\\cap V(X)]:i\\in\\{1,\\dots,m\\},V(P_i)\\cap V(X)\\neq\\emptyset\\}.$$ Note that the restriction of a connected partition to a subgraph need not be connected. The following lemma gives a scenario where the restriction is connected. \n\n\\begin{lem}\n\\label{InducedPartition}\nLet $X$ be an induced subgraph of a graph $G$, such that the neighbourhood of each component of $G-V(X)$ is a clique (in $X$). \nLet $\\mathcal{P}$ be a connected partition of $G$ with quotient $G\/\\mathcal{P}$. Then $\\RP{X}$ is a connected partition of $X$, \nand the quotient of $\\RP{X}$ is the subgraph of $G\/\\mathcal{P}$ induced by those parts that intersect $X$. \n\\end{lem}\n\n\\begin{proof}\nWe first prove that for every connected subgraph $G'$ of $G$, if $V(G')\\cap V(X)\\neq\\emptyset$, then $G'[V(G')\\cap V(X)]$ is connected. Consider non-empty sets $A,B$ that partition $V(G')\\cap V(X)$. Let $P$ be a shortest path from $A$ to $B$ in $G'$. Then no internal vertex of $P$ is in $V(X)$. If $P$ has an internal vertex, then all its interior belongs to one component $C$ of $G-V(X)$, implying the endpoints of $P$ are in the neighbourhood of $C$ and are therefore adjacent, a contradiction. Thus $P$ has no interior, and hence $G'[V(G')\\cap V(X)]$ is connected. \n\nApply this observation with each part of $\\mathcal{P}$ as $G'$. It follows that $\\RP{X}$ is a connected partition of $X$. Moreover, if adjacent parts $P$ and $Q$ of $\\mathcal{P}$ both intersect $X$, then by the above observation with $G'=G[V(P)\\cup V(Q)]$, there is an edge between $V(P)\\cap V(X)$ and $V(Q)\\cap V(X)$. Conversely, if there is an edge between $V(P)\\cap V(X)$ and $V(Q)\\cap V(X)$ for some parts $P$ and $Q$ of $\\mathcal{P}$, then $PQ$ is an edge of $G\/\\mathcal{P}$. Thus the quotient of $\\RP{X}$ is the subgraph of $G\/\\mathcal{P}$ induced by those parts that intersect $X$. \n\\end{proof}\n\nThe next lemma with $r=1$ implies \\cref{NoChordal}. To obtain the second part of \\cref{NoChordal} apply \\cref{ChordalWork} with $k=\\floor{(3t-11)^{1\/3}}$, in which case $s(k,1)\\leq t$. \n\n\\begin{lem}\n\\label{ChordalWork}\nFor all integers $k\\geq 1$ and $r\\geq 1$, if \n$$s(k,r):=\\tfrac13(k^3-k) +(r-1)k + 4 , $$\nthen there is a graph $G(k,r)$ with tree-width at most $s(k,r)-1$ (and thus with no $K_{s(k,r)+1}$-minor), \nsuch that for every chordal partition $\\mathcal{P}$ of $G$, either:\\\\\n(1) $G$ contains a $K_{kr}$ subgraph intersecting each of $r$ distinct parts of $\\mathcal{P}$ in $k$ vertices, or\\\\\n(2) some part of $\\mathcal{P}$ contains $K_{k+1}$.\n\\end{lem}\n\n\\begin{proof}\nNote that $s(k,r)$ is the upper bound on the size of the bags in the tree-decomposition of $G(k,r)$ that we construct. We proceed by induction on $k$ and then $r$. \nWhen $k=r=1$, the graph with one vertex satisfies (1) for every chordal partition and has a tree-decomposition with one bag of size $1 0$ corresponds to inward mass flow\\footnote{This is the opposite of the sign convention used in \\cite{2012ApJ...754...48F,2014MNRAS.443..168F}, but consistent with the one used in \\cite{2018MNRAS.477.2716K}.}. This gives\n\\begin{equation}\n \\frac{\\partial \\Sigma_Z}{\\partial t} - \\frac{1}{2\\pi r}\\frac{\\partial}{\\partial r}\\left(\\dot{M} Z\\right) - \\frac{1}{r}\\frac{\\partial}{\\partial r}\\left(r\\kappa\\Sigma_g \\frac{\\partial Z}{\\partial r}\\right) = S_Z.\n \\label{eq:cont_metals}\n\\end{equation}\n\nSimilarly, since star formation is the process that is responsible for the source term, it is convenient to parameterize $S_Z$ in terms of the star formation rate. We adopt the instantaneous recycling approximation \\citep{1980FCPh....5..287T}, whereby some fraction, $f_{\\rm R,inst}$, of the mass incorporated into stars is assumed to be left in long-lived remnants (compact objects and low-mass stars), and the remainder of the mass is returned instantaneously to the ISM through Type II supernovae, enriched by newly formed metals with a yield $y$. Under this approximation, we have\n\\begin{equation}\n S_Z = \\left(y - f_{\\rm R,inst} Z - \\mu Z_w\\right) \\dot{\\Sigma}_\\star,\n\\label{eq:source}\n\\end{equation}\nwhere $\\dot{\\Sigma}_\\star$ is the star formation rate surface density. The last term in \\autoref{eq:source} represents loss of metals into a galactic wind; here $\\mu$ is the mass loading factor of the wind (\\textit{i.e.,} the wind mass flux is $\\mu \\dot{\\Sigma}_\\star$) and $Z_w$ is the metallicity of the wind. Following \\citet[equation~41]{2019MNRAS.487.3581F}, we further parameterize the wind metallicity as\n\\begin{equation}\n Z_w = Z + \\xi \\frac{y}{\\mathrm{max}(\\mu,1-f_{\\mathrm{R,inst}})},\n\\label{eq:Zw}\n\\end{equation}\nwhere the $1 - f_{\\rm{R,inst}}$ limit specifies the minimum mass that can be ejected if some metals are ejected directly after production. The parameter $\\xi$, which is bounded in the range $0\\leq \\xi \\leq 1$, specifies the fraction of metals produced that are directly ejected from the galaxy before they are mixed into the ISM. So, $\\xi=0$ corresponds to a situation when the metallicity of the wind equals the metallicity of the ISM, whereas $\\xi=1$ corresponds to the regime when all the metals produced in the galaxy get ejected in winds. \\cite{2014MNRAS.438.1552F,2014MNRAS.443..168F} introduced $\\xi$ to relax the assumption that metals fully mix with the ISM before winds are launched, so that $Z_w=Z$. A number of authors have shown that this assumption leads to severe difficulties in explaining observations, particularly in low-mass systems \\citep{1993A&A...277...42P,1994MNRAS.270...35M,1999ApJ...513..142M,2001MNRAS.322..800R,2008A&A...489..555R,2002ApJ...574..663M,2017ApJ...835..136R}. \n\nWe can further simplify by writing down the continuity equation for the total gas surface density $\\Sigma_g$, which is \\autoref{eq:cont_metals} with $Z$ fixed to unity and $y=0$, with an additional term for cosmic accretion,\\footnote{Note that \\autoref{eq:sigmagas_evol} is identical to equation 1 of \\cite{2019MNRAS.487.3581F} except that \\citeauthor{2019MNRAS.487.3581F} adopt instantaneous recycling only for Type II supernovae, and not for metals returned on longer timescales (e.g., Type Ia or AGB winds). While this approach is feasible in simulations and semi-analytic models, it renders analytic models of the type we present here intractable. However, this does not make a significant difference for our work because the most common gas phase metallicity tracer, O, comes almost solely from Type II supernovae. One area where our approach might cause concern is at high redshift, where the gradients are often measured through the [\\ion{N}{ii}]\/\\ion{H}{$\\alpha$} emission line ratio, because most of the N comes from AGB stars and is released over Gyr or longer timescales \\citep{2005ARA&A..43..435H}.}\n\\begin{equation}\n \\frac{\\partial \\Sigma_g}{\\partial t} - \\frac{1}{2\\pi r} \\frac{\\partial\\dot{M}}{\\partial r} = \\dot \\Sigma_{\\mathrm{cos}} -\\left(f_{\\rm R,inst} + \\mu\\right)\\dot{\\Sigma}_\\star\\,,\n \\label{eq:sigmagas_evol}\n\\end{equation}\nwhere $\\dot \\Sigma_{\\rm{cos}}$ is the cosmic accretion rate surface density onto the disc \\citep{2010MNRAS.406.2325O,2010PhR...495...33B}. If we now use this to evaluate $\\partial \\Sigma_Z\/\\partial t = \\Sigma_g (\\partial Z\/\\partial t) + Z (\\partial\\Sigma_g\/\\partial t)$ in \\autoref{eq:cont_metals}, the result is\n\\begin{equation}\n \\Sigma_g \\frac{\\partial Z}{\\partial t} - \\frac{\\dot{M}}{2\\pi r}\\frac{\\partial Z}{\\partial r} - \\frac{1}{r}\\frac{\\partial}{\\partial r}\\left(r \\kappa \\Sigma_g \\frac{\\partial Z}{\\partial r}\\right)\n = \\phi_y y \\dot{\\Sigma}_\\star - Z\\dot \\Sigma_{\\mathrm{cos}}\\,,\n \\label{eq:metal_continuity_2}\n\\end{equation}\nwhere\n\\begin{equation}\n \\phi_y = 1 - \\frac{\\mu\\xi}{\\max(\\mu,1-f_{\\rm R,inst})}.\n\\label{eq:phiy}\n\\end{equation}\nWe refer to $\\phi_y$, which is bounded in the range $0\\leq \\phi_y\\leq 1$, as the yield reduction factor. Note that $f_{\\rm{R,inst}}$ only appears in $\\phi_y$, implying that metals locked in stars are unimportant for the radial profile of metallicity as long as $\\mu > 1-f_{\\mathrm{R,inst}}$.\n\nFrom left to right, we can interpret the terms in \\autoref{eq:metal_continuity_2} as follows: the first is the rate of change in the metallicity at fixed gas surface density; the second represents the change due to advection of metals through the disc; the third represents the change due to diffusion of metals; finally, the terms on the right hand side are: (1.) the change in metallicity due to metal production in stars, with an effective yield $\\phi_y y$ that is reduced relative to the true yield $y$ by the factor $\\phi_y$, and (2.) the change in metallicity in the disc due to cosmic accretion of metal-poor gas. \n\nThe term $\\phi_y$ represents the factor by which the effective metal yield is reduced because some fraction of metals directly escape the galaxy before they mix with the ISM. Higher values of $\\phi_y$ imply that metals are well-mixed into the ISM, whereas lower values imply that the yield is significantly reduced by preferential ejection of unmixed metals. However, $\\phi_y$ does not equate to the mass loading factor $\\mu$: galaxies with heavily mass-loaded winds (high $\\mu$) may still have $\\phi_y$ close to unity if metals mix efficiently before the winds are launched; conversely, galaxies with weakly mass-loaded winds (low $\\mu$) may still have small $\\phi_y$ if those winds preferentially carry away metals. We discuss the possible range of values for $\\phi_y$ in more detail in \\autoref{s:metalevolve_krumholz2018} \\citep[see also,][]{2020aMNRAS.xxx..xxxS}.\n\nAt this point it is helpful to non-dimensionalise the system. We choose a fiducial radius $r_0$, which we will later take to be the inner edge of the disc where the bulge begins to dominate; for now, however, we simply take $r_0$ as a specified constant. We measure position in the disc with the dimensionless variable $x = r\/r_0$ and time with $\\tau = t\\Omega_0$, where $\\Omega_0$ is the angular velocity at $r_0$. We further write out the profiles of gas surface density, diffusion coefficient, star formation surface density and cosmic accretion rate surface density as $\\Sigma_g = \\Sigma_{g0} s_g(x)$, $\\kappa = \\kappa_0 k(x)$, $\\dot{\\Sigma}_\\star = \\dot{\\Sigma}_{\\star0} \\dot{s}_{\\star}(x)$, and $\\dot{\\Sigma}_{\\rm{cos}} = \\dot{\\Sigma}_{\\rm{cos}0} \\dot c_{\\star}(x)$ respectively. Here, the terms subscripted by 0 are the values evaluated at $r = r_0$, and $s_g(x)$, $k(x), \\dot{s}_\\star(x)$, and $\\dot c_{\\star} (x)$ are dimensionless functions that are constrained to have a value of unity at $x=1$. Note that, in principle, we could introduce a similar scaling function for $\\dot{M}$; we do not do so because both observations \\citep{2016MNRAS.457.2642S} and theoretical models \\citep{2018MNRAS.477.2716K} suggest that, in steady state, $\\dot{M}$ is close to constant with radius within a galactic disc. We express the metallicity as $\\mathcal{Z} = Z\/Z_{\\odot}$.\n\nUsing these definitions, we can rewrite \\autoref{eq:metal_continuity_2} as a form of the Euler-Cauchy equation \\citep{garfken67:math,kreyszig11},\n\\begin{equation}\n \\underbrace{\\mathcal{T} s_g \\frac{\\partial \\mathcal{Z}}{\\partial \\tau}}_{\\substack{\\text{equilibrium} \\\\ \\text{time}}} - \\underbrace{\\frac{\\mathcal{P}}{x} \\frac{\\partial \\mathcal{Z}}{\\partial x}}_\\text{advection} - \\underbrace{\\frac{1}{x}\\frac{\\partial}{\\partial x}\\left(x k s_g \\frac{\\partial \\mathcal{Z}}{\\partial x}\\right)}_\\text{diffusion}\\,\\,\n = \\underbrace{\\mathcal{S} \\dot{s}_\\star}_{\\substack{\\text{production} \\\\ \\text{+} \\\\ \\text{outflows}}} - \\underbrace{\\mathcal{Z}\\mathcal{A}\\dot c_{\\star}}_\\text{accretion}.\n \\label{eq:main_nondimx}\n\\end{equation}\nIn the above equation, we have suppressed the $x$-dependence of $s_g$, $k, \\dot{s}_\\star$ and $\\dot{c}_\\star$ for compactness, and we have defined, \n\\begin{eqnarray}\n\\mathcal{T} & = &\n\\frac{\\Omega_0 r^2_0}{\\kappa_0} \\\\\n\\mathcal{P} & = &\n\\frac{\\dot{M}}{2\\pi \\kappa_0 \\Sigma_{g0}} \\\\\n\\mathcal{S} & = &\nr^2_0\\frac{\\dot{\\Sigma}_{\\star0} }{\\kappa_0\\Sigma_{g0}}\\left(\\frac{\\phi_y y}{Z_{\\odot}}\\right)\\\\\n\\mathcal{A} & = &\nr^2_0\\frac{\\dot{\\Sigma}_{\\mathrm{cos}0}}{\\kappa_0\\Sigma_{g0}}.\n\\end{eqnarray}\nThe four quantities $\\mathcal{T},\\,\\mathcal{P}, \\mathcal{S}$ and $\\mathcal{A}$ have straightforward physical interpretations: $\\mathcal{T}$ is the ratio of the orbital and diffusion timescales, $\\mathcal{P}$ is the P\\'eclet number of the system, which describes the relative importance of advection and diffusion in fluid dynamics (e.g., \\citealt{patankar1980numerical}), $\\mathcal{S}$ measures the relative importance of metal production (the numerator) and diffusion (the denominator), and $\\mathcal{A}$ measures the relative importance of cosmic accretion and diffusion. $\\mathcal{T}$ dictates the time it takes for a given metallicity distribution to reach equilibrium in a galaxy, whereas the other three quantities govern the type and strength of the gradients that form in equilibrium.\n\nWe will only look for the steady-state or \\textit{equilibrium} solutions to \\autoref{eq:main_nondimx}, so we drop the $\\partial\\mathcal{Z}\/\\partial \\tau$ term. This approach is reasonable because, as we will show below, the equilibration timescale for metals is less than the Hubble time, $t_{\\rm{H(z)}}$, for most galaxies. In our model, the time it takes for the metallicity gradient to approach an equilibrium state, $t_{\\rm{eqbm}}$, is based on the time it takes for the metal surface density to adjust to changes in metallicity triggered by each of the terms in \\autoref{eq:main_nondimx},\n\\begin{equation}\n\\frac{1}{t_{\\mathrm{eqbm}}} = \\Omega_0 \\frac{\\big\\lvert \\frac{\\mathcal{P}}{x}\\frac{\\partial \\mathcal{Z}}{\\partial x}\\big\\rvert + \\big\\lvert\\frac{1}{x}\\frac{\\partial}{\\partial x}\\left(x k s_g\\frac{\\partial \\mathcal{Z}}{\\partial x}\\right)\\big\\rvert + \\big\\lvert\\mathcal{S}\\dot s_{\\star}\\big\\rvert + \\big\\lvert\\mathcal{Z}\\mathcal{A} \\dot c_{\\star}\\big\\rvert}{\\mathcal{Z}s_g\\mathcal{T}}\\,.\n\\label{eq:teqbm} \n\\end{equation}\nIf $t_{\\rm{eqbm}} > t_{\\rm{H(z)}}$, the metallicity gradient in the galaxy cannot attain equilibrium within a reasonable time, and the model we present below does not apply. While this is a necessary condition for metal equilibrium, it may not be sufficient. This is because if input parameters to the metallicity model (e.g., accretion rate, surface density, etc.) change on timescales much shorter than $t_{\\rm{H(z)}}$, the equilibrium of metals will depend on that timescale. For a steady-state model like ours, it is safe to assume this is not the case, since the input galactic disc model in the next Section we use is an equilibrium model. We discuss this condition in more detail in \\autoref{s:gradients} and \\autoref{s:noneqbm} where we also compare $t_{\\rm{eqbm}}$ with the molecular gas depletion time that dictates the star formation timescale.\n\nThe accretion of material from the CGM can also impact metallicity in the galactic disc \\citep{2012ApJ...745...50W,2012ApJ...753...16K,2012ApJ...754...48F,2015MNRAS.448.1835T,2017ARA&A..55..389T,2019ApJ...884..156S}. While this is an important consideration, in the absence of which `closed-box' galaxy models overestimate metallicity gradients (e.g., \\citealt{2007ApJ...658..941D,2013ApJ...771L..19Z,2015MNRAS.450..342K}), it typically adds a floor metallicity at the outer edge of the galactic disc, and is of concern for simulations where the entire (star-forming as well as passive) disc up to tens of $\\rm{kpc}$ is considered. CGM metallicity can also be important for long term $\\left(0.1-1\\,t_{\\rm{H(z)}}\\right)$ wind recycling \\citep{2013MNRAS.431.3373H,2020ApJ...905....4P}, which we do not take into account in this model. As we show later in \\autoref{s:modelevolve_solution}, we make use of this effect only as a boundary condition on the metallicity at the outer edge of the disc, and do not include it directly in the evolution equation. \n\nThis completes the basic formulation of the theory of metallicity gradients in galaxies. To further solve for the equilibrium metallicity, we now need a model of the galactic disc. We use the unified galactic disc model of \\cite{2018MNRAS.477.2716K} for this purpose. However, we remind the reader that the metallicity evolution described by \\autoref{eq:main_nondimx} can be used with other galactic disc models as well.\n\n\n\\subsection{Galactic disc model}\n\\label{s:metalevolve_krumholz2018}\nWe use the unified galactic disc model of \\cite{2018MNRAS.477.2716K} to further solve for metallicity. This model self-consistently incorporates all of the ingredients that we require as inputs: profiles of $\\Sigma_g$, $\\dot M$, $\\kappa$ and $\\dot \\Sigma_{\\star}$, and the relationship between them. We refer the reader to \\cite{2018MNRAS.477.2716K} for full details of the model, and here, we simply extract the portions that are relevant for this work.\n\nFirstly, note that the angular velocity at $r_0$ is simply,\n\\begin{equation}\n \\Omega_0 = \\frac{v_{\\phi}}{r_0}\n\\label{eq:orbital}\n\\end{equation}\nwhere $v_{\\phi}$ is the rotational velocity of gas in the galactic disc. We can solve for the gas surface density $\\Sigma_g$ by requiring that the Toomre $Q$ parameter for stars and gas is close to 1; formally, following \\cite{2014MNRAS.438.1552F}, we take $Q=Q_{\\rm min}$, where $Q_{\\rm min}\\approx 1-2$ is the minimum $Q$ parameter below which gravitational instability prevents discs from falling (e.g., \\citealt{2001ApJ...555..301M,2002ApJ...574..663M,2010MNRAS.407.2091G,2013MNRAS.429.2537M,2013MNRAS.433.1389R,2016MNRAS.456.2052I,2016MNRAS.457.1888S,2017MNRAS.469..286R}). This can be re-written as \\citep[equation~8]{2018MNRAS.477.2716K},\n\\begin{equation}\n Q_{\\rm min} = f_{g,Q} \\times Q_g\n\\label{eq:toomreQ}\n\\end{equation}\nwhere $Q_g$ is the Toomre $Q$ parameter for the gas alone, and $f_{g,Q}$ is the effective gas fraction in the disc \\citep[equation~9]{2018MNRAS.477.2716K}, which, based on the estimates of $\\Sigma_g$ \\citep{2015ApJ...814...13M} and gas velocity dispersion $\\sigma_g$ \\citep{2009ARA&A..47...27K} is $\\approx 0.5$ in the Solar neighbourhood. Writing down the Toomre equation \\citep{1964ApJ...139.1217T}, this becomes,\n\\begin{equation}\n f_{g,Q} \\frac{\\omega_c \\sigma_g}{\\pi G \\Sigma_g} = Q_{\\rm min}\\,.\n\\label{eq:toomreQ1}\n\\end{equation}\nHere, $\\omega_c$ is the epicyclic frequency given by $\\omega_c=\\sqrt{2(\\beta+1)}\\Omega = \\sqrt{2(\\beta+1)}v_{\\phi}\/r$, where $\\beta$ is the index of the rotation curve given by $\\beta = d\\ln v_{\\phi}\/d\\ln r$. Following \\cite{2018MNRAS.477.2716K} and results from time-dependent numerical solutions for energy equilibrium in galactic discs \\citep{2014MNRAS.438.1552F}, we can assume that in the steady-state, $\\beta$ and $\\sigma_g$ are independent of radius. Thus, we obtain\n\\begin{equation}\n \\Sigma_g = \\frac{\\sqrt{2(\\beta+1)}f_{g,Q}\\sigma_g v_{\\phi}}{\\pi Gr Q_{\\rm min}}\\,.\n\\label{eq:gas_surface_density}\n\\end{equation}\nThis solution provides a $1\/r$ dependence for $\\Sigma_g$ that is somewhat at odds with observations that find an exponential dependence of $\\Sigma_g$ \\citep{2012ApJ...756..183B}. However, these observations trace the entire disc (using CO as well as \\ion{H}{i}) and the $\\Sigma_g$ profiles show a large scatter in the inner disc, which is the focus of our work. Given these findings, we cannot conclude that a $1\/r$ profile of $\\Sigma_g$ is unrealistic, and therefore continue to use it for our work. The quantities $\\Sigma_{g0}$ and $s_g(x)$ that we defined in \\autoref{s:modelevolve_equations1} are thus given by\n\\begin{eqnarray}\n\\Sigma_{g0} & = &\n\\frac{\\sqrt{2\\left(\\beta+1\\right)}f_{g,Q}\\sigma_g v_{\\phi}}{\\pi Gr_0 Q_{\\rm min}} \\\\\ns_g(x) & = &\n\\frac{1}{x}.\n\\end{eqnarray}\n\nWe can express the diffusion coefficient due to turbulent diffusion as $\\kappa \\approx h_g \\sigma_g\/3$, where $h_g$ represents the gas scale height \\citep{2013RvMP...85..809K,2018MNRAS.475.2236K} given by \\citep[equations 24 and 27]{2018MNRAS.477.2716K},\n\\begin{equation}\nh_g = \\frac{\\sigma^2_g}{\\pi G\\left(\\Sigma_g + \\left(\\frac{\\sigma_g}{\\sigma_{\\star}}\\right)\\Sigma_{\\star}\\right)} = \\frac{\\sigma^2_g}{\\pi G \\Sigma_g \\phi_Q}\\,,\n\\label{eq:gas_scale_height}\n\\end{equation}\nwhere $\\Sigma_{\\star}$ and $\\sigma_{\\star}$ is the stellar surface density and velocity dispersion, respectively, and $\\phi_Q-1$ is the ratio of gas to stellar Toomre $Q$ parameters. This gives\n\\begin{equation}\n\\kappa = \\frac{\\sigma^3_g}{3\\pi G \\Sigma_g \\phi_Q}\n\\end{equation}\nHence, the factors $\\kappa_0$ and $k(x)$ that we defined in \\autoref{s:modelevolve_equations1} are given by\n\\begin{eqnarray}\n\\kappa_0 & = &\n\\frac{Q_{\\rm min} r_0 \\sigma^2_g}{3\\phi_Q \\sqrt{2\\left(\\beta+1\\right)}f_{g,Q}v_{\\phi}} \\\\\nk(x) & = &\nx.\n\\end{eqnarray}\nThus, the product $\\kappa_0\\Sigma_{g0} \\propto \\sigma^3_{g}\/G$ describes an effective metal flow rate in the disc due to diffusion. \n\nTo derive $\\dot \\Sigma_{\\star}$, we can use equations 31 and 32 of \\cite{2018MNRAS.477.2716K},\n\\begin{equation}\n \\dot \\Sigma_{\\star} = \\frac{4v_{\\phi}f_{g,Q}\\epsilon_{\\mathrm{ff}}f_{\\mathrm{sf}}\\Sigma_g}{\\pi r \\sqrt{\\frac{3f_{g,P}\\phi_{\\mathrm{mp}}}{2(1+\\beta)}}}\\,,\n\\label{eq:sigma_SFR}\n\\end{equation}\nwhere $\\epsilon_{\\mathrm{ff}}$ is the star formation efficiency per free-fall time \\citep{2005ApJ...630..250K,2012ApJ...745...69K,2013MNRAS.436.3167F,2018MNRAS.477.4380S,2019MNRAS.487.4305S}, $f_{\\mathrm{sf}}$ is the fraction of gas in the cold, molecular phase that is not supported by thermal pressure, and thus forms stars \\citep{2008ApJ...689..865K,2009ApJ...693..216K,2013MNRAS.436.2747K}, $f_{g,P}$ is the fraction of the mid-plane pressure due to self-gravity of the gas only, and not stars or dark matter \\citep{2018MNRAS.477.2716K}, and $\\phi_{\\mathrm{mp}}$ is the ratio of the total to the turbulent pressure at the mid-plane. Following \\autoref{eq:sigma_SFR}, we can derive $\\dot \\Sigma_{\\star0}$ and $\\dot s_{\\star}(x)$ as,\n\\begin{eqnarray}\n\\dot \\Sigma_{\\star0} & = &\n\\frac{8\\left(\\beta+1\\right)f^2_{g,Q}\\epsilon_{\\rm{ff}}f_{\\rm{sf}}\\sigma_g v^2_{\\phi}}{\\pi^2 r^2_0 G Q_{\\rm min} \\sqrt{3f_{g,P}\\phi_{\\rm{mp}}}} \\\\\n\\dot s_{\\star}(x) & = &\n\\frac{1}{x^2}.\n\\end{eqnarray}\n\nNext, we consider the cosmic accretion of gas onto the disc. The functional form of $\\dot c_{\\star}(x)$ is not provided in the \\cite{2018MNRAS.477.2716K} model. Within the framework of inside-out galaxy formation, $\\dot\\Sigma_{\\rm{cos}}$ decreases with radius, as has been noted in several works \\citep{1997ApJ...477..765C,2001ApJ...554.1044C,2009ApJ...696..668F,2010AIPC.1240..131C,2014MNRAS.443..168F,2016MNRAS.455.2308P,2016MNRAS.462.1329M}. In particular, we find from \\citet[see their Figure 2]{2008A&A...483..401C} that $\\dot c_{\\star} \\approx 1\/x^2$ is necessary to reproduce the present day total surface mass density along the disc in the Milky Way. Additionally, a $1\/x^2$ accretion profile is also identical to $\\dot s_{\\star}$, implying a direct correlation between star formation and accretion, as has been noticed in simulations \\citep{2011MNRAS.416.1354D}. Such a profile also means that more accretion is expected in more massive parts of the disc due to higher gravitational potential \\citep{2000MNRAS.313..338P}. Keeping these results in mind, we set $\\dot c_{\\star} (x) = 1\/x^2$. However, we show in \\aref{s:app_cosmicaccr} that changing the functional form of $\\dot c_{\\star} (x)$ has only modest effects on the qualitative results. Following \\cite{2014MNRAS.438.1552F}, we define\n\\begin{equation}\n \\dot \\Sigma_{\\mathrm{cos}0} = \\frac{\\dot M_{\\mathrm{h}}f_{\\mathrm{B}}\\epsilon_{\\mathrm{in}}}{2\\pi r^2_0\\int^{x_{\\mathrm{max}}}_{x_{\\mathrm{min}}} x \\dot c_{\\star}dx}\n\\label{eq:cosmicaccr}\n\\end{equation}\nwhere $f_{\\rm{B}} \\approx 0.17$ is the universal baryonic fraction \\citep{1995MNRAS.273...72W,2010ApJ...725.2324B,2016A&A...594A..13P}, and $\\epsilon_{\\rm{in}}$ is the baryonic accretion efficiency given by \\citet[equation~22]{2014MNRAS.438.1552F}, which is based on cosmological simulations performed by \\cite{2011MNRAS.417.2982F}. $\\dot M_{\\rm{h}}$ is the dark matter accretion rate \\citep{2008MNRAS.383..615N,2010ApJ...718.1001B,2013MNRAS.435..999D} given by \\citet[equation~65]{2018MNRAS.477.2716K},\n\\begin{equation}\n \\dot M_{\\mathrm{h}} \\approx 39 \\left(\\frac{M_{\\mathrm{h}}}{10^{12}\\mathrm{M_{\\odot}}}\\right)^{1.1}\\,\\left(1+z\\right)^{2.2}\\,\\mathrm{M_{\\odot}\\,yr^{-1}},\n\\label{eq:haloaccr}\n\\end{equation}\nwhere the halo mass, $M_{\\mathrm{h}}$, can be written in terms of $v_{\\phi}$ by assuming a \\cite{1997ApJ...490..493N} density profile for the halo as \\citep[equations 69 to 71]{2018MNRAS.477.2716K},\n\\begin{equation}\n \\frac{M_{\\mathrm{h}}}{10^{12}\\mathrm{M_{\\odot}}} = \\left(\\frac{v_{\\phi}\/\\mathrm{km\\,s^{-1}}}{76.17\\sqrt{\\frac{c}{\\ln(1+c) - c\/(1+c)}}}\\right)^3\\,\\left(1+z\\right)^{-3\/2}\n\\label{eq:halomass}\n\\end{equation}\nwhere $c$ is the halo concentration parameter \\citep[section~7.5]{2010gfe..book.....M}. It is now known that $c$ scales inversely with halo mass \\citep{2007MNRAS.378...55M,2009ApJ...707..354Z,2014MNRAS.441.3359D}. For the purposes of this work, we simply adopt $c=10,\\,15$ and $13$ for local spirals, local dwarfs and high-$z$ galaxies, respectively, rather than adopting more complex empirical relations (e.g., \\citealt{2019MNRAS.487.3581F}). Finally, note that the numerator in \\autoref{eq:cosmicaccr} is simply the baryonic accretion rate, $\\dot M_{\\rm{ext}}$.\n\nThe inflow rate required to maintain a steady state is given by the balance between radial transport, turbulent dissipation and star formation feedback \\citep[equation~49]{2018MNRAS.477.2716K}\n\\begin{equation}\n \\dot M = \\frac{4(1+\\beta)\\eta\\phi_Q \\phi^{3\/2}_{\\mathrm{nt}}}{(1-\\beta)G Q^2_{\\mathrm{min}}}\\,f^2_{g,Q}\\sigma^3_g\\,\\bigg(1 - \\frac{\\sigma_{\\mathrm{sf}}}{\\sigma_g}\\bigg).\n\\label{eq:radialinflow}\n\\end{equation}\nHere $\\sigma_{\\mathrm{sf}}$ is the gas velocity dispersion that can be maintained by star formation feedback alone, $\\eta$ is the scaling factor for the rate of turbulent dissipation \\citep{2010ApJ...724..895K}, and $\\phi_{\\mathrm{nt}}$ is the fraction of gas velocity dispersion that is turbulent as opposed to thermal. While a cosmological equilibrium dictates that $\\dot M \\lesssim \\dot M_{\\rm{ext}}$ (and also $\\dot{M}_\\star \\lesssim \\dot{M}_{\\rm ext}$, with the former being the star formation rate), it is unclear if these conditions in fact hold for observed galaxies at high redshift. We discuss this in detail in \\aref{s:app_obsuncertainties}, showing that these uncertainties do not affect our qualitative results on metallicity gradients.\n\nFinally, we revisit the yield reduction factor $\\phi_y$ that we introduced in \\autoref{eq:phiy}. Both the mass loading factor $\\mu$ and the direct metal ejection fraction $\\xi$ that are incorporated into $\\phi_y$ are largely unknown \\citep{2013MNRAS.429.1922C,2015MNRAS.446.2125C,2018ApJ...867..142C}. A number of authors have proposed models for $\\mu$ (e.g., \\citealt{2013MNRAS.429.1922C,2014MNRAS.443..168F,2019MNRAS.484.5587T,2020MNRAS.497..698T}), and it is believed to scale inversely with halo mass. However, there are no robust observational constraints, with current estimates ranging from 0 to 30 \\citep{2012MNRAS.426..801B,2012ApJ...761...43N,2014ApJ...792L..12K,2015ApJ...804...83S,2019MNRAS.490.4368S,2017MNRAS.469.4831C,2019ApJ...873..122D,2019ApJ...875...21F,2019ApJ...886...74M}. $\\xi$ is even less constrained by observations and theory, although observations and simulations suggest non-zero values in dwarf galaxies \\citep[e.g.,][]{2018MNRAS.481.1690C,2018ApJ...869...94E,2019MNRAS.482.1304E}. For this reason we leave $\\phi_y$ as a free parameter in the model and present solutions for metallicity evolution for a range of values. As we show in a companion paper \\citep{2020aMNRAS.xxx..xxxS}, galaxies tend to prefer a particular value of $\\phi_y$ based on their stellar mass, $M_{\\star}$.\n\nWe list fiducial values of all the parameters used in the \\cite{2018MNRAS.477.2716K} model in \\autoref{tab:tab1} and \\autoref{tab:tab2}. Plugging in these parameters in equations 15$-$18, we get,\n\\begin{equation}\n \\mathcal{T} = \\frac{3\\phi_Q\\sqrt{2\\left(\\beta+1\\right)}f_{g,Q}}{Q_{\\rm min}}\\left(\\frac{v_{\\phi}}{\\sigma_g}\\right)^2\n \\label{eq:physicalChi}\n\\end{equation}\n\\begin{equation}\n \\mathcal{P} = \\frac{6\\eta\\phi^2_Q\\phi^{3\/2}_{\\rm{nt}} f^2_{g,Q}}{Q^2_{\\rm{min}}}\\left(\\frac{1+\\beta}{1-\\beta}\\right)\\left(1 - \\frac{\\sigma_{\\mathrm{sf}}}{\\sigma_g}\\right)\n \\label{eq:physicalP}\n\\end{equation}\n\\begin{equation}\n \\mathcal{S} = \\frac{24 \\phi_Q f^2_{g,Q} \\epsilon_{\\rm{ff}} f_{\\rm{sf}}}{\\pi Q_{\\rm min} \\sqrt{3f_{g,P} \\phi_{\\rm{mp}}}}\\left(\\frac{\\phi_y y}{Z_{\\odot}}\\right)\\left(1+\\beta\\right)\\left(\\frac{v_{\\phi}}{\\sigma_g}\\right)^2\n \\label{eq:physicalS}\n\\end{equation}\n\\begin{equation}\n \\mathcal{A} = \\frac{3G\\dot M_{h}f_{\\mathrm{B}}\\epsilon_{\\mathrm{in}}\\phi_Q}{2\\sigma^3_g\\int^{x_{\\mathrm{max}}}_{x_{\\mathrm{min}}} x \\dot c_{\\star}dx}\n \\label{eq:physicalA}\n\\end{equation}\nwhere we have explicitly retained the dependence of the radial profile of cosmic accretion rate surface density in $\\mathcal{A}$. Note that none of these ratios depend on $r_0$. Some of these parameters are dependent on other parameters: e.g., $\\dot M_{\\rm{h}}$ can be expressed as a function of $v_{\\phi}$ as is clear from \\autoref{eq:haloaccr} and \\autoref{eq:halomass}.\n\n\n\\subsection{Solution for the equilibrium metallicity}\n\\label{s:modelevolve_solution}\nNow, we can combine the metallicity evolution model from \\autoref{s:modelevolve_equations1} and the galactic disc model from \\autoref{s:metalevolve_krumholz2018} to obtain an analytic solution to \\autoref{eq:main_nondimx} in steady-state ($\\partial \\mathcal{Z}\/\\partial \\tau = 0$). The solution is\n\\begin{eqnarray}\n \\lefteqn{\\mathcal{Z}(x) = \\frac{\\mathcal{S}}{\\mathcal{A}} + c_1 x^{\\frac{1}{2}\\left[\\sqrt{\\mathcal{P}^2+\\,4\\mathcal{A}}-\\mathcal{P}\\right]}\n }\n \\nonumber \\\\\n & & {} + \\left(\\mathcal{Z}_{r_0} - \\frac{\\mathcal{S}}{\\mathcal{A}} - c_1\\right) x^{\\frac{1}{2}\\left[-\\sqrt{\\mathcal{P}^2+\\,4\\mathcal{A}}-\\mathcal{P}\\right]},\n \\label{eq:main_nondimx_solution}\n\\end{eqnarray}\nwhere $c_1$ is a constant of integration and $\\mathcal{Z}_{r_0} \\equiv \\mathcal{Z}(r=r_0)$. We remind the reader that $\\mathcal{Z} = Z\/Z_{\\odot}$ and $x = r\/r_0$ as we define in \\autoref{s:modelevolve_equations1}. In writing the above analytic solution, we have assumed that the metallicity at the inner edge of the disc (to which we shall hereafter refer as the central metallicity), $\\mathcal{Z}_{r_0}$, is known. We show below (\\autoref{s:gradients}) that this approach is reasonable, because the solutions naturally tend toward a particular value of $\\mathcal{Z}_{r_0}$. Thus, in practice, $c_1$ is the only unknown parameter in the solution. We also show later in \\autoref{s:gradients} that $c_1$ can be expressed as a function of the metallicity gradient at $r_0$.\n\nWe now turn to constraining $c_1$. Firstly, note that $\\mathcal{Z} >0$ for all $x$. In practice, we ask that $\\mathcal{Z} > \\mathcal{Z}_{\\rm{min}}$ for some fiducial $\\mathcal{Z}_{\\rm{min}} \\approx 0.01$. For $x \\gg 1$, this gives\n\\begin{equation}\n c_1 > \\left(\\mathcal{Z}_{\\mathrm{min}}-\\frac{\\mathcal{S}}{\\mathcal{A}}\\right)\\,x^{-\\frac{1}{2}\\left[\\sqrt{\\mathcal{P}^2+\\,4\\mathcal{A}} - \\mathcal{P}\\right]}_{\\mathrm{max}}\\,,\n \\label{eq:bc_c1_1}\n\\end{equation}\nwhere $x_{\\rm max}$ is the outer radius of the disc at which we apply this condition\\footnote{The inequality is such that applying this condition at $x_{\\rm max}$ ensures that it is also satisfied everywhere else in the disc.}. Secondly, the total metal flux into the disc across the outer boundary cannot exceed that supplied by advection of gas with metallicity $\\mathcal{Z}_{\\rm CGM}$ into the disc, since otherwise this would imply the presence of a metal reservoir external to the disc that is supplying metals to it, which is only true in special circumstances, e.g., during or after a merger \\citep{2012ApJ...746..108T,2018MNRAS.475.1160H}, or due to long term wind recycling through strong galactic fountains \\citep{2019MNRAS.490.4786G}. Mathematically, this condition can be written as\n\\begin{equation}\n -\\underbrace{\\frac{\\dot M \\mathcal{Z}}{2\\pi x}}_\\text{adv. flux} - \\underbrace{\\kappa\\Sigma_g\\frac{\\partial \\mathcal{Z}}{\\partial x}}_\\text{diff. flux} \\geq -\\underbrace{\\frac{\\dot M \\mathcal{Z}_{\\rm{CGM}}}{2\\pi x}}_\\text{CGM flux}\\,.\n\\label{eq:outerbc}\n\\end{equation}\nFor $x \\gg 1$, this translates to,\n\\begin{equation}\n c_1 \\leq \\frac{2\\mathcal{P}\\left(\\mathcal{Z}_{\\mathrm{CGM}} - \\mathcal{S}\/\\mathcal{A}\\right)}{\\mathcal{P}+\\sqrt{\\mathcal{P}^2+\\,4\\mathcal{A}}}\\,x^{-\\frac{1}{2}\\left[\\sqrt{\\mathcal{P}^2+\\,4\\mathcal{A}} - \\mathcal{P}\\right]}_{\\mathrm{max}},\n \\label{eq:bc_c1_2}\n\\end{equation}\nThus, we find that $c_1$ is bounded within a range dictated by the two conditions above. Given a value of $c_1$, we can also calculate the $\\Sigma_g$-weighted and $\\dot\\Sigma_{\\star}$-weighted mean metallicity in the model,\n\\begin{eqnarray}\n\\overline{\\mathcal{Z}}_{\\Sigma_g} & = &\n\\frac{\\int^{x_\\mathrm{max}}_{x_{\\mathrm{min}}} 2\\pi x \\Sigma_{g0} s_g \\mathcal{Z} dx}{\\int^{x_\\mathrm{max}}_{x_{\\mathrm{min}}} 2\\pi x \\Sigma_{g0} s_g dx},\\\\\n\\label{eq:meanweightedZ1}\n\\overline{\\mathcal{Z}}_{\\dot\\Sigma_{\\star}} & = &\n\\frac{\\int^{x_\\mathrm{max}}_{x_{\\mathrm{min}}} 2\\pi x \\dot \\Sigma_{\\star0} \\dot s_{\\star} \\mathcal{Z} dx}{\\int^{x_\\mathrm{max}}_{x_{\\mathrm{min}}} 2\\pi x \\dot \\Sigma_{\\star0} \\dot s_{\\star} dx}.\n\\label{eq:meanweightedZ2}\n\\end{eqnarray}\nFinding $\\overline{\\mathcal{Z}}$ is helpful because we can use it to produce a mass-metallicity relation (MZR) that can serve as a sanity check for the model. We show in a companion paper that our model can indeed reproduce the MZR \\citep{2020aMNRAS.xxx..xxxS}.\n\n\n\\section{Equilibrium metallicity gradients}\n\\label{s:gradients}\nWe apply our model to four different classes of galaxies: local spirals, local ultra-luminous infrared galaxies (ULIRGs), local dwarfs, and high-$z$ galaxies. The fiducial dimensional parameters we adopt for each of these galaxy types are listed in \\autoref{tab:tab1} and \\autoref{tab:tab2}. We remind the reader that the metallicity evolution model can only be applied to those galaxies where the metallicity gradient can reach equilibrium. This condition is approximately satisfied if $t_{\\rm eqbm} < t_{\\rm{H(z)}}$, where $t_{\\rm{H(z)}}$ is the Hubble time at redshift $z$. We also compare $t_{\\rm{eqbm}}$ with the molecular gas depletion timescale $t_{\\rm{dep,H_2}}$, since we expect that $t_{\\rm{dep,H_2}}$ controls the metal production timescale (hence, $\\mathcal{S}$) and can potentially impact metallicity gradients. Thus, the metallicity gradients may also not be in equilibrium if $t_{\\mathrm{eqbm}} \\gg t_{\\rm{dep,H_2}}$. An exception to this is for local ULIRGs, where we compare $t_{\\rm{eqbm}}$ with $t_{\\rm{merge}}$, the merger timescale. This is because the dynamics of the galaxy (as dictated by its rotation curve and orbital time) are dictated by $t_{\\rm{merge}}$ for local ULIRGs.\n\nBefore checking whether equilibrium is satisfied for each individual galaxy class, it is helpful to put our work in context. Considering galaxies' total metallicity (as opposed to metallicity gradient), \\citet[see their Figure 15]{2014MNRAS.443..168F} predict that galaxies with halo masses $ M_{\\mathrm{h}} \\geq 10^{10.5}\\,\\mathrm{M}_{\\odot}$ (corresponding to $M_{\\star} \\geq 10^9\\,\\mathrm{M}_{\\odot}$ -- \\citealt{2010ApJ...710..903M}, their Figure 4) reach equilibrium by $z\\approx 2.5$. \\citet{2015MNRAS.449.3274F} use a linear stability analysis to show that the metal equilibration time is at most of order the gas depletion time $t_{\\rm{dep}}$, which is small compared to $t_{\\rm H(z)}$ for all massive main sequence galaxies. Similar arguments have been made by \\cite{2011MNRAS.416.1354D,2012MNRAS.421...98D} and \\cite{2013ApJ...772..119L} where the authors find that the metallicity attains equilibrium on very short timescales as compared to $t_{\\rm{dep}}$, and is thus in equilibrium both in the local and the high-$z$ Universe. In contrast, \\citet{2018MNRAS.475.2236K} study metallicity fluctuations, and find that these attain equilibrium on an even shorter timescale, $\\sim 300$ Myr. Our naive expectation is that equilibration times for metallicity gradients should be intermediate between those for total metallicity and those for local metallicity fluctuations, and thus should generally be in equilibrium. We show later in \\autoref{s:modellimitations} that, while these expectations are in general satisfied, some galaxy classes, namely, local dwarfs with no radial inflow, local ULIRGs, and galaxies with inverted gradients, \\textit{can} be out of equilibrium. Thus, our model cannot be applied to these galaxies.\n\nFor the rest of the galaxies where the equilibrium model can be applied, we use the fiducial parameters that we list in \\autoref{tab:tab2}, and solve the resulting differential equation to obtain $\\mathcal{Z}(x)$, for different yield reduction factors. We list the resulting values of $\\mathcal{T},\\,\\mathcal{P},\\,\\mathcal{S}$ and $\\mathcal{A}$ for different galaxies in \\autoref{tab:tab3}. To mimic the process followed in observations and simulations (e.g., \\citealt{2018MNRAS.478.4293C,2020MNRAS.495.2827C}) as well as existing models (e.g., \\citealt{2009ApJ...696..668F}), we linearly fit the resulting metallicity profiles using least squares with equal weighting in logarithmic space\n\\begin{equation}\n \\log_{10}\\mathcal{Z}\\,(x) = \\log_{10}\\mathcal{Z}_{r_0} + x\\nabla \\left[\\log_{10}\\mathcal{Z}\\,(x)\\right]\\,,\n\\end{equation}\nbetween $x=1$ and $x_{\\rm{max}}$, thereby excluding the innermost galactic disc where the rotation curve index is not constant, and where factors such as stellar bars can affect the central metallicity \\citep{2012A&A...543A.150F,2020MNRAS.tmp.2303Z}. While it is clear from \\autoref{eq:main_nondimx_solution} that the functional form of $\\mathcal{Z}$ is such that $\\log_{10}\\mathcal{Z}$ may not be a linear function of $x$ in certain cases, we will continue to use the linear fit as above in order to compare with observations. We show in \\aref{s:app_xmax} how the gradients change if we vary $x_{\\rm{min}}$ or $x_{\\rm{max}}$. For each class of galaxy that we discuss in the subsections below, we plot a range of gradients that results from the constraints on the constant of integration $c_1$ (see \\autoref{s:modelevolve_solution}), as well as the weighted mean metallicities, $\\overline{\\mathcal{Z}}_{\\Sigma_g}$ and $\\overline{\\mathcal{Z}}_{\\dot\\Sigma_{\\star}}$.\n\n\n\\begin{table*}\n\\centering\n\\caption{Resulting dimensionless ratios in different types of galaxies from the fiducial model based on the input parameters from \\autoref{tab:tab1} and \\autoref{tab:tab2}.}\n\\begin{tabular}{l|l|l|l|c|c|r}\n\\hline\nDimensionless & Description & Reference & Local & Local & Local & High-$z$\\\\\nRatio & & equations & spiral & dwarf & ULIRG & \\\\\n\\hline\n$\\mathcal{T}$ & Ratio of orbital to diffusion timescales & \\autoref{eq:physicalChi} & 1697 & 458 & 77 & 99 \\\\\n$\\mathcal{P}$ & P\u00e9clet number (ratio of advection and diffusion) & \\autoref{eq:physicalP} & 2.7 & 11 & 41 & 6.2 \\\\\n$\\mathcal{S}\/\\phi_y$ & Ratio of metal production (incl. loss in outflows) and diffusion & \\autoref{eq:physicalS} & 16.5 & 2.9 & 2.6 & 2.3 \\\\\n$\\mathcal{A}$ & Ratio of cosmic accretion and diffusion & \\autoref{eq:physicalA} & 9.9 & 1.6 & 0.1 & 0.7 \\\\\n\\hline\n\\end{tabular}\n\\label{tab:tab3}\n\\end{table*}\n\n\\begin{figure}\n\\includegraphics[width=\\columnwidth]{teqbm_ls.pdf}\n\\caption{Metallicity equilibration time, $t_{\\rm{eqbm}}$ plotted as a function of the dimensionless radius $x$ for three different values of the yield reduction factor, $\\phi_y$, for a fiducial local spiral galaxy (see \\autoref{eq:teqbm}). Here, $x = r\/r_0$, where $r_0=1\\,\\rm{kpc}$. The shaded bands correspond to solutions that cover all allowed values of the constant of integration $c_1$ in the solution to the metallicity equation (see \\autoref{s:modelevolve_solution}). Since, $t_{\\rm{eqbm}}$ is substantially smaller than the Hubble time $t_{\\rm{H(0)}}$ and comparable to the molecular gas depletion time $t_{\\rm{dep,H_2}}$, metallicity gradients in local spirals are in equilibrium.}\n\\label{fig:teqbm_ls}\n\\end{figure}\n\n\n\\subsection{Local spirals}\n\\label{s:gradients_localspirals1}\nFor local spirals, we select the outer boundary of the star-forming disc to be $15\\,\\rm{kpc}$, thus $x_{\\rm{max}} = 15$, reminding the reader that $x=r\/r_0$ where $r_0=1\\,\\rm{kpc}$. We first study the metallicity equilibration time ($t_{\\rm{eqbm}}$) to see if metallicity gradients in these galaxies have attained equilibrium, so that the model can be applied to them. \\autoref{fig:teqbm_ls} shows the value of $t_{\\rm{eqbm}}$ we find from \\autoref{eq:teqbm} as a function of $x$ for local spirals for different values of the yield reduction factor, $\\phi_y$; the bands shown correspond to solutions covering all allowed values of the integration constant $c_1$. It is clear from \\autoref{fig:teqbm_ls} that $t_{\\rm{eqbm}} < t_{\\rm{H(0)}}$ for all possible $\\phi_y$ and $c_1$, so we conclude that the gradients in local spirals are in equilibrium. Additionally, $t_{\\mathrm{eqbm}} \\sim t_{\\mathrm{dep,H_2}}$ for local spirals ($1-3\\,\\rm{Gyr}$, e.g., \\citealt{2002ApJ...569..157W,2008AJ....136.2846B,2012ApJ...758...73S,2013AJ....146...19L,2014MNRAS.443.1329H}), implying that the metallicity distribution reaches equilibrium on timescales comparable to the molecular gas depletion timescale. The model also predicts that central regions of local spirals should achieve equilibrium earlier than the outskirts, however, this is somewhat sensitive to the choice of $c_1$ and $\\phi_y$ as we can see from \\autoref{fig:teqbm_ls} (see also, Figure 4 of \\citealt{2019MNRAS.487..456B}). Our equilibrium timescales are also consistent with our naive expectation as stated above: long compared to the timescale for local fluctuations to damp, but shorter than the time required for the total metallicity to reach equilibrium.\n\n\n\\autoref{fig:localspirals} presents the family of radial metallicity distributions we obtain from the model for local spirals; the different lines correspond to varying choices of the outer boundary condition $c_1$, from the minimum to the maximum allowed. We report in the text annotations that accompany these curves the range of gas- and SFR-weighted mean metallicities $\\overline{\\mathcal{Z}}_{\\Sigma_g}$ and $\\overline{\\mathcal{Z}}_{\\dot{\\Sigma}_{\\star}}$, and metallicity gradients $\\nabla(\\log_{10}\\mathcal{Z})$, spanned by the models shown. To aid in the interpretation of these results, in \\autoref{fig:localspirals_terms} we also show the magnitudes of the various terms in the numerator on the right hand side of \\autoref{eq:teqbm}, which represent, respectively, the relative importance of advection, diffusion, metal production (reduced by metal ejection in outflows), and cosmological accretion in determining the metallicity gradient. We use this figure to read off which processes are dominant in different parts of the disc. While the source and the accretion terms fall off in the outermost regions due to the $1\/x^2$ dependence, the advection and diffusion terms slightly increase with $x$, thereby resulting in a shorter metal equilibration time in the outermost regions as compared to intermediate regions, as we see in \\autoref{fig:teqbm_ls}. Thus, transport processes in the outer regions play an important role in establishing metal equilibrium in local spirals. \n\nThere are several noteworthy features in these plots. First, note how the solution asymptotically reaches a particular value of the central metallicity. We choose to set $\\mathcal{Z}_{r_0}$ to this value, but we emphasise that the behaviour of the solution does not depend on this choice except very close to $x=1$: if we choose a different value of $\\mathcal{Z}_{r_0}$, the solution is (by construction) forced to this value close to $x=1$, but returns to the asymptotic limit for $x \\gtrsim 1.1$. Indeed, we shall see that this is a generic feature for all of our cases: the limiting central metallicity is set by a balance between two dominant processes, and can be deduced analytically by equating the two dominant terms in \\autoref{eq:main_nondimx_solution}. For the case of local spirals, the two dominant terms throughout the disc are production and accretion, as we can read off from \\autoref{fig:localspirals_terms}. The balance between these two processes gives\n\\begin{equation}\n \\mathcal{Z}_{r_0} = \\frac{\\mathcal{S}}{\\mathcal{A}}\\,\\,\\,\\,\\left[\\mathrm{Local}\\,\\mathrm{spirals}\\right]\\,.\n\\label{eq:Zr0_localspirals}\n\\end{equation}\nThis matches the conclusions of \\cite{2008MNRAS.385.2181F} regarding the total metallicity. However, we show below in \\autoref{s:gradients_localdwarfs} that this conclusion holds only for local, massive galaxies, since other processes like metal transport also play a significant role in low mass galaxies as well as at high redshift. Using the above definition of $\\mathcal{Z}_{r_0}$, we can now express $c_1$ in a more physically-meaningful way\n\\begin{equation}\nc_1 = \\frac{1}{\\sqrt{\\mathcal{P}^2 + 4\\mathcal{A}}}\\left.\\frac{\\partial \\mathcal{Z}}{\\partial x}\\right|_{r=r_0}\\,.\n\\label{eq:c1_localspirals}\n\\end{equation}\nThus, for local spirals, $c_1$ essentially describes the metallicity gradient at $r_0$.\n\nSecond, both the central metallicity $\\mathcal{Z}_{r_0}$ and the mean metallicity $\\overline{\\mathcal{Z}}$ decrease with decreasing $\\phi_y$, as expected; we obtain mean metallicities close to Solar, as expected for massive local spirals, for $\\phi_y$ fairly close to unity. Thus our models give reasonable total metallicities for local spirals if we assume that there is relatively little preferential ejection of metals, consistent with the results of recent simulations \\citep{2017ApJ...837..152D,2020ApJ...899..108T,2020MNRAS.496.4433T}. Note that some semi-analytic models find a high metal ejection fraction for spirals, but self-consistently following the evolution of the CGM subsequently leads to high re-accretion of the ejected metals \\citep{2020arXiv201104670Y}. In the language of our model, this essentially implies a high $\\phi_y$ when averaging over the metal recycling timescale for local spirals, consistent with our expectations.\n\nThird, and most importantly for our focus in this paper, the value of $\\phi_y$ has little effect on the metallicity gradient, as is clear from the similar range of gradients produced by the model for different $\\phi_y$. Our models robustly predict a gradient $\\nabla (\\log_{10}\\mathcal{Z})\\approx -0.07$ to $0$ dex kpc$^{-1}$, in very good agreement with the range observed in local spirals \\citep[e.g.,][]{1994ApJ...420...87Z,2014A&A...563A..49S,2015MNRAS.448.2030H,2016A&A...587A..70S,2017MNRAS.469..151B,2019MNRAS.484.5009E,2020A&A...636A..42M}, and within the range provided by existing simpler models of metallicity gradients \\citep{2001ApJ...554.1044C,2009ApJ...696..668F}. \n\nApart from the mean gradient, we can also study the detailed shape of the metal distribution with the model. For the given input parameters as in \\autoref{tab:tab2}, the model features a nearly-flat metal distribution in the inner galaxy for all allowed values of $c_1$. Such flat gradients in the inner regions are commonly observed in local spirals \\citep{2012ApJ...745...66M,2017MNRAS.469..151B,2020A&A...636A..42M}, and have been attributed to metallicity reaching saturation in these regions \\citep{2016MNRAS.462.2715Z,2019A&ARv..27....3M}, although the flatness depends on the metallicity calibration used \\citep[Figure 4]{2020arXiv201104670Y}. This is also the case for our models of spirals, since the flat region corresponds to the part of the disc where the metallicity is set by the balance between metal injection and dilution by metal-poor infall (c.f.~\\autoref{fig:localspirals_terms}). For comparison, we also show in \\autoref{fig:localspirals} the measured average metallicity profiles in local spirals observed in the MaNGA survey \\citep{2017MNRAS.469..151B} using two different metallicity calibrations \\citep{2004MNRAS.348L..59P,2008A&A...488..463M}, where we have adjusted the overall metallicity normalisation by 0.02 dex so that the model profiles overlap with the data. We see that the profiles produced by the model are in reasonable agreement with that seen in the observations (see also, \\citealt{2018A&A...609A.119S}).\n\n\nSeveral works have also noted that local spirals with higher gas fractions (at fixed mass) show steeper metallicity gradients \\citep{2015MNRAS.451..210C,2019A&A...623A...5D,2020arXiv201212887P}. In the language of the \\cite{2018MNRAS.477.2716K} model, a higher gas fraction implies a higher value of $f_{g,Q}$ and $f_{g,P}$. Increasing these parameters leads to an increase in the source term $\\mathcal{S}$, which gives rise to steeper metallicity gradients in the model, consistent with the above observations. Moreover, a higher gas fraction (\\textit{i.e.,} higher $f_{g,Q}$ and $f_{g,P}$) also results in a rather steep metallicity profile in the inner disc, thus giving slightly lower metallicities in the inner disc as compared to the fiducial case above, consistent with the standard picture of galaxy chemical evolution (\\citealt{1972A&A....20..383T,1973ApJ...186...35T}; see also, \\citealt{2020arXiv201212887P}).\n\n\nIt is difficult to provide robust predictions for the metal distribution in the outer parts of the galaxy without further constraining $c_1$. The outer-galaxy metal distribution in the model is also sensitive to parameters like the galaxy size and the CGM metallicity. The result of these uncertainties is that depending on the choice of $c_1$, the model can produce both nearly-flat and quite steep metal distributions in the outer parts of the galaxy. A steep drop in the metallicity in the outer disc has been observed in several local spirals \\citep{2012ApJ...745...66M}, but is dependent on the metallicity calibration used \\citep{2015MNRAS.451..210C}. In our models, this region corresponds to where cosmological accretion of metal-poor gas onto the disc becomes less important than inward advection of metal-poor gas through the disc -- a process whose rate we would expect to be correlated with the available mass supply in the far outer disc, as measured by \\ion{H}{i}. Note that the gradient can also flatten again in the outermost regions in the disc \\citep{Werk11a,2014A&A...563A..49S,2016A&A...587A..70S,2019MNRAS.488.3826B}; however, these regions typically have insufficient spatial resolution \\citep{2020MNRAS.495.3819A} as well as significant diffused ionised gas emission, both of which can cause the gradients to appear flatter than their true values \\citep[Section~6]{2019ARA&A..57..511K}. Given the uncertainties in the model as well as observations of metallicities in the outer discs in spirals, it is not yet obvious if the metal distribution in the outer disc in the model can be validated against the available observations. Thus, we do not study these regions with our model. This analysis also shows that linear fits to the metallicity profiles is a crude approximation to the true underlying metallicity distribution in local spiral galaxies. \n\n\n\\begin{figure}\n\\includegraphics[width=\\columnwidth]{Local_spiral_1.0.pdf}\n\\includegraphics[width=\\columnwidth]{Local_spiral_0.3.pdf}\n\\includegraphics[width=\\columnwidth]{Local_spiral_0.1.pdf}\n\\caption{Metallicity ($\\mathcal{Z} = Z\/Z_{\\odot}$; blue lines) as a function of dimensionless radius ($x = r\/r_0$ with $r_0 = 1\\,\\rm{kpc}$) produced by the model for a fiducial local spiral galaxy with input parameters listed in \\autoref{tab:tab1} and \\autoref{tab:tab2}, for different values of the yield reduction factor, $\\phi_y$. The analytic solution to the metallicity evolution equation is given by \\autoref{eq:main_nondimx_solution}. The slope of the linear fit to the model gradients between $x=1-15$ (black, dashed lines) gives the metallicity gradient that can be compared against simulations and observations. The blue coloured curves show the acceptable parameter space of the gradients based on the constraints on the constant of integration, $c_1$, using the boundary conditions criteria described in \\autoref{s:modelevolve_solution}. The metallicity at the inner edge of the disc (referred to as the central metallicity in the text), $\\mathcal{Z}_{r_0}$, is set by the balance between source and accretion for local spirals (see \\autoref{eq:Zr0_localspirals}). $\\overline{\\mathcal{Z}}_{\\Sigma_g}$ and $\\overline{\\mathcal{Z}}_{\\dot\\Sigma_{\\star}}$ represent the range of mass-weighted and SFR-weighted mean equilibrium metallicities produced by the solution, respectively (see \\autoref{eq:meanweightedZ1}). We expect $\\phi_y$ closer to unity for local spirals, implying that metals in these galaxies are well-mixed with the ISM before they are ejected. Finally, in the top panel we overplot the average metallicity profiles observed in local spirals in the MaNGA survey by \\protect\\cite{2017MNRAS.469..151B} using the PP04 \\protect\\citep{2004MNRAS.348L..59P} and M08 \\protect\\citep{2008A&A...488..463M} calibrations, adjusting the normalisation to overlap with the model profiles.}\n\\label{fig:localspirals}\n\\end{figure}\n\n\n\n\\begin{figure}\n\\includegraphics[width=\\columnwidth]{terms_ls.pdf}\n\\caption{Absolute values of different terms in the numerator of \\autoref{eq:teqbm} that collectively build the metallicity gradient in local spirals, for a fixed $\\mathcal{Z}_{\\rm{CGM}} = 0.1$ and fixed $c_1$ for different yield reduction factors, $\\phi_y$. These terms are defined in \\autoref{eq:main_nondimx}. The leading terms that set the gradients in local spirals are metal production and accretion of gas onto the galaxy, whereas advection and diffusion play a subdominant role in local spirals, due to the small velocity dispersion, $\\sigma_g$. Note that the sharp feature in the diffusion term near $x=1.3$ corresponds to the location where this term passes through zero as it changes sign; the term in fact behaves smoothly everywhere, but this behaviour appears as a sharp feature when plotted on a logarithmic axis.}\n\\label{fig:localspirals_terms}\n\\end{figure}\n\n\n\\subsection{Local dwarfs}\n\\label{s:gradients_localdwarfs}\nOur model can also be applied to local dwarf galaxies that can be classified as rotation-dominated, e.g., the Large Magellanic Cloud (LMC), for which $v_{\\phi} \\sim 60\\,\\mathrm{km\\,s^{-1}}$ and $\\sigma_{g} \\sim 7\\,\\mathrm{km\\,s^{-1}}$ \\citep{2000ApJ...542..789A}. Such galaxies typically lie at the massive end of dwarfs ($M_{\\star,\\rm{LMC}} = 2\\times10^9\\,\\rm{M_{\\odot}}$, as reported in \\citealt{2006lgal.symp...47V,2012ApJ...761...42S}), and possess an equilibrium gas disc to which the unified galaxy evolution model of \\cite{2018MNRAS.477.2716K} can be applied. We set the outer disc radius to $6\\,\\mathrm{kpc}$ to find the gradient in the fiducial model, in line with the estimated gas disc size of local dwarfs ($r_{\\rm{LMC}} \\sim 4.3\\,\\rm{kpc}$, \\citealt{1990A&ARv...2...29W}).\n\n\\autoref{fig:teqbm_ld} shows the metal equilibration time, $t_{\\rm{eqbm}}$, for local dwarfs based on the parameters we list in \\autoref{tab:tab1} and \\autoref{tab:tab2}. It is clear that metallicity gradients are in equilibrium in dwarfs, since $t_{\\rm{eqbm}} < t_{\\rm{H(0)}}$ as in the case of local spirals (see, however, \\autoref{s:noneqbm_ld_noadvec} where we show that this may not be the case under certain circumstances). Contrary to local spirals, local dwarfs show a wide range of $t_{\\mathrm{dep,H_2}}$, from a few hundred Myr to several Gyr (e.g., \\citealt{2011ApJ...741...12B,2014MNRAS.445.2599B,2015A&A...583A.114H,2016ApJ...825...12J,2017ApJ...835..278S}), similar to the scatter we find in $t_{\\rm{eqbm}}$ (see also, \\autoref{s:noneqbm_ld_noadvec})\\footnote{While it is often quoted that $t_{\\rm{dep,H_2}}$ is smaller by a factor of $2-5$ in local dwarfs as compared to local spirals, \\cite{2017ApJ...835..278S} point out that this may not necessarily be true. This is because it is difficult to trace the entire molecular gas content in dwarfs, and a significant fraction of the molecular gas can be `CO-faint' or `CO-dark' \\citep{2011ApJ...741...12B,2018ApJ...853..111J}, or in quiescent molecular clouds that are not targeted in observations \\citep{2010ApJ...722.1699S,2014MNRAS.439.3239K}.}. \n\nHaving established metal equilibrium in local dwarfs, we can now study the gradients produced by the model. \\autoref{fig:localdwarfs} shows the resulting metallicity versus radius for different $\\phi_y$ (analogous to \\autoref{fig:localspirals}), and \\autoref{fig:localdwarfs_terms} shows the relative importance of the various processes (analogous to \\autoref{fig:localspirals_terms}).\n\n\nIn the case of local dwarfs, we see that $\\mathcal{Z}_{r_0}$ is set by the balance between advection and diffusion, giving\n\\begin{equation}\n \\mathcal{Z}_{r_0} = \\frac{\\mathcal{S}}{\\mathcal{A}} + c_1\\left(1 + \\frac{\\sqrt{\\mathcal{P}^2+4\\mathcal{A}} - \\mathcal{P}^2 - \\mathcal{A}}{\\sqrt{\\mathcal{P}^2+4\\mathcal{A}} + \\mathcal{P}^2 + \\mathcal{A}}\\right)\\,\\,\\,\\,\\left[\\mathrm{Local}\\,\\mathrm{dwarfs}\\right]\\,.\n\\label{eq:Zr0_localdwarfs}\n\\end{equation}\nUsing the above definition of $\\mathcal{Z}_{r_0}$, we can express $c_1$ as\n\\begin{equation}\n c_1 = \\frac{\\sqrt{\\mathcal{P}^2+4\\mathcal{A}}+\\mathcal{P}^2+\\mathcal{A}}{\\left[\\mathcal{A} + \\left(\\mathcal{P}-1\\right)\\mathcal{P}\\right]\\sqrt{\\mathcal{P}^2+4\\mathcal{A}}}\\left.\\frac{\\partial \\mathcal{Z}}{\\partial x}\\right|_{r=r_0}\\,.\n\\label{eq:c1_localdwarfs}\n\\end{equation}\n\nCentral metallicities are in the range $\\mathcal{Z}_{r_0} \\approx 0.2-0.6$ depending on the choice of $\\phi_y$, in good agreement with that observed in local dwarfs, e.g., in the SMC and the LMC \\citep{1992ApJ...384..508R,1997macl.book.....W}, and M82 \\citep{2004ApJ...606..862O}. While $\\mathcal{Z}_{r_0}$ depends only on $\\mathcal{S}\/\\mathcal{A}$ in local spirals, it also depends on the choice of $c_1$ for local dwarfs, implying that it is independent of the disc properties in the former case but not in the latter.\\footnote{This dependence is also behind the sharp rise and fall near $x=1$ seen in both the diffusion term and the metallicity profile. For the purposes of plotting, we have chosen a single value of $c_1$, which in turn forces all models to converge to a single $\\mathcal{Z}_{r_0}$. While we could correct this by choosing different values of $c_1$ for different models so that they remain smooth, since the sharp feature does not affect the metallicity gradient that is our main focus in this paper, we choose for reasons of simplicity to retain the fixed $c_1$.} Similarly, mean metallicities range from $\\overline{\\mathcal{Z}} \\sim 0.1 - 0.5$ as $\\phi_y$ varies from $\\approx 0.1 - 1$; both observations \\citep{2002ApJ...574..663M,Strickland09a, 2018MNRAS.481.1690C} and numerical simulations \\citep{2018ApJ...869...94E, 2019MNRAS.482.1304E} suggest that dwarfs suffer considerable direct metal loss, so $\\phi_y$ considerably smaller than unity seems likely.\n\nAs opposed to spirals, our models predict that gradients are not necessarily flat in the inner regions of dwarfs, which is also consistent with observations \\citep{2017MNRAS.469..151B, 2020A&A...636A..42M}. The reason for this difference is due to different physical processes dominating in the two types of galaxies: accretion versus metal production in spirals, and advection versus production in dwarfs. Consequently, we predict linear gradients for local dwarfs that are steeper than the ones for local spirals at fixed $\\phi_y$ and $c_1$. For the smaller values of $\\phi_y$ expected in local dwarfs, we expect gradients in the range $\\sim -0.01$ to $-0.15\\,\\rm{dex\\,kpc^{-1}}$, implying a larger scatter in the gradients measured in local dwarfs as compared to that in local spirals, consistent with observations \\citep[Figure 12]{2020A&A...636A..42M}. The metallicity profiles produced by the model for smaller values of $\\phi_y$ are also in agreement with that observed in the MaNGA survey \\citep{2017MNRAS.469..151B}, as we show in \\autoref{fig:localdwarfs}, where we have adjusted the overall metallicity normalization by 0.15 dex to facilitate a comparison of the data and the model profiles. Further, the larger range of gradients in low mass local galaxies as compared to massive galaxies allowed within the framework of our model is also relevant and necessary for reproducing the observed steepening of gradients with decreasing galaxy mass \\citep[Figure~10]{2019MNRAS.488.3826B}.\n\n\nAlthough this is not illustrated in \\autoref{fig:localdwarfs}, we also find that the magnitude of the gradient is quite sensitive to both the ``floor'' velocity dispersion supplied by star formation, $\\sigma_{\\rm{sf}}$, and the Toomre $Q$ parameter, since these two jointly set the strength of advection and in this case, $\\sigma_{\\rm{sf}} \\sim \\sigma_g$. Thus, we expect that gradients for local dwarfs will show more scatter than those for local spirals. It is interesting to note that there is a similarly large scatter in simulations of dwarf galaxies, with some groups \\citep[e.g.,][]{2016MNRAS.456.2982T} finding steeper gradients for dwarfs as compared to spirals whereas others \\citep[e.g.][]{2017MNRAS.466.4780M} finding the opposite. This difference between the simulations has been attributed to the strength of feedback, which, in the language of our model, corresponds to variations in $\\sigma_{\\rm sf}$ and $\\phi_y$; thus the sensitivity of our model is at least qualitatively consistent with the strong dependence of feedback strength observed in simulations. \n\n\n\\begin{figure}\n\\includegraphics[width=\\columnwidth]{teqbm_ld.pdf}\n\\caption{Same as \\autoref{fig:teqbm_ls}, but for local dwarfs. Here, $t_{\\rm{eqbm}} < t_{\\rm{H(0)}}$, implying that the metallicity gradients in local dwarfs are also in equilibrium, even in the case of low $\\phi_y$ (see the text for a discussion on $t_{\\rm{dep,H_2}}$ for local dwarfs). The corresponding metallicity gradients are plotted in \\autoref{fig:localdwarfs}.}\n\\label{fig:teqbm_ld}\n\\end{figure}\n\n\\begin{figure}\n\\includegraphics[width=\\columnwidth]{Local_dwarf_1.0.pdf}\n\\includegraphics[width=\\columnwidth]{Local_dwarf_0.3.pdf}\n\\includegraphics[width=\\columnwidth]{Local_dwarf_0.1.pdf}\n\\caption{Same as \\autoref{fig:localspirals}, but for local dwarfs. Here, $\\mathcal{Z}_{r_0}$ is set by the balance between advection and diffusion, whereas metallicities in the disc are set by the balance between advection and source. The sharp rise and fall in the profile at $x=1$ is an artefact of the choice of the constant of integration $c_1$ used to calculate $\\mathcal{Z}_{r_0}$ (see \\autoref{eq:c1_localdwarfs}). The gradients are particularly sensitive to the strength of advection for local dwarfs since turbulence due to star formation feedback is comparable to that due to gravity, $\\sigma_{\\rm{sf}} \\sim \\sigma_{g}$. When they are exactly equal, advection vanishes, and the gradients may not be in equilibrium (see \\autoref{s:noneqbm_ld_noadvec}). In the last panel we also plot (purple lines) the average metallicity profiles observed in local dwarfs in the MaNGA survey; see \\autoref{fig:localspirals}.}\n\\label{fig:localdwarfs}\n\\end{figure}\n\n\\begin{figure}\n\\includegraphics[width=\\columnwidth]{terms_ld.pdf}\n\\caption{Same as \\autoref{fig:localspirals_terms}, but for local dwarfs. The dominant terms that set the gradients in local dwarfs are advection and diffusion (in the inner disc) and source and advection (in the outer disc).}\n\\label{fig:localdwarfs_terms}\n\\end{figure}\n\n\n\\subsection{High-redshift galaxies}\n\\label{s:gradients_highz2}\nMassive galaxies at high-$z$ are primarily rotation-dominated with underlying disc-like structures \\citep{2006ApJ...653.1027W,2009ApJ...706.1364F,2018ApJS..238...21F,2011MNRAS.417.2601W,2015ApJ...799..209W,2019ApJ...886..124W,2011ApJ...742...96W,2016A&A...594A..77D,2017ApJ...843...46S,2019ApJ...880...48U}. Thus, we can apply the model to these galaxies. For high-$z$ galaxies, we set the outer disc radius to $10\\,\\mathrm{kpc}$ to find the gradient in the fiducial model, acknowledging that galaxies at higher redshifts are smaller than that in the local Universe \\citep[e.g.,][]{2012A&A...539A..93Q,2014ApJ...788...28V}. Hereafter, we work with $z =2$ as a fiducial redshift. \\autoref{fig:teqbm_hz} shows the metal equilibration time for high-$z$ galaxies. It is clear that $t_{\\rm{eqbm}} < t_{\\rm{H(z)}}$, so that the equilibrium solution can be applied to these galaxies. Following \\cite{2018ApJ...853..179T,2020arXiv200306245T}, if we assume that a main sequence high-$z$ galaxy follows $t_{\\rm{dep,H_2}} \\propto (1+z)^{-0.6}$, it implies that $t_{\\rm{dep,H_2}} \\sim 0.5-1.5\\,\\rm{Gyr}$ for high-$z$ galaxies, which is comparable with $t_{\\rm{eqbm}}$ as above.\n\n\\autoref{fig:highz} shows the equilibrium metallicity distributions we obtain for a fiducial high-$z$ galaxy with parameters listed in \\autoref{tab:tab1} and \\autoref{tab:tab2}, and \\autoref{fig:highz_terms} shows our usual diagnostic diagram comparing the importance of different processes. Examining this diagram near $x=1$, it is clear that, as is the case for local dwarfs, the central metallicity $\\mathcal{Z}_{r_0}$ is set by the balance between advection and diffusion, which gives\n\\begin{equation}\n \\mathcal{Z}_{r_0} = \\frac{\\mathcal{S}}{\\mathcal{A}} + c_1\\left(1 + \\frac{\\sqrt{\\mathcal{P}^2+4\\mathcal{A}} - \\mathcal{P}^2 - \\mathcal{A}}{\\sqrt{\\mathcal{P}^2+4\\mathcal{A}} + \\mathcal{P}^2 + \\mathcal{A}}\\right)\\,\\,\\,\\,\\left[\\mathrm{High}-z\\right]\\,.\n\\label{eq:Zr0_highz}\n\\end{equation}\nIt varies between $\\mathcal{Z}_{r_0} = 0.3$--$0.7$ depending on the value of $\\phi_y$, in good agreement with observed metallicities in high-$z$ galaxies in the mass range we consider \\citep{2006ApJ...644..813E,2012PASJ...64...60Y}, with $c_1$ same as that in \\autoref{eq:c1_localdwarfs}. While the absolute metallicity depends on $\\phi_y$, the metallicity gradients for the most part do not -- we find $\\nabla (\\log_{10}\\mathcal{Z}) \\approx -0.15$ to $-0.05$ dex kpc$^{-1}$, with order-of-magnitude variations in $\\phi_y$ only altering these values by a few hundredths.\n\nThe gradients we find for high-$z$ galaxies are steeper than for local spirals, and the distributions are steeper at small radii than at larger radii, the opposite of our finding for local spirals. \\autoref{fig:highz_terms} shows why this is the case: gradients over most of the radial extent of high-$z$ galaxies are set by the balance between source and advection, whereas accretion, which dilutes the gradients in local spirals, is sub-dominant. The fundamental reason for this change is due to the vastly higher velocity dispersions of high-$z$ galaxies, which increase the importance of the advection term ($\\mathcal{P} \\propto (1 - \\sigma_{\\mathrm{sf}}\/\\sigma_g)$) while suppressing the accretion term ($\\mathcal{A} \\propto \\sigma^{-3}_g$); this effect is partly diluted by the higher accretion rates found at high-$z$ (\\autoref{eq:haloaccr}), but the net change at high redshift is nonetheless toward a smaller role for accretion onto discs and a larger role for transport through them. We discuss this further in detail in \\autoref{s:cosmic}.\n\n\n\\begin{figure}\n\\includegraphics[width=\\columnwidth]{teqbm_hz.pdf}\n\\caption{Same as \\autoref{fig:teqbm_ls}, but for high-$z$ galaxies. The corresponding equilibrium metallicity gradients are plotted in \\autoref{fig:highz}.}\n\\label{fig:teqbm_hz}\n\\end{figure}\n\n\\begin{figure}\n\\includegraphics[width=\\columnwidth]{High-z_1.0.pdf}\n\\includegraphics[width=\\columnwidth]{High-z_0.3.pdf}\n\\includegraphics[width=\\columnwidth]{High-z_0.1.pdf}\n\\caption{Same as \\autoref{fig:localspirals}, but for high-$z$ galaxies. Here, $\\mathcal{Z}_{r_0}$ is set by the balance between diffusion and advection.}\n\\label{fig:highz}\n\\end{figure}\n\n\\begin{figure}\n\\includegraphics[width=\\columnwidth]{terms_hz.pdf}\n\\caption{Same as \\autoref{fig:localspirals_terms}, but for high-$z$ galaxies. Here, the metallicities in the disc are set by the balance between source and advection, due to efficient radial transport of the gas.}\n\\label{fig:highz_terms}\n\\end{figure}\n\n\\section{Cosmic evolution of metallicity gradients}\n\\label{s:cosmic}\nA significant advantage of our model compared to previous analytic efforts, is that it makes meaningful predictions for how galaxy metallicity gradients have evolved across cosmic time. This is the case because we do not have the freedom to adjust parameters such as radial inflow rates and profiles of star formation rate to match any given observed galaxy. Instead, these parameters are either prescribed directly from our galaxy evolution model or depend on parameters that are directly observable (e.g., galaxy velocity dispersions). The basic inputs to our model are the halo mass $M_{\\rm{h}}$ and the gas velocity dispersion $\\sigma_g$ as a function of $z$. We consider three different ways of selecting galaxies that yield different tracks of $M_h(z)$ (see below for details), while we take the evolution of $\\sigma_g(z)$ from the observed correlation obtained by \\citet[see their equation~8]{2015ApJ...799..209W}\\footnote{As opposed to \\cite{2015ApJ...799..209W}, we have explicitly retained the dependence of $\\sigma_g(z)$ on $\\beta$.} \\begin{equation}\n \\sigma_g(z) = \\frac{v_{\\phi}(z)f_{\\mathrm{gas}}(z)}{\\sqrt{2\\left(\\beta+1\\right)}},\n\\label{eq:fgas_wisnioski}\n\\end{equation}\nwhere $f_{\\rm{gas}}$ is the molecular gas fraction of the galaxy \\citep{2011ApJ...733..101G,2012ApJ...745...11G,2013ApJ...768...74T,2015ApJ...800...20G,2018MNRAS.473.3717F}. This scaling is subject to considerable observational uncertainty, the implications of which we explore in \\aref{s:app_obsuncertainties}. We follow \\cite{2015ApJ...799..209W} to find $f_{\\rm{gas}}$ as a function of $M_{\\star}$ and $z$ from \\cite{2013ApJ...768...74T} and \\cite{2014ApJ...795..104W}, as it is now known that $f_{\\rm{gas}}$ decreases with cosmic time and stellar mass \\citep{2008AJ....136.2782L,2011MNRAS.415...32S,2011ApJ...730L..19G,2012MNRAS.421...98D,2013ApJ...768...74T,2018ApJ...853..179T,2015MNRAS.454.3792M,2018ApJ...869L..37I}. We note that \\citeauthor{2015ApJ...799..209W}'s sample is limited to massive galaxies ($M_{\\star}>10^{10}\\,\\rm{M_{\\odot}}$), and there are no observations available for lower-mass galaxies. For this reason we instead follow the results of the IllustrisTNG simulations to obtain $\\sigma_g(z)$ \\citep[see their Figure~12a]{2019MNRAS.490.3196P} for stellar masses below $10^{10}\\,\\rm{M_{\\odot}}$. Finally, note that all the gradients we produce from the model in this section are in equilibrium across the redshifts we use, since $t_{\\rm{eqbm}} < t_{\\rm{H(z)}}$. \n\n\n\\subsection{Trends for a Milky Way-like galaxy across redshift}\n\\label{s:cosmic_milkyway}\nWe first study how the gradient in a Milky Way-like galaxy has evolved over time using our model. We only need one parameter to begin with: $v_{\\phi}$ at $z=0$. We set this to $220\\,\\rm{km\\,s^{-1}}$ \\citep{2016ARA&A..54..529B}. Then, we use \\autoref{eq:halomass} to calculate $M_{\\mathrm{h}}\\,(z=0)$ for a fixed $c=15$. Using $M_{\\mathrm{h}}\\,(z=0)$ as boundary condition, we integrate \\autoref{eq:haloaccr} to find $M_{\\mathrm{h}}\\,(z)$, keeping in mind that this equation represents an average evolution of $M_{\\mathrm{h}}\\,(z)$ that may not necessarily apply to the Milky Way. Then, we utilize $M_{\\mathrm{h}}\\,(z)$ to find $v_{\\phi}\\,(z)$, by changing the concentration parameter ($c$) as an empirical third-order polynomial fit, following \\cite{2009ApJ...707..354Z}. This ensures that as we change $z$, we self-consistently find $M_{\\rm{h}}$ and $v_{\\phi}$. We adopt a simple linear variation for the outer edge of the star-forming disc, $x_{\\rm{max}}$, as a function of $z$ such that it is 15 at $z=0$ and 10 at $z=2$. Similarly, we vary $f_{\\rm{sf}}$ between 0.5 and 1 across redshift, keeping in mind that $f_{\\rm{sf}}$ cannot be more than 1 at any redshift. For simplicity, we fix the other parameters as follows: $\\beta=0$, $f_{g,Q}=f_{g,P}=0.5$, $\\sigma_{\\mathrm{sf}}=7\\,\\mathrm{km\\,s^{-1}},\\,Q_{\\mathrm{min}}=1.5$ and $\\mathcal{Z}_{\\rm{CGM}}=0.1$.\n\nWe show the resulting evolution of the gradient in \\autoref{fig:depends_redshift_onegalaxy}. The model predicts a steepening of the gradient in Milky Way-like galaxies over time, with the exception of a very recent flattening, between $z\\approx 0.15$ and 0. We can understand these trends in terms of the dimensionless parameters $\\mathcal{S}$, $\\mathcal{P}$, and $\\mathcal{A}$ that describe the relative importance of \\textit{in situ} metal production, radial advection, and cosmological accretion with diffusion, respectively. The source term $\\mathcal{S}$ will always make the gradients steeper because of the steep radial profile of $\\dot\\Sigma_{\\star}$, and it is either $\\mathcal{P}$ or $\\mathcal{A}$ that balances $\\mathcal{S}$ to give rise to flatter gradients. The steepest gradients at $z\\approx 0.15$ correspond to when both $\\mathcal{P}$ and $\\mathcal{A}$ are at their weakest compared to $\\mathcal{S}$. We can understand the trends on either side of this maximum in turn.\n\nFirst, let us focus on the recent epoch, $z\\lesssim 0.15$. During this period, cosmological accretion ($\\mathcal{A}$) is more important than radial transport ($\\mathcal{P}$), and accretion and metal production depend on the galaxy rotational velocity as $\\mathcal{A}\\propto v_{\\phi}^{3.3}$ and $\\mathcal{S}\\propto v_{\\phi}^2$, respectively. Thus, as the galaxy grows in mass, dilution by accretion gets stronger compared to metal production, leading to the recent flattening in the model. However, this can change if the metal production is underestimated, e.g., due to ignoring the contribution from long-term wind recycling \\citep{2011ApJ...734...48L}.\n\nDuring this epoch advection is more important than accretion, $\\mathcal{P}>\\mathcal{A}$. The ratio of the two effects, $\\mathcal{P}\/\\mathcal{A}$, is large at high redshift, and decreases systematically towards the present day, ultimately reaching $\\mathcal{P}\/\\mathcal{A} \\approx 1$ at $z\\approx 0.15$. This transition is ultimately driven by the systematic decrease in galaxy velocity dispersions with redshift, as already discussed in the context of our high-$z$ galaxy models (\\autoref{s:gradients_highz2}): higher velocity dispersions are strongly correlated with higher rates of radial inflow through a galaxy, so that for a Milky Way progenitor at $z \\gtrsim 1$, radial inflow transports metal-poor gas into galaxy centres $\\sim 10\\times$ faster than cosmological accretion ($\\mathcal{P}\/\\mathcal{A}\\approx 10$) -- despite the fact that the absolute accretion rate is higher at $z\\gtrsim 1$ than it is today. Similarly, the ratio of radial inflow to metal production, $\\mathcal{P}\/\\mathcal{S}$, scales with velocity dispersion as $\\sigma_g^2$ (for $\\sigma_g \\gg \\sigma_{\\rm sf}$), so radial inflow also becomes more important relative to metal production as we go to higher redshift and higher velocity dispersion. This explains the flatness of gradients at high redshift\\footnote{Note that this is a qualitatively different outcome than our comparison of local spirals and high-$z$ galaxies in \\autoref{s:gradients_localspirals1} and \\autoref{s:gradients_highz2}, where high-$z$ galaxies were found to have steeper gradients. The difference can be understood by recalling that in \\autoref{s:gradients_localspirals1} and \\autoref{s:gradients_highz2} we were comparing galaxies with comparable rotation curve speeds $v_\\phi$, whereas here we are following a single growing galaxy, so $v_\\phi$ is much smaller at high-$z$ than at $z=0$. This reduces $\\mathcal{S}$ at high-$z$.}. This transition from radial advection being dominant to being unimportant is mirrored in the transition from gravity-driven to star formation feedback-driven turbulence from high- to low-$z$ \\citep{2018MNRAS.477.2716K}, as we noted earlier in \\autoref{s:gradients_highz2}. \n\nLastly, we find that diffusion is sub-dominant compared to both advection and accretion at all cosmological epochs, because $\\mathcal{P}$ and $\\mathcal{A}$ are never both less than unity at the same time. Thus, while diffusion can have some effects on the metallicity distributions, particularly towards galaxy centres (cf.~\\autoref{fig:localdwarfs_terms}), as well as on metal equilibrium timescales (cf.~\\autoref{fig:teqbm_ls}), it is generally unimportant for setting galaxy metallicity gradients.\n\n\n\\subsubsection{Comparison with observations}\nThere is extensive data on the history of the Galaxy's metallicity gradient, as summarised by \\citet[see their Table~1]{2019MNRAS.482.3071M}, and on the history of the gradients in a number of other nearby galaxies. The general outcome of these studies is that gradients measured in \\ion{H}{ii} regions (which trace the current-day metal distribution) are steeper than those measured in planetary nebulae or open clusters (which trace older populations) \\citep{2010ApJ...714.1096S,2010A&A...521A...3S,2014A&A...567A..88S,2012ApJ...758..133S,2013A&A...552A..12S,2016A&A...588A..91M}. This implies a steepening of the gradient with time in Milky Way-like galaxies, however, this should be treated with caution because measured metallicity gradients in the Galaxy are subject to large errors arising from uncertainties in estimating the ages of the planetary nebulae \\citep{2010A&A...512A..19M,2011RMxAA..47...49C}, and due to radial migration that could result in a movement of the planetary nebulae away from their origin \\citep{2013A&A...558A...9M}\\footnote{Some earlier work reported the opposite trend, whereby the metallicity gradient in the Galaxy was initially steep and has flattened over time \\citep{2003A&A...397..667M,2005MNRAS.358..521M}, while other work found little or no evolution in the gradient over time \\citep{2013RMxAA..49..333M}. This is a difficult measurement, and the error bars and uncertainties are large \\citep{2010A&A...512A..19M,2011RMxAA..47...49C,2013A&A...558A...9M}.}.\n\nTo allow a quantitative comparison of these observations with our model, we show measurements of the metallicity gradient for the Milky Way as a function of lookback time from \\cite{2010A&A...521A...3S} as yellow circles in \\autoref{fig:depends_redshift_onegalaxy}. The data for the Milky Way (as well as other local spirals, see \\citealt{2014A&A...567A..88S}) are in qualitative agreement with the predictions from our model. However, we also note that for our model to agree \\textit{quantitatively} with the measurements, we would need $\\phi_y$ to be lower at high redshift, and increase towards unity today. Such a change in $\\phi_y$ is plausible and is consistent with our expectation that $\\phi_y$ should be close to unity in more massive galaxies like the present-day Milky Way, and smaller than unity in less massive galaxies with shallower potential wells, such as the Milky Way's high-$z$ progenitors. However, the exact form of this evolution is not independently predicted by our model.\n\n\\subsubsection{Comparison with simulations}\nOn \\autoref{fig:depends_redshift_onegalaxy}, we also overplot results from Feedback In Realistic Environments (FIRE) simulations \\citep{2014MNRAS.445..581H,2018MNRAS.480..800H} of a Milky Way-like galaxy (m12i) discussed in \\citet{2017MNRAS.466.4780M}. This simulation finds that metallicity gradients are unstable until $z \\sim 1$, after which they steepen and stabilise to an equilibrium value. This transition is primarily due to the formation of a robust galactic disc that cannot be disrupted again due to internal or external feedback. While the quantitative trends slightly differ at some redshifts between our model and the simulation, which is not unexpected given that the exact implementation of the feedback and measurements of the gradients are different, there is a very good qualitative match. This match also implies that Milky Way-like galaxies would have had lower $\\phi_y$ in the past as compared to the present day, as outflows were more common and stronger in the past due to higher SFR and could have ejected a larger fraction of metals not mixed with the ISM \\citep{2015MNRAS.454.2691M,2017MNRAS.466.4780M}; such a scenario has received support from recent high-resolution simulations that spatially resolve multi-phase galactic outflows, and find that the metal enrichment factor in both the cold ($< 2\\times10^4\\,\\rm{K}$) and hot ($> 5\\times10^5\\,\\rm{K}$) outflows increases with the SFR surface density \\citep{2020ApJ...900...61K}. We can also compare our results with those of \\cite{2013A&A...554A..47G}, where the authors study two identical simulation suites with either weak or enhanced stellar feedback, called MUGS and MaGICC, respectively \\citep{2010MNRAS.408..812S}. The authors find that gas phase metallicity gradients are steep at high redshift in MUGS, whereas they are flat in MaGICC, clearly revealing the close correlation between feedback and metallicity gradients in galaxies. One of their simulated galaxies, MaGICC g1536, resembles the Milky Way in terms of its stellar mass, so we also compare our model results to that simulation in \\autoref{fig:depends_redshift_onegalaxy}. Again, we find qualitative similarities between the simulations and the model.\n\n\n\\begin{figure*}\n\\includegraphics[width=\\linewidth]{grad_z_onegalaxy_fgas.pdf}\n\\caption{Metallicity gradient versus redshift (and lookback time) for a Milky Way-like galaxy. Different symbols show different yield reduction factors, $\\phi_y$, while symbol colour shows the ratio of the dimensionless numbers $\\mathcal{P}\/\\mathcal{A}$ that describe the relative importance of radial transport and cosmological accretion, respectively. The grey curve is taken from FIRE simulations of a Milky Way-like galaxy \\protect\\citep{2017MNRAS.466.4780M} whereas the dashed, black curve is from the MaGICC g1536 simulation by \\protect\\citet{2013A&A...554A..47G}. The orange points are from observations of \\ion{H}{ii} regions, planetary nebulae and open clusters by \\protect\\cite{2010ApJ...714.1096S}, with horizontal errorbars representing the uncertainties in the ages of planetary nebulae and open clusters. The data, simulations and the model all qualitatively show that gradients in Milky Way-like galaxies have steepened over time, with the model predicting a mild flattening between $z=0.15$ and present-day. In the model, this evolution is driven by a transition from the advection-dominated regime ($\\mathcal{P}\/\\mathcal{A} > 1)$ to the accretion-dominated regime ($\\mathcal{P}\/\\mathcal{A} < 1)$ around $z \\approx 0.15$. Such a transition in metallicity gradients is mirrored in the transition in gravity-driven turbulence at high $z$ to star formation feedback-driven turbulence at $z=0$ \\protect\\citep{2018MNRAS.477.2716K}.}\n\\label{fig:depends_redshift_onegalaxy}\n\\end{figure*}\n\n\n\\subsection{Trends for matched stellar mass galaxies across redshift}\n\\label{s:cosmic_identicalmass}\n\n\\begin{figure*}\n\\includegraphics[width=\\linewidth]{grad_z_samemassgalaxy.pdf}\n\\caption{Trends in metallicity gradients as a function of redshift and lookback time. Colored markers represent individual galaxies within the three $M_{\\star}$ bins as shown in the legend, with bigger markers representing binned averages of non-positive gradients across different redshift bins, and errorbars representing the scatter in the data within each redshift bin. The averages at $z=0$ are taken from local surveys \\protect\\citep{2014A&A...563A..49S,2016A&A...587A..70S,2017MNRAS.469..151B,2020A&A...636A..42M}. The high-redshift compilation data is taken from \\protect\\cite{2012A&A...539A..93Q,2012MNRAS.426..935S,2014MNRAS.443.2695S,2016ApJ...820...84L,2016ApJ...827...74W,2017MNRAS.466..892M,2018MNRAS.478.4293C,2018ApJS..238...21F,2020ApJ...900..183W,2020MNRAS.492..821C}, and is inhomogeneous, with systematic issues within the different measurements (see \\autoref{s:cosmic_identicalmass}). The colored bands represent models at three $M_{\\star}$ values, with the spread resulting from different yield reduction factors $\\phi_y$, as marked by the arrow besides the shaded region. This spread in the model is largest for the low mass galaxies. While the general trend of mild evolution of gradients across redshift holds true, the models uncover the underlying variations due to galaxies transitioning from advection- to accretion-dominated regimes between $z=2.5$ and $0$, as is visible in the binned data averages. Some data points lie outside the range of the plot, and we do not include those for the purposes of studying the average trends of the data with the model. }\n\\label{fig:depends_redshift_samemassgalaxy}\n\\end{figure*}\n\nIn this section, we study the mass-averaged trends of metallicity gradients across cosmic time. For this purpose, we use a compilation of observations of metallicity gradients in (lensed and un-lensed) galaxies spanning $0 \\leq z \\leq 2.5$ \\citep{2012A&A...539A..93Q,2012MNRAS.426..935S,2014MNRAS.443.2695S,2016ApJ...820...84L,2016ApJ...827...74W,2017MNRAS.466..892M,2018MNRAS.478.4293C,2018ApJS..238...21F,2020ApJ...900..183W,2020MNRAS.492..821C}, and we also include results from local surveys \\citep{2014A&A...563A..49S,2016A&A...587A..70S,2017MNRAS.469..151B,2020A&A...636A..42M,2020MNRAS.xxx..xxxA}. \n\nBefore proceeding, we warn the reader that there are many uncertainties inherent in comparing metallicity gradients across samples and across cosmic time. For example, most studies in the compiled dataset rely on strong line calibrations that use photoionisation models or electron temperature-based empirical relations to measure metallicity gradients, and the variations between different calibrations can be as high as 0.1 dex per effective half-light radius \\citep{2010ApJS..190..233M,2019MNRAS.487...79P,10.1093\/mnras\/stab205,2020A&A...636A..42M}. Further, since many high-$z$ metallicity gradient measurements rely on nitrogen whereas low-$z$ measurements use a larger set of (optical) emission lines, we also expect some systematic differences in these measurements with redshift \\citep{2018MNRAS.478.4293C,2019ARA&A..57..511K}. Using nitrogen can also lead to systematically flatter gradients due to different scalings of N\/O with O\/H in galaxy centres and outskirts \\citep{2020ApJ...890L...3S}. Lastly, it is not yet clear if strong line metallicity calibrations developed for the ISM properties of local galaxies are also applicable at high-$z$, where ISM electron densities, ionisation parameters, N\/O ratios, or other conditions may differ from those in local galaxies \\citep[e.g.,][]{2014ApJ...787..120S,2016ApJ...816...23S,2016ApJ...822...42O,2017ApJ...835...88K,2017MNRAS.465.3220K,2019ApJ...880...16K,2020arXiv201210445D}. We acknowledge these biases and uncertainties in the measured sample due to different techniques and calibrations or the lack of spatial and\/or spectral resolution \\citep{2013ApJ...767..106Y,2014A&A...561A.129M,2017MNRAS.468.2140C,2020MNRAS.495.3819A}. We do not attempt to correct for these effects or homogenize the sample because our goal here is simply to get a qualitative interpretation of the data with the help of the model, and not to obtain precise measurements from these data. Future facilities like JWST and ELTs will provide more reliable metallicity measurements, thereby enabling a more robust comparison of the model with the data \\citep{2020IAUS..352..342B}.\n\n\nWe bin the data into three bins of $M_{\\star}$: $9 \\leq \\log_{10}\\,M_{\\star}\/\\rm{M_{\\odot}} < 10$, $10 \\leq \\log_{10}\\,M_{\\star}\/\\rm{M_{\\odot}} < 11$ and $\\log_{10}\\,M_{\\star}\/\\rm{M_{\\odot}} \\geq 11$. \\autoref{fig:depends_redshift_samemassgalaxy} shows the individual data as well as the binned averages of non-positive gradients (represented by bigger markers) with errorbars representing the scatter in the data within different redshift bins. We only select galaxies that show non-positive gradients while estimating the average gradient in different mass bins because our model may not apply to galaxies with positive gradients, as we explore in \\autoref{s:noneqbm_inverted_gradients}. We bin the data in redshift such that we can avoid redshifts where there is no data due to atmospheric absorption; such a bin selection in redshift also ensures that the binned averages reflect the true underlying sample for which the averages are calculated. We have verified that our results are not sensitive to the choice of binning the data. For simplicity, we do not overplot measurements for individual galaxies at $z=0$. \n\nFor the model, we select three representative $M_{\\star}$ values corresponding to the mean of the three stellar mass data bins as above. Specifically, we use: $\\log_{10} M_{\\star}\/\\mathrm{M_{\\odot}} = 9.6,\\,10.4$ and $11.1\\,\\rm{M_{\\odot}}$ for the model. We start the calculation by selecting rotation curve speeds $v_{\\phi}\\,(z)$ corresponding to each of these $M_{\\star}$ values based on the $M_{\\star}-M_{\\mathrm{h}}$ relation at all $z$ \\citep{2013MNRAS.428.3121M}. Given values of $M_h(z)$ and $v_\\phi(z)$ corresponding to each stellar mass $M_\\star$ at each redshift $z$, we use our model to predict the equilibrium metallicity gradient exactly as in \\autoref{s:cosmic_milkyway}. \n\nWe plot the resulting range of metallicity gradients from the model points in \\autoref{fig:depends_redshift_samemassgalaxy}. As in other figures, the spread in the model represents different $\\phi_y$ between 0 and 1 (note the arrow besides the shaded regions corresponding to the models). While there is a large scatter within the individual data points, the binned averages are in good agreement with the model. Note that almost one-third of the observed galaxies show inverted gradients, which may not be in metal equilibrium and thus may fall outside the domain of our model, as we explore in detail in \\autoref{s:noneqbm_inverted_gradients}. For the most massive galaxies, the model predicts a mild steepening of the gradients from $z=2.5$ to $1$, followed by an upturn (due to the transition from advection- to accretion-dominated regime) and flattening from $z=1$ to $0$. The available data, despite the large scatter and inhomogeneties, also seem to follow the same trend. However, the location where this upturn occurs is unknown because of the lack of data in the most massive galaxy bin around $z = 0.5$. Upcoming large surveys like MAGPI \\citep{2020arXiv201113567F} that will observe massive galaxies between $z \\approx 0.3-0.5$ will provide crucial data that can be compared against our model in the future to establish whether this upturn is indeed real.\n\nAdditionally, we can compare our results with those from the IllustrisTNG50 simulation \\citep[Figure~6]{2020arXiv200710993H}. While our results match theirs at low redshifts, there are certain differences at high redshifts where IlustrisTNG50 fails to reproduce the observed flattening, as already noted by the corresponding authors. We explain in a companion paper \\citep{2020bMNRAS.xxx..xxxS} that this difference could primarily be due to the gas velocity dispersion $\\sigma_g(z)$. At high redshift, IllustrisTNG50 systematically under-predicts galaxy velocity dispersions as compared to, for example, the EAGLE simulations \\citep[Figure~12a]{2019MNRAS.490.3196P}, and the empirical relation we use from \\cite{2015ApJ...799..209W}.\n\n\nThere is a large diversity of gradients at all redshifts \\citep{2020MNRAS.492..821C}, particularly at low stellar mass. This observed scatter can be explained in part due to the range of $\\phi_y$ in our model. For example, we notice from \\autoref{fig:depends_redshift_samemassgalaxy} that the scatter in the model due to $\\phi_y$ for the most massive galaxies is lower at low $z$ than at high $z$. This is consistent with the trend of larger scatter in the gradients of massive galaxies at higher redshift observed in the IllutrisTNG50 simulations \\citep[Figure~6]{2020arXiv200710993H}. On the other hand, the scatter in the model is the largest near the upturn, where galaxies transition from advection-dominated to accretion-dominated regime. Between the three models, the scatter due to $\\phi_y$ is the highest for the lowest $M_{\\star}$, thus reflecting the diverse variety of gradients that can form in low-mass galaxies. This prediction of the model is consistent with observations that find strong evidence for increased scatter in the metallicity gradients in low mass galaxies \\citep{2018MNRAS.478.4293C,2020arXiv201103553S}.\n\n\n\n\\subsection{Trends for abundance-matched galaxies across redshift}\n\\label{s:cosmic_abundancematch}\n\n\\begin{figure*}\n\\includegraphics[width=\\columnwidth]{grad_z_abundancematchedgalaxy_mhtab1a.pdf}\n\\includegraphics[width=\\columnwidth]{grad_z_abundancematchedgalaxy_mhtab2a.pdf}\n\\includegraphics[width=\\columnwidth]{grad_z_abundancematchedgalaxy_mhtab3a.pdf}\n\\includegraphics[width=\\columnwidth]{grad_z_abundancematchedgalaxy_mhtab4a.pdf}\n\\caption{Trends in metallicity gradients as a function of $z$ (and lookback time) for four different abundance-matched galaxy samples given a fixed comoving number density of galaxies, $n_0$, color-coded by $M_{\\star}$. Abundance matching leads to the selection of more massive galaxies at lower redshifts, and can be used to collectively study gradients in local spirals and their high-$z$ progenitors. The orange data points reflect mean gradients for a constructed abundance-matched sample from available observations, which are the same as that reported in \\autoref{fig:depends_redshift_samemassgalaxy}, with errorbars representing the scatter within the data. There is considerable scatter in the data, and the sample is not entirely robust given the \\textit{ex post facto} construction. Nonetheless, the model matches the observations reasonably-well.}\n\\label{fig:cosmic_abundmatch}\n\\end{figure*}\n\nFinally, we also study the evolution of metallicity gradients across an abundance-matched sample of dark matter haloes spanning a range in $z$\\footnote{Abundance in the context of \\autoref{s:cosmic_abundancematch} refers to the abundance of galaxies in a given comoving volume in the Universe, and not the metallicity.}. Abundance-matching is based on the premise that the number density of halo progenitors should nearly remain constant across $z$ within a comoving volume in the Universe \\citep{1996MNRAS.282.1096M,1996ApJ...467L...9M,2010ApJ...709.1018V}. It has been used to study a range of properties in local galaxies together with their high-$z$ progenitors \\citep[e.g.,][]{2009ApJ...701.1765M,2011MNRAS.412.1123P,2011ApJ...742...16T,2012ApJ...753...16K,2013ApJ...766...33L,2019MNRAS.487.5799R}, which is not possible with other selection criteria of galaxies (e.g., selecting galaxies with identical stellar mass, as we do in \\autoref{s:cosmic_identicalmass}) as such galaxies evolve in time themselves \\citep{2009ApJ...696..620C}. \n\nAbundance matching involves assigning more massive galaxies to more massive haloes at every $z$; this means selecting galaxies at each $z$ with $M_{\\rm{h}}(z)$ that satisfy \n\\begin{equation}\n\\int^{\\infty}_{M_{\\mathrm{h}}(z)} n\\left(M_{\\mathrm{h}},z\\right) dM_{\\mathrm{h}} = n_0\n\\label{eq:abundancematching}\n\\end{equation}\nwhere $n_0$ is the target number density\\footnote{This approximation of a fixed $n_0$ breaks down if certain galaxies in the abundance-matched sample do not follow the stellar mass rank order, for example, due to an abrupt increment in stellar mass because of mergers, or abrupt decrement due to quenching \\citep{2013ApJ...766...33L}.}, and $n\\left(M_{\\rm{h}},z\\right)$ is the number of galaxies per unit mass per unit comoving cubic Mpc given by \\citet[equation~14]{2002MNRAS.336..112M} based on the \\cite{1999MNRAS.308..119S} modification of the \\cite{1974ApJ...187..425P} formalism for the number density of haloes across $z$. Thus, using the functional form for $n$, we can deduce the required $M_{\\rm{h}}$ at each $z$ that would correspond to an abundance-matched sample for a given $n_0$. Following \\cite{2009ApJ...701.1765M} and \\cite{2011MNRAS.412.1123P}, we study four sets of $\\log_{10}\\,n_0\/\\rm{Mpc^{-3}} = -3,\\,-3.325\\,-3.5$ and $-4.0$, respectively. For each of these $n_0$, we find $v_{\\phi}(z)$ and $M_{\\star}(z)$ using $M_{\\rm{h}}(z)$ from \\autoref{eq:abundancematching}, and $\\sigma_g(z)$ from \\autoref{eq:fgas_wisnioski}. We fix $\\beta=0$ for all galaxies since our choice of $n_0$ results in massive galaxies with $M_{\\star} > 10^{10}\\,\\rm{M_{\\odot}}$ for all $0 \\leq z \\leq 2.5$. For simplicity, we fix $f_{g,Q}=f_{g,P}=0.5$ and $\\sigma_{\\rm{sf}}=7\\,\\rm{km\\,s^{-1}}$, the same as that for local spirals. Given that $f_{\\rm{sf}}$ varies between 0.5 and 1 as $z$ increases, we use a cubic interpolation to vary it between $z=0$ and $4$. We also fix $\\mathcal{Z}_{\\rm{CGM}} = 0.1$. \n\n\\autoref{fig:cosmic_abundmatch} shows the cosmic evolution of gradients for an abundance-matched sample of galaxies, each panel representing a different $n_0$. Similar to what we have seen in prior sections, the scatter in the model is the largest at the upturn where gradients start flattening. To the best of our knowledge, there are no existing abundance-matched samples of galaxies across redshift that also contain information on metallicity gradients. However, we can construct an abundance-matched sample from the available data. We caution that constructing an abundance-matched sample from existing observations \\textit{ex post facto} is not as accurate as properly constructing the sample to start with. In the absence of the latter, we use our constructed sample to compare against the model to learn about the kinds of metallicity gradients that existed in progenitors of local galaxies. For this purpose, we construct our pseudo-abundance matched sample as follows: for each target value of $n_0$, we first select a redshift, and use \\autoref{eq:abundancematching} to estimate the halo mass $M_{\\rm{h}}$ corresponding to the target $n_0$ at that redshift. We then estimate the stellar mass of that galaxy $M_{\\star}$ using the stellar mass-halo mass relation of \\cite{2013MNRAS.428.3121M}. To construct our sample set at that redshift, we then take the data collection described in \\autoref{s:cosmic_identicalmass} and select galaxies that have stellar masses within $\\pm\\,0.05\\,\\rm{dex}$ of the $M_\\star$ from above; this constitutes our pseudo-abundance matched sample for that redshift, from which we then measure the mean and dispersion of metallicity gradient at that redshift bin. We plot these values in \\autoref{fig:cosmic_abundmatch}, along with model predictions of the metallicity gradient, which we compute from the halo mass and redshift as in previous sections. The data we obtain in this manner have considerable scatter (shown by the errorbars), but the general trends are reasonably well reproduced by the model. However, given the uncertainties in the procedure we are forced to use to construct the observed sample, it is wiser to regard the model points in \\autoref{fig:cosmic_abundmatch} as a prediction for future abundance matching measurements, rather than a rigorous comparison to existing data.\n\n\n\n\n\\section{Limitations of the model}\n\\label{s:modellimitations}\nIn this section, we describe the limitations of the model, first focusing on physical processes that we have excluded, and then discussing galaxies to which we cannot always apply our assumption of equilibrium.\n\n\n\\subsection{Additional physics}\n\\label{s:caveats}\nOur model omits three possibly-important physical effects: bars, galactic fountains and long term wind recycling. With regard to the first of these, there is some evidence that gas phase metallicity gradients in the presence of bars in local spirals can be systematically shallower than those non-barred galaxies (\\citealt{1992MNRAS.259..121V,1994ApJ...420...87Z,2020MNRAS.tmp.2303Z}; see, however, \\citealt{2016A&A...587A..70S,2018A&A...609A.119S}). We have not included metal redistribution due to bar-driven flows, and for this reason we limit our study to gradients in the parts of a galaxy where the rotation curve slope ($\\beta$) is a constant, which excludes bar-dominated regions \\citep{2016ARA&A..54..529B,2020MNRAS.496.1845M}. In fact, even if we wished to include bar-driven mixing, the galaxy formation model that we use as an input in \\autoref{s:metalevolve_krumholz2018} is itself not applicable in regions where the bar dominates the dynamics of the galaxy, since it does not include the effects of bar-driven torques on gas and SFR surface density profiles \\citep{2018ApJ...860..172S,2020ApJ...901L...8S}. \n\nWith regard to the second issue: we do not explicitly incorporate metal redistribution via galactic fountains \\citep{1980ApJ...236..577B}. However, the combination of an enriched $\\mathcal{Z}_{\\rm{CGM}}$ and low $\\phi_y$ essentially constructs a fountain process in the model that we can exploit. Semi-analytic models where the evolution of the CGM is self-consistently followed find that the CGM plays a larger role in the evolution of galaxy metallicity as it gets enriched due to outflows \\citep{2020arXiv201104670Y}. We also note that galactic fountains, owing to their short fall-back timescale ($\\sim\\,100-300\\,\\rm{Myr}$, \\citealt{2017MNRAS.470.4698A}) and short fall-back distance from the starting point ($\\sim\\,1\\,\\rm{kpc}$, \\citealt{2008A&A...484..743S}) have been shown to play an insignificant role in the metallicity evolution of the local spiral M31 (\\citealt{2013A&A...551A.123S}; see, however, simulations by \\citealt{2019MNRAS.490.4786G}, where fountains are thought to transport metals to the edge of the star-forming disc). Fountains possibly have a significant effect on the far outskirts of the discs, where there are few or no local sources of metals. \n\nThere is some evidence from simulations that long term wind recycling can provide metals to the disc as it re-accretes the ejected material. These simulations also show that this recycling is independent of the halo mass \\citep{2016ApJ...824...57C,2019MNRAS.485.2511T}, and can be the dominant mode of accretion of cold gas at late times. However, this recycling occurs much farther out in the disc than that we consider in our work, thus, its basic features are captured within $\\mathcal{Z}_{\\rm{CGM}}$ in the model. Additionally, while the above simulations find long term wind recycling timescale to be of the order of a Gyr, results from the EAGLE simulations find it to be comparable to $t_{\\rm{H(z)}}$ \\citep{2020MNRAS.497.4495M}. Thus, given these findings from simulations and the lack of direct observations, it is currently difficult to determine the importance of wind recycling for metallicity gradients. \n\nFinally, we caution that our model is intended to apply mainly to metals whose production is dominated by type II SNe, and thus where the injection rate closely follows the star formation rate. We have not attempted to model elements produced by type Ia SNe or AGB stars. This is not a substantial problem for our intended application, however, since type II SNe do dominate production of the $\\alpha$ elements that are most easily observable in the gas phase \\citep{2018SSRv..214...67N}. The one exception to this statement, where some caution is warranted, is nitrogen, to which AGB stars make a substantial contribution \\citep{2002A&A...381L..25M,2005ARA&A..43..435H}. This matters because many of the strong-line diagnostics used at high redshift rely on the \\ion{N}{ii} $\\lambda6584$ line. While observers who rely on these diagnostics usually attempt to derive the O abundance by calibrating out variations in the N\/O ratio (\\citealt{2004MNRAS.348L..59P,2016ApJ...828...18M,2017MNRAS.469..151B,2020ApJ...890L...3S}; see also, \\citealt{2016MNRAS.458.3466V}), it is nevertheless the case that variations in N abundance may influence the metallicities derived at high-$z$, and that our model does not capture this effect. \n\n\n\\begin{figure}\n\\includegraphics[width=\\columnwidth]{teqbm_ld_noadvec.pdf}\n\\caption{Same as \\autoref{fig:teqbm_ld}, but without radial inflow such that $\\mathcal{P}=0$. Here, $t_{\\rm{eqbm}} \\gtrsim t_{\\rm{H(0)}}$, implying that the metallicity gradients in such cases in local dwarfs may or may not be in equilibrium. Thus, our equilibrium model does not necessarily apply.}\n\\label{fig:teqbm_ld_noadv}\n\\end{figure}\n\n\\begin{figure}\n\\includegraphics[width=\\columnwidth]{teqbm_lu.pdf}\n\\caption{Same as \\autoref{fig:teqbm_ls}, but for local ultraluminous infrared galaxies (ULIRGs). Here, $t_{\\rm{eqbm}} \\sim t_{\\rm{merge}}$, where the latter is the merger timescale of the order of $\\sim\\,0.3-1\\,\\rm{Gyr}$ as seen in models \\protect\\citep{2008ApJ...675.1095J,2012ApJ...746..108T}. Thus, the metallicity gradients may not be in equilibrium throughout the merger process. In such a case, our equilibrium model for metallicity gradients cannot be applied to local ULIRGs, and the observed gradients, if any, are transient and subject to change as the merger progresses, in line with observations \\protect\\citep{2010ApJ...723.1255R,2012ApJ...753....5R}.}\n\\label{fig:teqbm_ul}\n\\end{figure}\n\n\\begin{figure}\n\\includegraphics[width=\\columnwidth]{terms_lu.pdf}\n\\caption{Same as \\autoref{fig:localspirals_terms}, but for ULIRGs, which are known to be major mergers. The non-equilibrium metallicity distribution is set by advection of gas due to tidal inflows during a merger.}\n\\label{fig:localULIRG_terms}\n\\end{figure}\n\n\\begin{figure}\n\\includegraphics[width=\\columnwidth]{inverted_teqbm_ld.pdf}\n\\includegraphics[width=\\columnwidth]{inverted_teqbm_hzdisc.pdf}\n\\includegraphics[width=\\columnwidth]{inverted_teqbm_hzdwarf.pdf}\n\\caption{Metallicity equilibration timescale $t_{\\rm{eqbm}}$ as a function of $x$ in galaxies with inverted gradients. The first panel represents $t_{\\rm{eqbm}}$ in local dwarfs. The second panel on high-$z$ discs is identical to the class of high-$z$ galaxies we discuss in \\autoref{s:gradients_highz2}. The third panel plots $t_{\\rm{eqbm}}$ in the case of high-$z$ dwarfs that we create by combining the fiducial parameters for local dwarfs and high-$z$ galaxies (see \\autoref{s:noneqbm_inverted_gradients} for details). The colors correspond to the different ways that can give rise to an inverted gradient in a galaxy: reduction in metal yield due to high preferential metal ejection ($\\phi_y=0.05$), enrichment of the CGM due to fountains or metal-rich flows ($\\mathcal{Z}_{\\rm{CGM}}=0.5$), and excessive cosmic accretion ($\\mathcal{A} \\to 3\\mathcal{A}$). The scatter in the model is due to $c_1$. This plot shows that inverted metallicity gradients may or may not be in equilibrium.}\n\\label{fig:invertedgradients}\n\\end{figure}\n\n\\subsection{Non-equilibrium metallicity gradients}\n\\label{s:noneqbm}\nThere are certain classes of galaxies where we find that the metallicity distribution can be out of equilibrium, \\textit{i.e.,} $t_{\\rm{eqbm}} \\gtrsim t_{\\rm{H(z)}}$ or $t_{\\rm{eqbm}} \\gg t_{\\rm{dep,H_2}}$. Hence, the model cannot always be used to predict metallicity gradients in such galaxies. Nonetheless, the limitation of the equilibrium model provides interesting constraints on the evolution of such galaxies. We discuss three such cases below.\n\n\n\\subsubsection{Local dwarfs without radial inflow}\n\\label{s:noneqbm_ld_noadvec}\nThe balance between metal production (source) and radial transport of metals through the disc (advection, diffusion) sets the metallicity gradients in local dwarfs (cf. \\autoref{s:gradients_localdwarfs}). It has also been suggested that turbulence in these galaxies is mainly driven by star formation feedback and not gravity \\citep{2015MNRAS.449.3568M,2018MNRAS.477.2716K}, which gives rise to $\\sigma_{\\rm{sf}} \\sim \\sigma_g$, and the low gas velocity dispersions observed in dwarfs \\citep{2019MNRAS.486.4463Y,2020MNRAS.495.2265V}. Here, we investigate the case where $\\sigma_{\\rm{sf}} = \\sigma_g$ such that there is no radial inflow of gas through the disc (see \\autoref{eq:radialinflow})\\footnote{$\\sigma_{\\rm{sf}} > \\sigma_g$ is not possible in equilibrium in the \\cite{2018MNRAS.477.2716K} model.}.\n\n\\autoref{fig:teqbm_ld_noadv} shows the radial profile of $t_{\\rm{eqbm}}$ in this case. It is clear that $t_{\\rm{eqbm}} \\gtrsim t_{\\rm{H(0)}}$ and $t_{\\rm{eqbm}} \\gtrsim t_{\\rm{dep,H_2}}$, especially at low $\\phi_y$, however, the exact values are sensitive to the choice of $c_1$. The reason for long metal equilibration timescales in this case is that, in the absence of advection, only diffusion and accretion are available to balance the source term. However, diffusion is weak due to the low gas dispersion ($\\kappa_0\\Sigma_{g0} \\propto \\sigma^3_g$), and accretion is weak due to the low halo mass ($\\dot\\Sigma_{\\rm{cos}0} \\propto M^{1.1}_{\\rm{h}}$). Thus, metallicity gradients may not attain equilibrium in the absence of radial gas inflows in local dwarfs, whereas even a small amount of advection is sufficient to restore metallicity equilibrium (cf.~\\autoref{fig:teqbm_ld}). In the case where there is no accretion, one can expect a diverse range of metallicity gradients that are not constrained by the model. Therefore, caution must be exercised while studying metallicity gradients in such dwarfs with an equilibrium model.\n\nAt face value, this result might seem consistent with that of \\cite{2014MNRAS.443..168F}, where the authors find that dwarf galaxies do not attain statistical equilibrium within a Hubble time (see their Figure~15; see also, \\citealt{2015MNRAS.449.3274F,2020A&A...638A.123D}). However, the equilibrium scenarios considered by \\citeauthor{2014MNRAS.443..168F} and us are not necessarily the same, and one is not a precondition of the other. \\citeauthor{2014MNRAS.443..168F} discuss the equilibrium for the total amount of gas or metals in a galaxy, which is a balance between inflow and outflow. The time required to reach this equilibrium is not necessarily the same as the time to equilibrate the distribution of metals \\textit{within} the galactic disc, for a given total metal content. Thus, one equilibrium time can be longer or shorter than the other.\n\nSimilarly, comparing $t_{\\rm{eqbm}}$ with the metal correlation timescale for local dwarfs from \\citet{2018MNRAS.475.2236K}, which is the time required for diffusion alone to smooth out the metallicity distribution in the azimuthal direction, reveals that azimuthal metal distribution in these galaxies reaches equilibrium substantially more quickly than the radial distribution that we study here. This is consistent with the findings of \\citet{Petit15a}, who also find that metal distributions equilibrate much more quickly in the azimuthal than the radial direction.\n\n\n\n\n\n\\subsubsection{Local ULIRGs}\n\\label{s:noneqbm_ulirgs}\nLocal ULIRGs are very dynamically active, and are well-known to be undergoing major mergers or have companions \\citep{1989MNRAS.240..329L,1990A&A...231L..19M,1994MNRAS.267..253L,1996MNRAS.279..477C,1999ApJ...522..113V}. These galaxies are often characterized by strong starburst and\/or AGN-driven outflows \\citep{1995ApJS...98..171V,2013ApJ...776...27V,2012ApJ...757...86S,2014A&A...568A..14A}. They also have extremely short orbital timescales (of the order of $\\sim\\,5\\,\\mathrm{Myr}$, \\citealt{2018MNRAS.477.2716K}). Local ULIRGs are very compact, with discs extending out only to $2$--$3\\,\\rm{kpc}$ \\citep{1998ApJ...507..615D,2011ApJ...726...93R}. It is quite challenging to extract gas metallicities in these galaxies because the ionised gas emission lines are often dominated by shocks \\citep{2006ApJ...637..138M,2010A&A...517A..28M} and AGN activity \\citep{2013MNRAS.435.3627E}, which interfere with traditional photoionisation-based metallicity diagnostics. In addition, high levels of dust obscuration make it difficult to model the emission line spectra \\citep{2009A&A...505.1017G,2011A&A...526A.149N,2013A&A...553A..85P,2014ApJ...790..124S}. For these reasons, there are only a handful of studies that have been able to extract gas metallicities in local ULIRGs (e.g., \\citealt{2006AJ....131.2004K,2007A&A...472..421M,2008A&A...479..687A,2008ApJ...674..172R,2012MNRAS.424..416W,2014ApJ...797...54K,2017MNRAS.470.1218P}), and to the best our knowledge the only published studies of the metallicity gradient in ULIRGs are those of \n\\citet[see their Figure~2]{2012ApJ...753....5R} and \\citet{2019MNRAS.482L..55T}.\n\nThe short orbital timescales of ULIRGs ensure that they return to dynamical equilibrium quickly compared to their merger timescales, which based on simulations are estimated to be $t_{\\rm{merge}} \\sim 0.3-1\\,\\rm{Gyr}$ \\citep{2008ApJ...675.1095J,2012ApJ...746..108T}. Thus our dynamical equilibrium model from \\cite{2018MNRAS.477.2716K} is applicable to them. We investigate whether the metallicity distribution is also in equilibrium in \\autoref{fig:teqbm_ul}, which shows $t_{\\rm{eqbm}}$ for local ULIRGs. It is clear that $t_{\\rm{eqbm}} \\sim t_{\\rm{merge}}$, thus, metallicity may or may not be in equilibrium during the entire process of a merger. Our results corroborate those of \\cite{2012MNRAS.421...98D}, who argue that merging galaxies should not be in equilibrium because tidal flows will fuel star formation \\citep{2000ApJ...530..660B,2006AJ....131.2004K,2009ApJ...691.1005R,2011MNRAS.417..580P,2013MNRAS.435.3627E,2020MNRAS.tmp.2894M}, making cosmic accretion irrelevant. We show this quantitatively in \\autoref{fig:localULIRG_terms}, where advection (radial transport of gas due to tidal inflows) is the dominant term that sets the non-equilibrium metallicity distribution, and cosmic accretion is insignificant in comparison. Our results are also in line with those from simulations and observations where metallicity gradients in local ULIRGs are observed to continuously evolve and flatten as the merger progresses \\citep[Figure~4]{2012ApJ...753....5R}, implying that the metallicity distribution is not in a steady-state. This also implies that non-equilibrium gradients in local ULIRGs are transient; assuming the galaxy settles back to being a quiescent disc after the merger, the metallicity gradient will return to the equilibrium value for a spiral galaxy on the $\\sim$ few Gyr equilibrium timescale for local spirals (cf.~\\autoref{fig:teqbm_ls}). \n\n\nGiven a merger rate, we can estimate the fraction of galaxies as a function of redshift that are expected to be out of metal equilibrium as $1-e^{-\\theta}$, where $\\theta$ is the product of the merger rate and the metallicity equilibration timescale. Following \\citet[Figure 9]{2015MNRAS.449...49R}, we see that the observed average merger rate for massive galaxies ($M_{\\star} \\geq 10^{10}\\,\\rm{M_{\\odot}}$) at $z=0$ is less than $0.06\\,\\rm{Gyr^{-1}}$ \\citep{2011ApJ...742..103L}, so we expect less than 20 per cent of massive galaxies to be out of metal equilibrium at redshift zero. Similarly, based on available observational results that find a merger rate of $0.5\\,\\rm{Gyr^{-1}}$ at $z \\approx 2$ \\citep{2009MNRAS.394L..51B,2012ApJ...747...34B,2012ApJ...744...85M}, we expect less than 40 per cent of the most massive galaxies ($M_{\\star} \\geq 10^{11}\\,\\rm{M_{\\odot}}$) to be out of metal equilibrium at redshift two. The larger fraction of galaxies that are expected to be out of metal equilibrium at high redshift could explain the inverted gradients seen in high-$z$ observations, a topic we explore in \\autoref{s:noneqbm_inverted_gradients}.\n\n\n\n\\subsubsection{Galaxies with inverted gradients}\n\\label{s:noneqbm_inverted_gradients}\nRecent observations have discovered the presence of inverted (positive) gas phase metallicity gradients in galaxies \\citep{2014A&A...563A..49S,2017MNRAS.469..151B,2020A&A...636A..42M}, especially at high redshift \\citep{2010Natur.467..811C,2012A&A...539A..93Q,2014MNRAS.443.2695S,2018MNRAS.478.4293C,2019ApJ...882...94W,2020MNRAS.492..821C,2020ApJ...900..183W,2020arXiv201103553S}. Inverted gradients reflect the possibility of galaxies deviating from the classical, inside-out formation picture, at least temporarily. The three leading mechanisms that are believed to give rise to an inverted gradient are: (1.) substantial metal mass loading or merger-induced tidal flows of metal-poor gas that deprives the galaxy centre of metals, especially in dwarfs (\\citealt{2005MNRAS.363....2K,2006AJ....131.2004K,2018ApJ...869...94E,2019MNRAS.482.1304E,2018MNRAS.481.1690C,2019MNRAS.482.2208T}; see, however, \\citealt{2019ApJ...874...18W}), (2.) re-accretion of ejected metals at the outer edge of the disc from the CGM through cold, metal-rich flows or galactic fountains \\citep{2003MNRAS.345..349B,2006MNRAS.368....2D,2009Natur.457..451D,2010Natur.467..811C,2013ApJ...776L..18C,2015MNRAS.448..895S}, and (3.) cosmic accretion of metal-poor gas at the centre that dilutes the central metallicity \\citep{2010Natur.467..811C}.\n\nCorresponding to these three scenarios, we can produce inverted gradients in our model by coupling a moderate or high value of $\\mathcal{Z}_{\\rm GCM}$ (\\textit{i.e.,} addition of metal-rich gas to galaxy outskirts) with small values of $\\phi_y$ or large values of $\\mathcal{A}$ (corresponding to depressed central metallicity due to heavy metal loss or rapid dilution by metal-poor gas, respectively). However, any inverted gradients that we get from the model are sensitive to our choice of $\\mathcal{Z}_{\\rm{CGM}}$, in the sense that we never get an inverted gradient for a sufficiently low value of $\\mathcal{Z}_{\\rm{CGM}}$. Nevertheless, regardless of the value of $\\mathcal{Z}_{\\rm{CGM}}$ that we adopt, the resulting inverted gradients may or may not be in equilibrium. We illustrate this in \\autoref{fig:invertedgradients}, where we plot $t_{\\mathrm{eqbm}}$ for local dwarfs, high-$z$ discs (identical to high-$z$ galaxies we discuss in \\autoref{s:gradients_highz2}), and high-$z$ dwarfs. We introduce the latter category by combining fiducial parameters for local dwarfs and high-$z$ galaxies from \\autoref{tab:tab2} in the following manner: $\\beta=0.5,\\,\\sigma_{\\mathrm{sf}}=7\\,\\mathrm{km\\,s^{-1}},\\,\\sigma_g = 40\\,\\mathrm{km\\,s^{-1}},\\,v_{\\phi}=80\\,\\mathrm{km\\,s^{-1}},f_{g,Q}=f_{g,P}=0.9, f_{\\mathrm{sf}}=0.4$, and $x_{\\rm{max}}=4$ at $z=2$. The three colors in all the panels in \\autoref{fig:invertedgradients} correspond to low $\\phi_y = 0.05$ (with $\\mathcal{Z}_{\\rm{CGM}}=0.1$), high $\\mathcal{Z}_{\\rm{CGM}}=0.5$ (with $\\phi_y=0.1$), and high accretion where we multiply our fiducial values of $\\mathcal{A}$ by 3 (with $\\phi_y=0.1,\\,\\mathcal{Z}_{\\rm{CGM}}=0.1$), respectively. The shaded regions correspond to the allowed values of $c_1$ based on the constraints we introduced in \\autoref{s:modelevolve_solution}.\n\nWe see that whether galaxies with inverted gradients are likely to be in equilibrium or not depends largely on what produces the inversion. Galaxies where the gradient inverts due to rapid accretion (high $\\mathcal{A}$) have relatively short values of $t_{\\rm eqbm}$, and may be in equilibrium as long as the accretion lasts, while those that invert due to an influx of metal-rich gas at their outskirts (high $\\mathcal{Z}_{\\rm GCM}$) are almost certainly out of equilibrium; galaxies with extremely efficient metal loss (low $\\phi_y$) are intermediate, and may or may not be in equilibrium. Regardless of these details, the fact that many inverted gradients are not in equilibrium also hints at the possibility of them being transient \\citep[see also,][]{2017MNRAS.467.1154S}. This is because subsequent star formation in the galaxy centre (due to cold gas accretion or re-accretion of enriched gas from the CGM) will replenish the metal supply on timescales comparable to the star formation timescale, thus leading to the formation of a negative gradient again. Hence, we expect inverted gradients to be erased within a star formation timescale ($\\lesssim 2\\,\\rm{Gyr}$ for massive galaxies, \\citealt{2008AJ....136.2782L}) unless they are re-established on a similar timescale. Since the processes that can cause inverted gradients (strong fountains, mergers, sudden accretion events, etc.) tend to wane with redshift, we expect that most massive galaxies will establish negative gradients by $z=0$, though some dwarfs, which have longer equilibration (and star formation) timescales, might retain their inverted gradients to $z=0$ or close to it.\n\n\n\n\\section{Conclusions}\n\\label{s:conclusions}\nIn this work, we present a new theoretical model to explain the occurrence and diversity of gas phase metallicity gradients in galaxies. Starting from the conservation of metal mass, we incorporate major physical processes that can impact the distribution of metals in galaxies, namely, metal production, consumption, loss, advection, accretion and diffusion. Our first-principles based model shows that the radial metallicity gradients observed in galaxies are a natural consequence of inside-out galaxy formation. The equilibrium metallicity evolution model we present is a standalone model, but it requires inputs from a galaxy evolution model to set the galaxy properties that control metallicity. This intricate link between gas and metallicity lets us directly predict the evolution of metallicity gradients without ad hoc assumptions about galaxy properties.\n\nThe evolution of metallicities in our model depends on four dimensionless ratios: $\\mathcal{T}$, $\\mathcal{P}$, $\\mathcal{S}$, and $\\mathcal{A}$. These describe the ratio of the orbital timescale to the diffusion timescale, advection to diffusion, production (and metal ejection) to diffusion, and cosmic accretion to diffusion, respectively. Based on the input galaxy evolution model \\citep{2018MNRAS.477.2716K}, we show how these ratios depend on various properties of the gas (cf. \\autoref{eq:physicalChi} $-$ \\autoref{eq:physicalA}). The resulting second order differential equation of the radial distribution of metallicity has a simple analytic solution given by \\autoref{eq:main_nondimx_solution} that we use to predict a possible range of metallicity gradients as a function of galaxy properties. We use this capability to predict the metallicity gradients of local spirals, local dwarfs, and high-redshift disc galaxies, and to predict the evolution of metallicity gradients in galaxies with redshift. Below, we list our main results:\n\n\\begin{enumerate}\n \\item The time required for the metal distribution within a galaxy to reach equilibrium is smaller than the Hubble time and comparable to the molecular gas depletion time in local spirals, (most) local dwarfs, and rotation-dominated high-$z$ galaxies. Thus, for most galaxies over most of cosmic time, the gas phase metallicity gradient is in equilibrium. Exceptions to this general trend \\textit{can} include merging galaxies, galaxies with inverted metallicity gradients, and some very low-mass local dwarf galaxies.\n \\item Galaxies tend to approach a particular value of central metallicity, dictated by the balance between the two dominant processes that depend on the properties of the galaxy (see below). The central metallicities we predict agree well with observations.\n \\item In local spirals, the two dominant processes shaping the metallicity gradient are metal production ($\\mathcal{S}$), which tries to steepen the gradient, and accretion of metal-poor gas ($\\mathcal{A}$), which tries to flatten it. On the other hand, metallicity gradients in local dwarfs and high-$z$ galaxies are set by the balance between $\\mathcal{S}$ and advection of metal-poor gas from the outer to the inner parts of galaxies ($\\mathcal{P}$).\n \\item One crucial free parameter that emerges from our model is the ``yield reduction factor'' $\\phi_y$, defined as the fraction of supernova-produced metals that mix with the ISM rather than being lost immediately in metal-enhanced galactic winds. While metallicity gradients in local spirals are not tremendously sensitive to $\\phi_y$, it has a significant effect on the metallicity gradients in local dwarfs and high-$z$ galaxies. $\\phi_y$ also impacts the absolute metallicities in all galaxies. Comparison of the model with observations reveals that massive galaxies prefer a high value of $\\phi_y$, whereas low-mass galaxies prefer a lower value of $\\phi_y$. Thus, the model predicts that low-mass galaxies undergo more preferential metal ejection, and should have more metal-enriched winds than massive galaxies. Future work should thus focus on constraining $\\phi_y$ from observations.\n\\end{enumerate}\n\nAs a first application of our model, we study the evolution of metallicity gradients with redshift, both within a single galaxy and over samples of galaxies at different redshifts selected to have matching stellar masses or comoving densities. Our model shows that gradients in Milky Way-like galaxies have steepened over time, in qualitative agreement with recent observations; quantitative agreement between the model and the data requires a scaling of $\\phi_y$ such that $\\phi_y$ was low for the Galaxy in the past as compared to today, consistent with that seen in simulations. We also predict the existence of specific signatures for the evolution of metallicity gradient with redshift as a function of stellar mass that can be tested with future surveys. We show that both the Milky Way in particular and disc galaxies in general transition from the advection-dominated ($\\mathcal{P} > \\mathcal{A}$) to the accretion-dominated ($\\mathcal{P} < \\mathcal{A}$) regime from high to low redshifts. This transition mirrors the transition from gravity-driven to star formation-driven turbulence from high to low redshifts \\citep{2018MNRAS.477.2716K}. In companion papers, we show that this transition (along with $\\phi_y$) is also responsible for driving the shape of the mass-metallicity relation and the mass-metallicity gradient relation \\citep{2020aMNRAS.xxx..xxxS} in the local Universe, and we also apply our model to explain the relationship between metallicity gradients and gas kinematics in high redshift galaxies \\citep{2020bMNRAS.xxx..xxxS}.\n\n\n\n\\section*{Acknowledgements}\nWe dedicate this work to the medical services personnel who have been working tirelessly to combat COVID-19 across the world; this work would not have been possible without their sincere efforts in keeping the community safe. We thank the anonymous reviewer for a thorough referee report that helped improve the manuscript. We also thank Meridith Joyce, Stephanie Monty, J. Trevor Mendel, Lisa Kewley, Kenneth Freeman, and Raymond Simons for several useful discussions. We are grateful to Xiangcheng Ma for sharing results of the FIRE simulations, and to Mirko Curti for sharing their data compilation on metallicity gradients in high-$z$ galaxies. PS is supported by the Australian Government Research Training Program (RTP) Scholarship. MRK and CF acknowledge funding provided by the Australian Research Council (ARC) through Discovery Projects DP190101258 (MRK) and DP170100603 (CF) and Future Fellowships FT180100375 (MRK) and FT180100495 (CF). MRK is also the recipient of an Alexander von Humboldt award. PS, EW and AA acknowledge the support of the ARC Centre of Excellence for All Sky Astrophysics in 3 Dimensions (ASTRO 3D), through project number CE170100013. JCF is supported by the Flatiron Institute through the Simons Foundation. Analysis was performed using \\texttt{numpy} \\citep{oliphant2006guide,2020arXiv200610256H} and \\texttt{scipy} \\citep{2020NatMe..17..261V}; plots were created using \\texttt{Matplotlib} \\citep{Hunter:2007} and \\texttt{astropy} \\citep{2013A&A...558A..33A,2018AJ....156..123A}. This research has made extensive use of NASA's Astrophysics Data System Bibliographic Services. This research has also made extensive use of Wolfram|Alpha\\footnote{\\url{wolframalpha.com}} and \\texttt{Mathematica} for numerical analyses, the \\cite{2006PASP..118.1711W} cosmology calculator, and the image-to-data tool \\texttt{WebPlotDigitizer}\\footnote{\\url{https:\/\/automeris.io\/WebPlotDigitizer}}. \n\n\n\\section*{Data availability statement}\nNo data were generated for this work. \n\n\\bibliographystyle{mnras}\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section*{Introduction} \nLet $G=(V,E)$ denote a graph with vertex set $V$ and edge set $E \\subseteq (V\\times V)\/S_2$, consisting of unordered pairs of elements of $V$. The \\emph{edge deck} $\\mathcal{D}^e(G)$ of $G$ is the multi-set of isomorphism classes of all edge-deleted subgraphs of $G$. Harary \\cite{Harary} conjectured in 1964 that graphs on at least four edges are edge-reconstructible, i.e., determined up to isomorphism by their edge deck. \nThis so-called \\emph{edge reconstruction conjecture} is the analogue for edges of the famous (vertex) reconstruction conjecture of Kelly and Ulam that every graph on at least three vertices is determined by its (similarly defined) vertex deck (compare \\cite{Bondy}). Many invariants of graphs where shown to be reconstructible from the vertex and\/or edge deck, and from the large literature on the subject, we quote the following three sources that are most relevant in the context of our results: (a) vertex-reconstruction of the characteristic polynomial (of the vertex adjacency matrix) by Tutte \\cite{Tutte}; (b) vertex-reconstruction of the number of (possibly backtracking) walks of given length through a given vertex $v \\in V$ (which one can specify without knowing the graph $G$ by pointing to the element $G-v$ of the vertex deck) by Godsil and McKay \\cite{Godsil}; (c) edge reconstruction for graphs with average degree $\\bar d \\geq 2 \\log_2 |V|$ by Vladim\\'{\\i}r M\\\"uller \\cite{Muller}, improving upon a method of Lov\\'asz \\cite{Lovasz}. \n\nFollowing the discussion by McDonald in \\cite{McDonald}, the edge reconstruction conjecture should also hold for multi-graphs. Since disconnected (multi-)graphs are reconstructible (\\cite{Bondy}, 6.14(b), \\cite{McDonald}, Cor.\\ 4), we may assume that $G$ is connected. An edge with equal ends is called a loop. The degree of a vertex is the number of edges to which it belongs, where, as usual, a loop is counted twice. The average degree $\\bar d$ of $G$ then equals $$\\bar d = \\frac{1}{|V|} \\sum_{v \\in V} \\deg v = 2 \\frac{|E|}{|V|}.$$ An degree-one vertex is called an end-vertex. All results in this paper hold for \\emph{connected finite undirected multi-graphs without end-vertices}, and from now on we will use the word ``graph'' for such multi-graphs.\n\nIf $e=\\{v_1,v_2\\} \\in E$, we denote by $\\ra{e}\\ =(v_1,v_2)$ the edge $e$ with a chosen orientation, and by $\\la{e}\\ =(v_2,v_1)$ the same edge with the inverse orientation to that of $\\ra{e}$. Let $o(\\ra{e})=v_1$ denote the origin of $\\ra{e}$ and $t(\\ra{e})=v_2$ its end point. If there are multiple edges between $v_1,v_2$ then we will label them $e_i=(v_1,v_2)_i$. A non-backtracking edge walk of length $n$ is a sequence $e_1e_2....e_n$ of edges such that $t(e_i)=o(e_i+1)$, but $\\la{e_{i+1}}\\not=\\ra{e_{i}}$. These are captured by the Bass--Hashimoto \\emph{edge adjacency matrix} $T=T_G$ \\cite{Hashimoto}, \\cite{Bass}; let $\\E$ denote the set of oriented edges of $G$ for any possible choice of orientation, so $|\\E|=2|E|$, $T$ is defined to be the $2|E|\\times2|E|$ matrix, in which the rows and columns are indexed by $\\E$, and \n$$T_{\\ra{e_1},\\ra{e_2}}= \\left\\{ \\begin{array}{l} 1 \\mbox{ if }t(\\ra{e_1})=o(\\ra{e_2}) \\mbox{ but }\\ra{e_2}\\ \\neq\\ \\la{e_1}; \\\\ 0 \\mbox{ otherwise}. \\end{array} \\right.$$ If $r \\in \\Z_{\\geq 1}$, the entry $(T^r)_{\\ra{e_1},\\ra{e_2}}$ is the number of non-backtracking walks of length $r$ on $G$ that start in the direction of $\\ra{e_1}$ and end in the direction of $\\ra{e_2}$. As for the usual adjacency matrix, graphs can have the same eigenvalues for $T$ without being isomorphic (\\cite{Terras}, Chapter 21). \n\nThe matrix $T$ is related to the \\emph{Ihara zeta function} $\\zeta_G$ of $G$ \\cite{Ihara}, defined as the following analogue of the Selberg zeta function from differential geometry (cf.\\ \\cite{Terras}, Part I): \\begin{equation} \\label{sel1} \\zeta_G(u) := \\prod_{p} (1-u^{\\ell(p)})^{-1}, \\end{equation} where the product runs over classes of non-backtracking \ntailless closed oriented \\emph{prime} walks $p$ in $G$ (where ``class'' refers to not having a distinguished starting point, and ``prime'' refers to not being a multiple of another walk), and $\\ell(p)$ is the length of $p$. The function $\\zeta_G(u)$ is a formal power series in $u$, but it is also convergent as a function of the complex variable $u$ for $|u|$ sufficiently small. We have an identity (\\cite{Bass}, II.3.3) \\begin{equation} \\label{sel2} \\zeta^{-1}_G(u)=\\det(1-Tu)=u^{2|E|} \\det(u^{-1}-T),\\end{equation} showing that $\\zeta_G$ has an analytic continuation to the entire complex plane as a rational function with finitely many poles. If one so wishes, one may take Equation (\\ref{sel2}) as a definition of $\\zeta_G$; in this paper, the original definition as in Equation (\\ref{sel1}) will not play any r\\^ole. \n\n\nWe will prove the following:\n\n\\begin{introtheorem} \\label{main} Let $G$ denote a graph of average degree $\\bar d$. The following are edge-reconstructible:\n\\begin{enumerate}\n\\item[\\textup{(i)}] If $\\bar d \\geq 4$, the Ihara zeta function $\\zeta_G$ of $G$, i.e., the spectrum of the edge-adjacency matrix $T$; in particular, the Perron-Frobenius eigenvalue $\\lambda_{\\PF}$ of $T$;\n\\item[\\textup{(ii)}] If $\\bar d \\geq 4$, the number $N_r$ of non-backtracking closed walks on $G$ of given length $r$;\n\\item[\\textup{(iii)}] If $\\bar d > 4$, the functions\n\\begin{enumerate}\n\\item[\\textup{(a)}] $N_r \\colon \\mathcal{D}^e(G) \\rightarrow \\Z$ that associates to an element $G-e$ of the edge deck of $G$ the number $N_r(e)$ of non-backtracking closed\nwalks on $G$ of given length $r$ passing through $e$;\n\\item[\\textup{(b)}] $M_r \\colon \\mathcal{D}^e(G) \\rightarrow \\Z$ that associates to an element $G-e$ of the edge deck of $G$ the number $M_r(e)$ of non-backtracking (not necessarily closed)\nwalks on $G$ of given length $r$ starting at $e$ (in any direction);\n\\end{enumerate}\n\\item[\\textup{(iv)}] If $\\bar d > 4$, the function $\\mathcal{D}^e(G) \\rightarrow \\binom{\\R}{2}$ (where $\\binom{\\R}{2}$ is the set of unordered pairs of real numbers) that associates to an element $G-e$ of the edge deck the unordered pair $\\{\\mathbf{p}_{\\ra{e}},\\mathbf{p}_{\\la{e}}\\}$ of entries of the normalized Perron-Frobenius eigenvector $\\mathbf{p}$ of $T$;\n\n\\item[\\textup{(v)}] If $\\bar d> 4$, the function $F_r \\colon \\mathcal{D}^e(G) \\rightarrow \\Z$ that associates to an element $G-e$ of the edge deck $\\mathcal{D}^e(G)$ of $G$ the number of non-backtracking closed walks on $G$ of given length $r$ that pass through $e$ in both directions at least once.\n\\end{enumerate}\nFurthermore, if $G$ is bipartite, then (iii)-(v) also hold for $\\bar d = 4$.\n\\end{introtheorem}\n\nThe statements (iii)-(v) in the theorem make sense, since if $G-e \\cong G-e'$, the functions turn out to have the same value at $e$ and $e'$ (cf.\\ Remark \\ref{mn}). \n\nWe indicate briefly how to prove these results. Deleting an edge from the graph corresponds to deleting \\emph{two} rows and columns from the matrix $T$ (namely, corresponding to the two possible orientations on the edge). The proof of (i) starts with a lemma on the combinatorial reconstruction of the top half of the coefficients of $\\det(\\lambda-T)$ from \\emph{second} derivatives of $2 \\times 2$-minors of $T$ (Section \\ref{poly}). The next step in the proof is to exploit certain relations between the coefficients in $\\det(\\lambda-T)$ which arise from a formula of Bass that relates $\\det(\\lambda-T)$ to a polynomial of degree $2|V|$---there are enough relations to reconstruct all coefficients if the stated condition on the average degree holds (Section \\ref{Sbass}; in a sense, this is an analogue of the ``functional equation'' for the Ihara zeta function of a \\emph{regular} graph). Part (ii) follows by expressing the formal logarithm of the Ihara zeta function as a counting function for such closed walks. Alternatively, one may take this expression as a starting point of the proof, reduce the problem in (i) to that of counting closed walks of length $<|E|$, and use Kelly's Lemma. The proof of (iii) uses the Jordan normal form decomposition for the matrix $T$, the non-vanishing of an associated ``confluent alternant'' determinant and the fact that $T$ has a ``large'' semi-simple part to reduce the counting problem to length $<|E|$, which then again is done by purely combinatorial means. In case of non-closed walks, this also involves identities based on decomposition of walks into closed and non-returning walks. On the way, we prove some further spectral properties of $T$, e.g., that it is symmetric on a $\\Pi_{|E|}$-Pontrjagin space (Proposition \\ref{krein}), and an explicit description of its $\\pm 1$ eigenspaces in terms of certain spaces of cycles on the graph (Propositions \\ref{h} and \\ref{hplus}). We also point out that the presence of end-vertices in the graph leads to a non-semi-simple $T$-operator (Proposition \\ref{sinkjordan}). Part (iv) follows from known behavior of the Ces\\`aro averages of powers of non-negative matrices. Finally, part (v) follows by using an identity of Jacobi for $2\\times 2$-sub-determinants.\n\n\nTwo \\emph{open problems} that arise from the proofs and that we want to highlight are the following: (a) can the Ihara zeta function $\\zeta_G$ be reconstructed from the (multi-)set $\\{\\zeta_{G-e} \\colon e \\in E \\}$ of Ihara zeta functions of edge-deleted graphs?; (b) for $|E| \\geq 2$, is $T$ semi-simple if and \\emph{only if} $G$ has an end-vertex?. \n\n\nWe finish this introduction by listing some applications. \n\nAs we explain in \\cite{CK} (cf.\\ also \\cite{CM}), the invariants that we have reconstructed play a central role in the measure-theoretical study of the action of the fundamental group on the boundary of the universal covering tree of the graph. More precisely, the fundamental group $\\Gamma$ of $G$, a free group of rank the first Betti number $b>1$ of $G$, acts on the boundary of the universal covering tree of $G$. This dynamical system ``remembers'' only $b$, since it is topologically conjugate to the action of the free group of rank $b$ on the boundary of its Cayley graph. However, the graph is uniquely determined by a measure on the boundary, namely, the pull-back of the Patterson-Sullivan measure for the action of $\\Gamma$ on the boundary. For this measure, the boundary has Hausdorff dimension $\\log \\lambda$, where $\\lambda$ is the Perron-Frobenius eigenvalue of $T$, and the measure itself is expressed on a set of generators for $\\Gamma$ in terms of $\\lambda$, the entries of the Perron-Frobenius eigenvector of $T$, and the lengths of the loops corresponding to the generators \n\nIn \\cite{SpectralRedemption}, the operator $T$ is used for spectral algorithms that find clustering in large graphs. This is a hard problem if the graphs under consideration are sparse with widely varying degrees, and the authors argues that use of the operator $T$ outperforms classical algorithms based the spectrum of the adjacency or Laplacian operator. Since the input for their clustering algorithm consists of the two leading eigenvalues of $T$, our main theorem shows reconstruction of this input (if $\\bar d \\geq 4$). \n\nIn the theory of evolution of species, it has recently been argued that evolutionary relations are not always tree-like \\cite{Iersel}. Thus, the phylogenetic reconstruction problem should be considered in the context of general multigraphs, rather than the more traditional case of trees, and our theorem gives a theoretical underpinning for this more general question of reconstruction. \n\n\n\n\\section{A lemma on polynomial coefficients}\\label{poly}\n\n\\begin{notation} If $P$ is a single valued polynomial in the variable $\\lambda$, let $[\\lambda^d]P$ denote the coefficient of $\\lambda^d$ in $P$. \n\\end{notation} \n\n\\begin{theorem} \\label{tfirst} For $d=|E|+1,\\dots,2|E|$, the coefficients $[\\lambda^d]\\det(\\lambda-T_G)$ of the characteristic polynomial of the edge adjacency matrix $T_G$ of a graph $G$ are reconstructible from the edge deck $\\mathcal{D}^e(G)$. More precisely, \n\\begin{equation} \\label{booh}\n[\\lambda^d]\\det(\\lambda-T_G) = \\sum_{r =1}^{\\lfloor \\frac{d}{2}\\rfloor} (-1)^{r+1} \\sum_{i_1m$, then\n\\begin{equation} \\label{co} \n[\\lambda^d]P(\\lambda,\\dots,\\lambda) = \\sum_{r =1}^{\\lfloor \\frac{d}{2}\\rfloor} (-1)^{r+1} 2^{-r} \\sum_{i_1m$, we have $k \\geq 1$, and since $P$ has degree $d$, we also have $k \\leq d\/2$. Then the right hand side equals $$\\sum_{r =1}^{k} (-1)^{r+1} 2^{-r} \\cdot 2^r \\binom{k}{r} = 1-(1-1)^k = 1.$$\n\\end{proof}\n\n\\section{A formula of Bass and reconstruction of $\\zeta_G$}\\label{Sbass}\n\nIf the graph $G$ under consideration is $(q+1)$-\\emph{regular} for some $q \\in \\Z_{\\geq 2}$ (when the reconstruction problem is easy), the Ihara zeta function satisfies functional equations, for example (\\cite{Bass}, II.3.10)\n$$ \\zeta_G(\\frac{1}{qu}) =\\left(\\frac{1-u^2}{1-q^2u^2}\\right)^{n\\frac{q-1}{2}}q^{qn} u^{(q+1)n} \\zeta_G(u). $$\nThis implies ``palindromic'' relations between the top $m$ and bottom $m$ coefficients of $\\zeta^{-1}_G(u)$, so that reconstruction of half the coefficients would be enough. In the general (irregular) case that we consider here, there is no such functional equation, but as a substitute for finding relations between the coefficients, at the cost of assuming a certain minimal average degree, we will use an identity of Bass (\\cite{Bass}, II.1.5), stating that \\begin{equation} \\label{bass} \\det(1-Tu) = (1-u^2)^{|E|-|V|} \\det(1-Au+(D-1)u^2),\\end{equation} where $A$ is the adjacency matrix of $G$ and $D = \\mathrm{diag} (\\deg(v_1),\\dots,\\deg(v_{|V|}))$ is the degree matrix of $G$. \n\n\\begin{lemma} \\label{po} The coefficients $[\\lambda^d]B_G$ of $B(\\lambda)=\\det(\\lambda^2-A\\lambda+(D-1))$ are edge-reconstructible for $d=2|V|-|E|+1,\\dots,2|V|.$\n\\end{lemma}\n\n\\begin{proof} Set $P(\\lambda)=\\det(\\lambda-T)$, and $A(\\lambda)=(\\lambda^2-1)^{|E|-|V|}$. The identity of Bass becomes $P(\\lambda)=A(\\lambda) B(\\lambda).$ \nAll coefficients $[\\lambda^i]A$ are easily computable and depend only on $|E|$ and $|V|$; also note that for even $i$, they are non-zero. Now $|V|$ and $|E|$ are edge-reconstructible as $|V|=|V-e|$ and $|E|=|E-e|+1$ for any $e \\in E$. The previous theorem implies that the coefficients $[\\lambda^k]P$ are edge reconstructible for $k=|E|+1,\\dots,2|E|$. We will use this to reconstruct the coefficients $[\\lambda^d]B$ for $d = 2|V|-|E|+1,\\dots,2|V|$. We use the formula \\[ [\\lambda^k]P=\\sum\\limits_{i=0}^{2|V|} [\\lambda^i]B \\cdot [\\lambda^{k-i}] A.\\]\nrecursively. For $k=2|E|$ we find the relation $$[\\lambda^{2|E|}]P=[\\lambda^{2|V|}]B \\cdot [\\lambda^{2(|E|-|V|)}]A,$$ from which we find $[\\lambda^{2|V|}]B$. We continue with $[\\lambda^{2|E|-1}]P, [\\lambda^{2|E|-2}]P,\\dots$ and note that in each step corresponding to $[\\lambda^{2|E|-j}]P$ we find recursively that the only unknown term in the above sum is $$[\\lambda^{2|V|-j}]B \\cdot [\\lambda^{2(|E|-|V|)}]A.$$ Since $ [\\lambda^{2(|E|-|V|)}]A \\neq 0$, this allows us to recover $[\\lambda^{2|V|-j}]B$. The procedure terminates at $[\\lambda^{2|V|-|E|+1}]B$, since $[\\lambda^{2|E|-(|E|-1)}]P$ is the highest coefficient which is not reconstructed by the previous theorem. \n\\end{proof}\n\n\\begin{theorem}[Theorem \\ref{main}\\textup{(i)}] Let $G$ denote a graph of average degree $\\bar d \\geq 4$; then the Ihara zeta function $\\zeta_G$ of $G$, i.e., the spectrum of the edge-adjacency matrix $T$, is edge-reconstructible.\n\\end{theorem}\n\n\\begin{proof} We first observe that $$[\\lambda^0]B = \\det(D-1) = \\prod_{v \\in V} (\\deg(v)-1)$$ is reconstructible, since the degree sequence is reconstructible (\\cite{Bondy}, 6.14.(a), \\cite{McDonald}). Therefore, from the previous lemma, we can reconstruct \\emph{all} $[\\lambda^d]B$ (and hence $B$, and hence $P$) if $$2|V|-|E|+1\\leq 1.$$ This holds exactly if $\\bar d\\geq 4$, since\n$\\bar d=2|E|\/|V|.$\n\\end{proof}\n\n\\begin{notation} If the graph $G$ is connected with no degree one vertices and first Betti number $b_1 \\geq 2$ (which follows from our running hypothesis $\\bar d \\geq 4$), the matrix $T$ is irreducible (\\cite{Terras}, 11.10), hence it has a (simple) Perron-Frobenius eigenvalue $\\lambda_{\\PF}$ equal to the spectral radius of $T$; it is the maximal real positive eigenvalue of $T$ (e.g., \\cite{Meyer}, 8.3). \n\\end{notation}\n\n\\begin{corollary} \\label{recpf}\nLet $G$ denote a graph of average degree $\\bar d \\geq 4$; then the Perron-Frobenius eigenvalue $\\lambda_{\\PF}$ of $T=T_G$ is edge-reconstructible. \\qed\n\\end{corollary}\n\n\n\nIn Section \\ref{walks}, we will give another proof of Theorem \\ref{main}(i) that avoids Lemma \\ref{pol}, but has the disadvantage of not leading directly to the formula from Theorem \\ref{tfirst} for the coefficients in terms of coefficients corresponding to edge-deleted subgraphs. \n\nIn analogy to the question whether the characteristic polynomial of $G$ is determined uniquely by those of its vertex deleted subgraphs \\cite{Gutman}, one may ask\n\n\\begin{question} Can $\\zeta_G$ be reconstructed from $\\{ \\zeta_{G-e} \\colon e \\in E \\}$?\n\\end{question} \n\n\\begin{theorem} If $G$ has average degree $\\bar d > 4$, then $\\zeta_G$ is uniquely determined by the multiset $\\mathcal{Z}(G):=\\{ \\zeta_{G-\\mathbf{e}} \\colon \\emptyset \\neq \\mathbf e \\subset E \\},$ where $\\mathbf{e}$ runs over all non-empty subsets of $E$. \n\\end{theorem}\n\n\n\n\\begin{proof}\nThe number $|\\mathbf e|$ of distinct edges in $\\mathbf{e}$, is determined by the degree of $\\zeta^{-1}_{G-\\mathbf{e}}$. The formula in Theorem \\ref{tfirst} can be rewritten as\n$$ [\\lambda^d] \\zeta_G^{-1} = \\sum_{r =1}^{\\lfloor \\frac{d}{2}\\rfloor} (-1)^{r+1} \\sum_{|\\mathbf e|=r} [\\lambda^{d-2r}] \\zeta_{G-\\mathbf{e}}^{-1}$$ for $d>|E|$, which is reconstructible from $\\mathcal Z (G)$. As in Lemma \\ref{po}, we can then also reconstruct all coefficients of $\\zeta_G^{-1}$, as soon as $2|V|-|E|+1<1$, i.e., $\\bar d > 4$. \\end{proof} \n\nIf $\\mathcal Z (G)$ uniquely determines $\\det(D-1)$, then one may replace the bound $\\bar d > 4$ in this theorem by $\\bar d \\geq 4$. \n\n\\begin{remark} We list some properties that have been shown to be determined by $\\zeta_G$ (hence for $\\bar d \\geq 4$ are edge-reconstructible by our main theorem; but the edge-reconstructibility of these invariants was already known from Kelly's Lemma): \n\\begin{enumerate}\n\\item the \\emph{girth} $g$ (length of shortest cycle) of $G$ (since $[\\lambda^i]\\det(\\lambda-T)=0$ for $i=2m-1,\\dots,2m-g+1$, and for $i=2m-g,\\dots,2m-2g+1$, it is negative twice the number of $(2m-i)$-gons in $G$, cf.\\ Scott and Storm \\cite{StormInvolve}); \n\\item whether $G$ is \\emph{bipartite and cyclic, bipartite non-cyclic or non-bipartite} (Cooper \\cite{Cooper}, Theorem 1); \n\\item whether or not $G$ is \\emph{regular}; and if so, its regularity and the spectrum of its (vertex) adjacency operator (Cooper \\cite{Cooper}, Theorem 2).\n\\end{enumerate}\n\\end{remark}\n\n\n\\section{Symmetry of the Bass-Hashimoto edge adjacency operator}\n\nThe matrix $T$ is not symmetric in general: for a graph $G$ in our sense, this only happens if $G$ is a ``banana graph'' consisting of two vertices connected by several edges (since $T$ being a symmetric matrix means that $T_{\\ra{e_2},\\ra{e_1}}=1$ whenever $T_{\\ra{e_1},\\ra{e_2}}=1$). However, $T$ does have a certain symmetry. \n\n\\begin{definition}\nMet $M^\\intercal$ denote the transpose of a matrix $M$. Define an indefinite symmetric bilinear form $\\langle \\cdot, \\cdot \\rangle$ on $\\R^{2|E|}$ by $$\\langle x,y \\rangle := x^{\\intercal} J y,$$ where $J$ is a block matrix \n$$ J = \\left( \\begin{array}{cc} 0 & 1_{|E|} \\\\ 1_{|E|} & 0 \\end{array} \\right). $$ The signature of this form is $(|E|,|E|)$, and $(\\R^{2|E|}, \\langle , \\rangle)$ is a finite dimensional Kre\\u{\\i}n space (i.e., an indefinite metric space, compare \\cite{Bognar}). \n\\end{definition}\n\nAn eigenvalue is called \\emph{semi-simple} if its algebraic and geometric multiplicity are equal. \n\n\\begin{proposition} \\label{krein} \nThe operator $T \\colon \\R^{2|E|} \\rightarrow \\R^{2|E|}$ is symmetric for an (indefinite) metric $\\langle \\cdot , \\cdot \\rangle$ of signature $(|E|,|E|)$. Its generalized eigenspaces are mutually orthogonal for this metric, and $T$ has at most $|E|$ non-semi-simple eigenvalues. \n\\end{proposition}\n\n\\begin{proof} \nObserve that $$T_{\\ra{e_1},\\ra{e_2}} = T_{\\la{e_2},\\la{e_1}}$$ for all $e_1, e_2 \\in E$. By enumerating the rows and columns of $T$ as $\\ra{e_1},\\dots,\\ra{e_{|E|}},\\la{e_1},\\dots,\\la{e_{|E|}}$, we see that $T$ is of the form \n$$ T = \\left( \\begin{array}{cc} A & B \\\\ C & A^\\intercal \\end{array} \\right) \\mbox{ with } B=B^\\intercal \\mbox{ and } C^\\intercal=C. $$\nBeing of this form is equivalent to the fact that $T$ satisfies an equation\n\\begin{equation} \\label{Tss} T^\\intercal = JTJ. \\end{equation}\nEquation (\\ref{Tss}) means exactly that $T$ is symmetric for the form $\\langle , \\rangle$, namely: $\\langle Tx, y \\rangle = \\langle x, Ty \\rangle$ for all $x,y \\in \\R^{2|E|}$.\n\n Since $T$ is $J$-symmetric, the different generalized eigenspaces are mutually $J$-orthogonal (\\cite{Bognar}, II.3.3). Finally, since $\\langle , \\rangle$ has signature $(|E|,|E|)$, the space $(\\R^{2|E|},\\langle , \\rangle)$ is a Pontrjagin $\\Pi_{|E|}$-space in the sense of \\cite{Bognar}, Chapter IX. Since $T$ is $J$-symmetric, it follows that the number of distinct non-semi-simple eigenvalues is less than or equal to $|E|$ (\\cite{Bognar}, IX.4.8).\n\\end{proof} \n\nA succinct way of expressing the bilinear form is $$\\langle v , w \\rangle = \\sum_{\\ra{e} \\in \\E} v_{\\ra{e}} w_{\\la{e}}. $$ Not every $\\langle , \\rangle$-symmetric matrix in a Kre\\u{\\i}n space is diagonalisable (e.g., the matrix $\\left( \\begin{smallmatrix} I_{|E|} & I_{|E|} \\\\ 0 &I_{|E|} \\end{smallmatrix} \\right)$ is $J$-symmetric but not semi-simple). It is easy to construct examples of graphs for which $T$ is not semi-simple, if we temporarily drop our assumption that the graph has no end-vertices: \n\n\\begin{proposition} \\label{sinkjordan}\nIf $G$ is a connected graph with an end-vertex and $|E|>1$, then $T$ is not semi-simple; actually, zero is an eigenvalue of $T$ with a non-trivial Jordan block. \n\\end{proposition} \n\n\\begin{proof}\nIf $\\ra{e}$ is an oriented edge that ends in an end-vertex (so $T_{\\ra{e},\\ast}=0$ for all $\\ast \\in \\E$), then $\\ra{e} \\in \\ker T$, and if $\\ra{e_1}$ is an oriented edge with $t(\\ra{e_1}) = o(\\ra{e})$ (which exists by connectedness and since $|E|>1$), then $\\ra{e_1} \\in \\ker T^2 - \\ker T$. \n\\end{proof}\n\n\\begin{question} Give necessary and\/or sufficient criteria for a (multi-)graph $G$ to have a semi-simple edge-adjacency operator $T$. More specifically, \nis the presence of end-vertices the only obstruction to semi-simplicity?\n\\end{question} \n\n\\section{The $\\pm 1$-eigenspaces of the Bass-Hashimoto edge adjacency operator}\n\nIn the next two propositions, we show that $T$ has a ``large'' semi-simple quotient described in terms of the cycle space of $G$. \n\n\\begin{notation} Let $H_1(G,\\C)$ denote the space of (complex) linear combinations of cycles on $G$; it is a vector space of dimension $b_1$, the first Betti number of $G$, spanned by induced cycles (\\cite{Diestel}, 1.9.1). These cycles we write as formal sums $\\sum_{e \\in I} e$ over subsets $I \\subseteq E$ of the edge set.\n\\end{notation} \n\nWe have the following (see \\cite{Horton}, 5.6 or \\cite{CLM}, 1.9): \n\n\\begin{proposition} \\label{h} If $b_1>1$, the eigenspace $\\ker(1-T)$ for $T$ corresponding to the eigenvalue $1$ is isomorphic to the cycle space via\nthe map $$ \\varphi \\colon H_1(G,\\C) \\rightarrow \\ker(1-T) \\colon \\sum_{e \\in I} e \\mapsto \\sum_{e \\in I} (\\ra{e}-\\la{e}). $$ \n\\end{proposition}\n\nSince we will use concepts and notation from the (short) proof, we outline it here: \n\n\\begin{proof}\nSince $b_1>1$, the multiplicity of the eigenvalue $1$ in the characteristic polynomial of $T$ is equal to the first Betti number $b_1$ (\\cite{Bass}, II.5.10(b)(i) \\cite{Hashimoto}, 5.26). It follows that $\\ker(1-T)$ has dimension $ \\leq b_1$. Therefore, it suffices to prove that the map $\\varphi$ is well-defined and injective. \n\nTo show well-definedness of the linear map $\\varphi$, fix an induced cycle $c=e_1+\\dots +e_r$. Assume that we read the indices of the edges $e_i$ occuring in $c$ as indexed by integers modulo $r$. \n\\begin{figure}[h] \n\\begin{tikzpicture}\n \\draw node at (0,-0.5) {$c$}; \n \\draw node at (0,0.5) {$v$}; \n \\draw node at (-0.8,0.7) {$e_i$}; \n \\draw node at (0.9,0.7) {$e_{i+1}$}; \n \\draw node at (0,2.7) {$B_v$};\n \\draw [thick, decorate,decoration={brace, amplitude=8pt}] (-1,2.1) -- (1,2.1);\n \\draw[ultra thick] (0,1) -- (-0.7,1.7);\n \\draw[ultra thick] (0,1) -- (0.7,1.7);\n \\draw[ultra thick] (0,1) -- (0,2);\n \\draw[->,ultra thick,dashed] (-1,0) -- (-0.5,0.5); \\draw[ultra thick,dashed] (-0.5,0.5) -- (0,1);\n \\draw[->, ultra thick, dashed] (0,1) -- (0.5,0.5); \\draw[ultra thick,dashed] (0.5,0.5) -- (1,0);\n \\draw[ultra thick,dashed] (-1,-1) -- (-1,0);\n \\draw[ultra thick,dashed] (1,-1) -- (1,0);\n \\draw (-1,0) node[circle, inner sep = 0pt, minimum height=2mm, draw, fill = lightgray] {};\n \\draw (0,2) node[circle, inner sep = 0pt, minimum height=2mm, draw, fill] {};\n \\draw (-0.7,1.7) node[circle, inner sep = 0pt, minimum height=2mm, draw, fill] {};\n \\draw (0.7,1.7) node[circle, inner sep = 0pt, minimum height=2mm, draw, fill] {};\n \\draw (1,0) node[circle, inner sep = 0pt, minimum height=2mm, draw, fill = lightgray] {};\n \\draw (0,1) node[circle, inner sep = 0pt, minimum height=2mm, draw, fill] {};\n\\end{tikzpicture}\n \\caption{The ``bush'' of edges $B_v$ at the vertex $v$, w.r.t.\\ a cycle $c=\\dots + e_i+e_{i+1}+\\dots$}\n \\label{fig0}\n\\end{figure} \n\n\nFor a vertex $v \\in e_j$, let $$B_v = \\sum_{\\substack{o(\\ra{e})=v \\\\ e \\notin c}} \\ra{e}$$ denote the ``bush'' of edges outside the cycle $c$ emanating from the origin of $\\ra{e}$ (see Figure \\ref{fig0}). Note that if $e \\in c$, then $B_{t(e_i)} =B_{o(e_{i+1})}$. \n\n\nNow \n\\begin{align*} T \\left(\\sum (\\ra{e_i}-\\la{e_i})\\right) & = \\sum \\left(\\ra{e}_{i+1} + B_{t(e_i)} - \\la{e}_{i-1} - B_{o(e_i)}\\right) = \\sum (\\ra{e_i}-\\la{e_i}), \\end{align*}\nso indeed, $\\varphi(c) \\in \\ker(1-T)$. \nFinally, the injectivity of $\\varphi$ follows immediately from the linear independence of the elements $\\ra{e},\\la{e}$ (for $e \\in E$) in the space $\\C^{2|E|}$ on which the operator $T$ acts: if $$\\sum_{e \\in E} a_{\\ra{e}} \\ra{e} - \\sum_{e \\in E} a'_{\\la{e}} \\la{e} = 0,$$ for some $a_{\\ast} \\in \\C$, then $\\sum a_{\\ra{e}} e = 0$, so only the zero cycle is mapped to zero. \n\\end{proof} \n\n\\begin{remark} If $b_1=1$, the map $\\varphi$ is not an isomorphism, but can still be described in terms of edges (\\cite{CLM}, 1.14). Since we assume $\\bar d \\geq 4$, we have $b_1 =|E|-|V|+1 \\geq |V|+1>1$. \\end{remark}\n\nNext we consider the eigenspace of eigenvalue $-1$.\n \n\\begin{notation} The integer $p$ is defined by $p=0$ if $G$ is bipartite and $p=1$ otherwise. Let $H_1^+(G,\\C)$ denote the subspace of $H_1(G,\\C)$ generated by cycles of \\emph{even} length. \n\\end{notation} \nWe have $$H_1(G,\\C) = H^+_1(G,\\C) \\oplus \\C^p.$$ Indeed, a graph is bipartite if and only if all cycles are even (\\cite{Diestel}, 1.6.1), and if the graph is not bipartite, let $c_1,\\dots,c_r,c_{r+1},\\dots c_{b_1}$ denote a basis for its cycle space based at a common vertex $v_0$, in which the first $r$ cycles are even and the remaining are odd. Then $$c_1,\\dots,c_r,c_r+c_{b_1},\\dots,c_{b_1-1}+c_{b_1},c_{b_1}$$ is a basis in which the first $b_1-1$ cycles are even and the final one is not. \n\n\\begin{proposition} \\label{hplus} For every even cycle $c=\\sum_{e \\in I} e$, choose a proper 2-coloring $\\kappa_c \\colon I \\rightarrow \\{\\pm 1\\}$ of the edges of $c$. Then the map $$ \\psi \\colon H_1^+(G,\\C) \\rightarrow \\ker(1+T) \\colon c=\\sum_{e \\in I} e \\mapsto \\sum_{e \\in I} \\kappa_c(e) (\\ra{e}+\\la{e}) $$ is an isomorphism of complex vector spaces.\n\\end{proposition}\n\n\\begin{proof}\n\nThe multiplicity of the eigenvalue $-1$ in the characteristic polynomial of $T$ is $b_1-p$ (\\cite{Bass}, II.5.10(b)(ii), \\cite{Hashimoto}, 5.32). It suffices to prove that the map $\\psi$ is well-defined and injective. For well-definedness, fix an induced even cycle $c=e_1+\\dots +e_r$ as before. Without loss of generality, we can assume $\\kappa_c(e_j) = (-1)^j$. Then, using the notation for ``bushes'' from the proof of Proposition \\ref{h}, we find\n\\begin{align*} T & \\left(\\sum_{2 \\mid i}(\\ra{e_i}+\\la{e_i}) - \\sum_{2 \\nmid i}(\\ra{e_i}+\\la{e_i}) \\right) \\\\ & = \\sum_{2 \\mid i} (\\ra{e}_{i+1} + B_{t(e_i)} + \\la{e}_{i-1} + B_{o(e_i)}) - \\sum_{2 \\nmid i} (\\ra{e}_{i+1} + B_{t(e_i)} + \\la{e}_{i-1} + B_{o(e_i)}) \\\\ & = \\sum_{2 \\mid i} (\\ra{e}_{i+1} + \\la{e}_{i-1} ) - \\sum_{2 \\nmid i} (\\ra{e}_{i+1} + \\la{e}_{i-1}) \\\\ & = \\sum_{2 \\nmid j} (\\ra{e}_{j} + \\la{e}_{j-2} ) - \\sum_{2 \\mid j} (\\ra{e}_{j} + \\la{e}_{j-2}) \\\\ & = - \\left(\\sum_{2 \\mid i}(\\ra{e_i}+\\la{e_i}) - \\sum_{2 \\nmid i}(\\ra{e_i}+\\la{e_i}) \\right), \\end{align*}\nso $\\psi$ is well-defined. The injectivity of $\\psi$ follows again from the linear independence of the elements $\\ra{e},\\la{e}$ (for $e \\in E$). \n\\end{proof}\n\n\\begin{corollary} \\label{mul} The eigenvalues $\\pm 1$ are semi-simple for the operator $T$, of respective multiplicities $|E|-|V|+1$ and $|E|-|V|+1-p$. \\qed\n\\end{corollary}\n\nThere are examples (such as the complete 4-graph with one edge deleted \\cite{Terras}, Example 2.8) in which all other eigenvalues of $T$, apart from $\\pm 1$, are simple (and semi-simple). This shows that one cannot expect a more general statement than \\ref{mul} concerning multiplicities of eigenvalues of $T$. \n\n\\section{Reconstruction of closed non-backtracking walks} \\label{walks}\n\nFor a positive integer $r$, the entry of $T^r$ at place $\\ra{e_1}, \\ra{e_2}$ is the number of non-backtracking walks that start in the direction of the oriented edge $\\ra{e_1}$ and end at the oriented edge $\\ra{e_2}$. Let $$N_r(\\ra{e})=T^r_{\\ra{e},\\ra{e}}$$ denote the number of closed such walks through an oriented edge $\\ra{e} \\in \\mathbf{E}$. Observe that by symmetry (``walking backwards''), $N_r(\\ra{e})=N_r(\\la{e})$. \nFor an unoriented edge $e \\in E$, $N_r(e)=2N_r(\\ra{e})$ (for any choice $\\ra{e}$ of orientation on $e$), denotes the number of (oriented) non-backtracking closed walks that pass through $e$. The total number of non-backtracking (unoriented) closed walks of length $r$ in $G$ is $$N_r = \\sum_{e \\in E} N_r(e) = \\mathrm{tr}(T^r)=\\sum_{\\ra{e} \\in \\mathbf{E}} T^r_{\\ra{e},\\ra{e}}, $$ where $\\mathrm{tr}$ denotes the trace of a matrix. \n\n\\begin{theorem}[Theorem \\ref{main}\\textup{(ii)}] Let $G$ denote a graph of average degree $\\bar d \\geq 4$; then the number of non-backtracking closed walks on $G$ of given length is edge-reconstructible. \n\\end{theorem} \n\n\\begin{proof}The claim follows directly from the formal power series identity \n\\begin{equation} \\label{logdet} \\log \\zeta_G = - \\log \\det(1-uT) = \\sum_{n \\geq 1} \\frac{\\mathrm{tr}(T^n)}{n} u^n \\end{equation} and part (i) of the theorem. \n\\end{proof}\n\nWe now refine this result, in analogy with the vertex situation studied by Godsil and McKay in \\cite{Godsil} (but our proofs are rather different, since we do not have a semi-simple operator and we cannot rely on reconstruction results for complementary graphs). \n\n\\begin{remark} \\label{mn} We define the value of $N_r$ (and other similar functions) at an element $H=G-e \\in \\mathcal D^e(G)$ of the edge deck to be equal to $N_r(e)$. Since $\\mathcal D^e(G)$ is a multiset, it is possible that $G-e \\cong G-e'$ for two different edges $e$ and $e'$. Our methods of proof imply that the value $N_r(e)$ only depends on the isomorphism type of $H$, not on the edge $e$, and thus, $N_r$ is well-defined on the edge deck. \n\\end{remark} \n\n\\begin{theorem}[Theorem \\ref{main}\\textup{(iii)(a)}] Let $G$ denote a graph of average degree $\\bar d>4$. Then the function $N_r \\colon \\mathcal{D}^e(G) \\rightarrow \\Z$ that associates to an element $G-e$ of the edge deck $\\mathcal{D}^e(G)$ of $G$ the number of non-backtracking closed walks on $G$ of given length passing through $e$ is edge-reconstructible.\n\\end{theorem}\n\n\\begin{proof}\nAs a first step, we use the Jordan normal form of $T$ to prove the following: \n\n\\begin{lemma} \\label{J} The values $N_r(e)$ for all $r \\in \\Z_{\\geq 0}$ are uniquely determined by the values $N_r(e)$ for $r \\leq M-1$, where $M$ is the sum of the maximal sizes of Jordan blocks for the different eigenvalues of $T$.\n\\end{lemma} \n\n\\begin{proof}[Proof of Lemma \\ref{J}] Suppose that $T$ has $N$ distinct eigenvalues $\\lambda_1,\\dots,\\lambda_N$. Let $m_i$ denote the multiplicity of $\\lambda_i$. Suppose that $\\lambda_i$ occurs in $\\ell_i$ different Jordan blocks, and let $\\mu_{i,j}$ denote the size of the $j$-th such block ($j=1,\\dots,\\ell_i$), so that $m_i = \\sum_j \\mu_{i,j}$. Let $P$ denote the matrix whose columns are a complete set of generalized eigenvectors for $T$, then $T=P\\Lambda P^{-1}$, where $\\Lambda$ is a Jordan normal form of $T$. Fix an (oriented) edge $\\ra{e}$. All vectors will depend on $\\ra{e}$, but, for readability, we will mostly suppress it from the notation. \nIf $x_{\\ra{e}}$ is the $2|E|$-column vector with a $1$ in place $\\ra{e}$ and $0$ elsewhere, then \n\\begin{equation} \\label{nre} N_r(\\ra{e}) = x_{\\ra{e}}^{\\intercal} T^r x_{\\ra{e}} = v \\Lambda^r v', \\end{equation}\nwhere $v=x_{\\ra{e}}^{\\intercal} P$ and $v'= P^{-1} x_{\\ra{e}}$. \n\nWorking out the powers of the Jordan normal form, we find that \n\\begin{equation} \\label{fff} N_r(\\ra{e}) = \\sum_{i=1}^N \\sum_{j=1}^{\\ell_i} \\sum_{k=0}^{\\mu_{i,j}-1} \\lambda_i^{r-k} \\binom{r}{k} w_{i,j,k} \\end{equation}\nfor some constants \n$$ w_{i,j,k} = \\sum_{l=a_{i,j}}^{a_{i,j}+\\mu_{i,j}-k} v_l v'_{l+k}, \\mbox{ with } a_{i,j}:=\\sum_{\\substack{i_0 \\leq i \\\\ j_04$, $M-1 <|E|$. Indeed, recall from Corollary \\ref{mul} that $T$ has semi-simple eigenvalue $\\lambda_1 = +1$ with multiplicity $|E|-|V|+1$ and semi-simple eigenvalue $\\lambda_2 = -1$ with multiplicity at least $|E|-|V|$. Hence $M_1=M_2=1$ and the number $M$ satisfies \\begin{equation} \\label{bip} M-1 \\leq 2+2|E|-(|E|-|V|)-(|E|-|V|+1)-1 = 2|V|.\\end{equation} Since we assume $\\bar d = 2|E|\/|V|> 4$, we have $M-1 < |E|$. \n \nFinally, we show how to reconstruct $N_r(e)$ for $r < |E|$. Suppose that $\\mathcal{G}_{i}$ is the set of isomorphism classes of graphs with $i$ edges. Given a graph $H$, let $P_r(H)$ denote the number of distinct closed non-backtracking walks of length $r$ on $H$ that go through every edge of $H$ (possibly multiple times, with no preferred starting edge). Let $S(H,G)$ denote the number of subgraphs of $G$ isomorphic to $H$. For $r<|E|$, we have\n$$ N_r(\\ra{e}) = \\frac{1}{2} \\sum_{\\substack{H \\in \\mathcal{G}_{i} \\\\ i \\leq r}} P_r(H)(S(H,G)-S(H,G-e)). $$\nIndeed, $S(H,G)-S(H,G-e)$ is the number of subgraphs of $G$ isomorphic to $H$ that pass through $e$. Any closed non-backtracking walk of length $r$ on $H$, embedded in $G$ to pass through $e$, gives rise to such a walk that starts and ends at $e$ in a given direction (for both chosen directions). \n\nBy the edge version of Kelly's Lemma (\\cite{Bondy} 6.6; the multi-graph version is in \\cite{McDonald}, Cor.\\ 1), since $H$ has less than $|E|$ edges, the right hand side is reconstructible, hence so is the left hand side.\n\nThis finishes the proof of the theorem that $N_r(\\ra{e})$ is edge-reconstructible for all $r$. \n\\end{proof}\n\n\\begin{proposition} \\label{BP} If $G$ is bipartite of average degree $\\bar d \\geq 4$, the function $N_r$ is edge-reconstructible for all $r>0$. \n\\end{proposition}\n\n\\begin{proof}\nIf $G$ is bipartite, then the eigenvalue $-1$ also has multiplicity $|E|-|V|+1$ (cf.\\ Corollary \\ref{mul}), so the estimate $M-1<|E|$ in Equation (\\ref{bip}) holds even if $\\bar d = 4$. \n\\end{proof}\n\n We now give another proof of part (i) of Theorem \\ref{main} along the lines of the previous proof, which has a more combinatorial flavour and avoids using Lemma \\ref{pol} (but does not lead directly to the inductive formula from Theorem \\ref{tfirst}). \n\n\\begin{proof}[Second proof of Theorem \\ref{main}(i)] \nThe result of Bass (\\cite{Bass}, II.5.4) says that we can write $$\\det(1-Tu) = (u-1)^{|E|-|V|+1}(u+1)^{|E|-|V|}D^+(u)$$ for some polynomial $D^+(u)$ of degree $2|V|-1$ with $D^+(0) \\neq 0$. Plugging this into the generating series (\\ref{logdet}) and take logs, we find\n$$ (|E|-|V|+1) \\sum_{j \\geq 1} \\frac{u^{j}}{j} +(|E|-|V|) \\sum_{j \\geq 1} \\frac{(-u)^{j}}{j} - \\log D^+(u) = \\sum_{r \\geq 1} N_r \\frac{u^r}{r}. $$\nIt follows that we know the entire polynomial $\\det(1-Tu)$ as soon as we know $D^+(u)$, which happens as soon as we know $N_r$ for all $r \\leq 2|V|-1$. With $\\bar d = 2|E|\/|V| \\geq 4$, we need to reconstruct $N_r$ for $r <|E|$. But this can be done using Kelly's Lemma, as follows:\n$$N_r = \\sum_{\\substack{H \\in \\mathcal{G}_{i} \\\\ i \\leq r}} P_r(H) S(H,G), $$\nwhere $\\mathcal{G}_i, P_r$ and $S(H,G)$ are as in the above proof of Theorem \\ref{main}\\textup{(iii)}. \n\\end{proof} \n\nFor $e \\in E$, let $F_r(e)$ denote the number of closed non-backtracking walks that pass through $e$ in both directions at least once. Then $F_r(e) = 2 F_r(\\ra{e})$, where for an oriented edge $\\ra{e} \\in \\mathbf{E}$, $F_r(\\ra{e})$ is the number of closed non-backtracking walks that start at $\\ra{e}$ and pass through $\\la{e}$ at least once. \n\n\\begin{theorem}[Theorem \\ref{main}\\textup{(v)}] Let $G$ denote a graph of average degree $\\bar d>4$. Then the function $F_r \\colon \\mathcal{D}^e(G) \\rightarrow \\Z$ that associates to an element $G-e$ of the edge deck $\\mathcal{D}^e(G)$ of $G$ the number of non-backtracking closed walks on $G$ of given length that pass through $e$ in both directions at least once is edge-reconstructible. \n\\end{theorem}\n\n\\begin{proof}\nFirst, observe that \\begin{equation} \\label{f} F_r(\\ra{e}) = \\sum_{i=0}^r (T^i)_{\\ra{e},\\la{e}} (T^{r-i})_{\\la{e},\\ra{e}}. \\end{equation}\nThe edge adjacency matrix $T_{G-e}$ of $G-e$ is the matrix $T$ in which the rows and column corresponding to the edges $\\ra{e}$ and $\\la{e}$ have been removed. Let $T[e_1,e_2]$ denote the $2\\times 2$ matrix in which only the elements in column\/row $e_1$ and $e_2$ are preserved. In this situation, Jacobi's identity (generalising from $1\\times 1$ minors to $2\\times 2$ minors the more familiar formula for an inverse matrix in terms of determinant and adjugate; see e.g., \\cite{BS}) states that \n\\begin{equation*} \\label{quot} \\zeta_G(u)\/\\zeta_{G-e}(u) = \\det((1-uT)^{-1}[\\ra{e},\\la{e}]). \\end{equation*}\nThe left hand side of this equation is reconstructible by part (i). Since $$(1-uT)^{-1} = \\sum_{r \\geq 0} u^r T^r,$$ we find that the right hand side equals\n\\begin{align*} \\det ((1-uT)^{-1}[\\ra{e},\\la{e}])&= \\det \\left( \\begin{matrix} \\sum u^r N_r(\\ra{e}) & \\sum u^r (T^r)_{\\ra{e},\\la{e}} \\\\ \\sum u^r (T^r)_{\\la{e},\\ra{e}} & \\sum u^r N_r(\\ra{e}) \\end{matrix} \\right) \\\\\n& = \\sum_{r \\geq 0} u^r \\left( \\sum_{i=0}^r N_i(\\ra{e})N_{r-i}(\\ra{e}) - F_r(\\ra{e}) \\right), \\end{align*} using the expression for $F_r(\\ra{e})$ from (\\ref{f}). Since $N_r(\\ra{e})$ is edge-reconstructible, we conclude that\nthe function $F_r(\\ra{e})$, and hence $F_r(e)$, is edge-reconstructible. \n\\end{proof} \n\nSimilar to Proposition \\ref{BP}, we get\n\\begin{proposition} If $G$ is bipartite of average degree $\\bar d \\geq 4$, the function $F_r$ is edge-reconstructible for all $r>0$. \\qed\n\\end{proposition}\n\n\n\n\\section{Reconstruction of non-closed non-backtracking walks } \n\nWe now consider the case of not-necessarily closed non-backtracking walks: \n\n\\begin{theorem}[Theorem \\ref{main}\\textup{(iii)(b)}] Let $G$ denote a graph of average degree $\\bar d>4$. Then the function $M_r \\colon \\mathcal{D}^e(G) \\rightarrow \\Z$ that associates to an element $G-e$ of the edge deck $\\mathcal{D}^e(G)$ of $G$ the number of non-backtracking (not necessarily closed) \nwalks on $G$ of given length starting at $e$ (in any direction) is edge-reconstructible.\n\\end{theorem}\n\n\\begin{proof}\nLet $M_r(\\ra{e})$ denote the number of non-backtracking walks of length $r$ that start in the direction of $\\ra{e}$ (but do not necessarily return to $\\ra{e}$). Then, similarly to the expression derived for $N_r(\\ra{e})$ in the previous proof, we find \n\n\n$$ M_r(\\ra{e}) = x_{\\ra{e}}^{\\intercal} T^r \\mathbf{1} = \\sum_{i=1}^N \\sum_{k=0}^{M_i-1} \\lambda_i^{r-k} \\binom{r}{k} y'_{i,k}, $$\nwhere $\\mathbf{1}$ is the $2|E|$-column vector consisting of all $1$'s and $y'_{i,k}$ is an expression similar to $y_{i,k}$ in the previous proof, but with the role of $v'$ taken by $\\mathbf{1}$. \nNow $$M_r(e) = M_r(\\ra{e})+M_r(\\la{e}) = \\sum_{i=1}^N \\sum_{k=0}^{M_i-1} \\lambda_i^{r-k} \\binom{r}{k} (y'_{\\ra{e},i,k}+y'_{\\la{e},i,k}),$$ (where we have indicated the dependence of $y'_{i,k}$ on the oriented edge $\\ra{e}$ in the subscript) is the number of non-backtracking walks of length $r$ that start at $e$ in any direction. The same reasoning as in the previous proof shows that is suffices to reconstruct $M_r(e)$ for $r < |E|$; namely, we find a matrix equation \n$$\\mathbb V Y' = \\mathbf{M}, $$\n where $Y'$ is a column vector consisting of $y'_{\\ra{e},i,k}+y'_{\\la{e},i,k}$, $\\mathbf{M}$ is a column vector with entries $M_i(e)$ for $i=0,\\dots,M-1$, and $\\mathbb V$ is the same (invertible) matrix as in the previous proof. This shows that $Y'$, and hence $M_r(e)$ for all $r$, is determined by $M_r(e)$ for $r \\leq M-1 < |E|$. \n\nLet $W_r(e)$ denote the total number of walks through the edge $e$. This number is reconstructible by Kelly's Lemma for $r<|E|$, since \n$$ W_r(e) = \\sum_{\\substack{H \\in \\mathcal{G}_{i} \\\\ i \\leq r}} Q_r(H)(S(H,G)-S(H,G-e)), $$\nwhere $Q_r(H)$ is the number of (not necessarily closed) walks of length $r$ that pass through every edge of $H$. \n\nLet $O_r(\\ra{e})$ denote the number of walks of length $r$ starting at $\\ra{e}$ that never return to $\\ra{e}$ (but might go though $\\la{e}$), and let $O_r(e)=O_r(\\ra{e})+O_r(\\la{e})$ denote the number of walks starting in $e$ but never return to $e$ in the same direction. We call these non-returning walks. We then have the following relations (similar to the ones for vertex walks discussed in \\cite{Godsil}, Formula (1)): \n\n\\begin{enumerate}\n\\item Every walk of length $r$ through $e$ decomposes as a non-returning walk of length $i$ into $e$, then a closed walk of length $j$ through $e$, followed by a non-returning walk of length $k$ starting at $e$, for $r+2=i+j+k$ (see Figure \\ref{ijk}). Hence \n\\begin{equation} \\label{w1} W_r(e) = \\sum_{i+j+k=r+2} O_j(e) N_j(e) O_k(e). \\end{equation}\n\\begin{figure}[h] \n\\begin{tikzpicture}\n \\draw node at (0,-0.2) {$e$}; \n \\draw node at (-0.7,-0.8) {length $i$}; \n \\draw node at (0.7,-1.6) {length $k$}; \n \\draw node at (0,1) {closed walk of length $j$}; \n \n \\draw[ultra thick,dashed] (-2,0) -- (-0.5,0);\n \\draw[ultra thick,dashed] (0.5,0) -- (2,0);\n \\draw[ultra thick] (-0.5,0)--(0.5,0);\n \n \\draw (-2,0) node[circle, inner sep = 0pt, minimum height=2mm, draw, fill] {};\n \\draw (-0.5,0) node[circle, inner sep = 0pt, minimum height=2mm, draw, fill] {};\n \\draw (0.5,0) node[circle, inner sep = 0pt, minimum height=2mm, draw, fill] {};\n \\draw (2,0) node[circle, inner sep = 0pt, minimum height=2mm, draw, fill] {};\n \n \\draw[ultra thick,dashed] (0.5,0) arc (0:180:0.5cm);\n\n\\draw [thick, decorate,decoration={brace, mirror, amplitude=6pt}] (-2,-0.3) -- (0.5,-0.3);\n\\draw [thick, decorate,decoration={brace, mirror, amplitude=6pt}] (-0.5,-1) -- (2,-1);\n\\draw [thick, decorate,decoration={brace, amplitude = 6pt}] (-0.5,0.5) -- (0.5,0.5);\n\n\n\\end{tikzpicture}\n \\caption{Decomposition of a walk through $e$ of total length $i+j+k-2$}\n \\label{ijk}\n\\end{figure} \n\\item Every walk of length $r$ starting at $e$ decomposes as a closed walk of length $i$ followed by a non-returning walk of length $j$, where $i+j=r+1$. \nHence \n\\begin{equation} \\label{w2} M_r(e) = \\sum_{i+j=r+1} N_i(e) O_j(e). \\end{equation}\n\\end{enumerate}\n If we write these relations (\\ref{w1}) and (\\ref{w2}) in the generating series $W(x) = \\sum W_r(e) x^r$, etc., they become \n$$ \\left\\{ \\begin{array}{l} W(x) = x^2 N(x) O(x)^2 \\\\ M(x) = x N(x) O(x), \\end{array} \\right. $$\n from which we can eliminate $O(x)$, to find \n $ M(x) = \\sqrt{ W(x) N(x) },$ i.e., for all $r \\geq 0$: \n $$ \\sum_{i+j=r} M_i(e) M_j(e) = \\sum_{i+j=r} W_i(e) N_j(e). $$\n Since we have already reconstructed $N_j(e)$ for all $j$ and $W_i(e)$ for all $i<|E|$, we can use this formula to reconstruct recursively the values $M_r(e)$ for all $r<|E|$. This suffices to reconstruct $M_r(e)$ for all integers $r$. \\end{proof} \n \n Similar to Proposition \\ref{BP}, we get\n\\begin{proposition} If $G$ is bipartite of average degree $\\bar d \\geq 4$, the function $M_r$ is edge-reconstructible for all $r>0$. \\qed\n\\end{proposition}\n\n \n \\section{Reconstruction of the Perron-Frobenius eigenvector of $T$}\n\\begin{notation} Let $\\mathbf{p}$ denote the normalized Perron-Frobenius eigenvector, corresponding to the (simple) Perron-Frobenius eigenvalue $\\lambda_{\\PF}$ of $T$, normalized by $$\\langle \\mathbf{p}, \\mathbf{p} \\rangle = \\mathbf{p}^{\\intercal} J \\mathbf{p} = 1$$ as in Equation (\\ref{norm}) below. \n\\end{notation}\n\n\\begin{theorem}[Theorem \\ref{main}\\textup{(iv)}] \\label{recp} Let $G$ denote a graph of average degree $\\bar d>4$. Then for any symmetric polynomial $f$ of two variables, \nthe function $\\mathcal{D}^e(G) \\rightarrow \\R \\colon G-e \\mapsto f(\\mathbf{p}_{\\ra{e}},\\mathbf{p}_{\\la{e}})$ is edge-reconstructible.\n In particular, the unordered pairs $\\{\\mathbf{p}_{\\ra{e}},\\mathbf{p}_{\\la{e}}\\}$ are edge-reconstructible. \n\\end{theorem}\n\n\\begin{proof} If suffices to prove this for $f$ equal to one of the elementary symmetric functions $$\\sigma_e := \\mathbf{p}_{\\ra{e}} + \\mathbf{p}_{\\la{e}} \\mbox{ and } \\pi_e:=\\mathbf{p}_{\\ra{e}}\\cdot \\mathbf{p}_{\\la{e}}.$$ \n\nThe result follows from Perron-Frobenius theory for non-negative matrices (see, e.g., section 8.3 in \\cite{Meyer}), as follows. Formula (\\ref{Tss}) implies an equivalence between left and right eigenvectors for $T$, as follows: $$Tv=\\lambda v \\iff v^{\\intercal} J T = \\lambda v^{\\intercal} J.$$ Therefore, the Ces\\`aro averages of $T$ give $$ \\lim_{k \\rightarrow +\\infty} \\frac{1}{k} \\sum_{r=0}^k \\frac{T^r}{\\lambda_{\\PF}^r} = \\mathbf{p} \\mathbf{p}^{\\intercal}J, $$\nwhere $\\mathbf{p}$ is the Perron-Frobenius eigenvector of $T$, normalized by $\\langle \\mathbf{p}, \\mathbf{p} \\rangle = \\mathbf{p}^{\\intercal} J \\mathbf{p} = 1$, i.e., \n\\begin{equation} \\label{norm} 2 \\sum_{e \\in E} \\mathbf{p}_{\\ra{e}} \\mathbf{p}_{\\la{e}} = 1. \\end{equation}\nIt follows that \n\\begin{equation} \\label{PFfs} \\lim_{k \\rightarrow +\\infty} \\frac{1}{2k} \\sum_{r=0}^k \\frac{N_r(e)}{\\lambda_{\\PF}^r} = \\lim_{k \\rightarrow +\\infty} \\frac{1}{k} \\sum_{r=0}^k \\frac{x_{\\ra{e}}^{\\intercal} T^r x_{\\ra{e}}}{\\lambda_{\\PF}^r} = \\mathbf{p}_{\\ra{e}} \\mathbf{p}_{\\la{e}}=\\pi_e. \n\\end{equation}\nSimilarly, we have \n\\begin{align} \\label{mff} \\lim_{k \\rightarrow +\\infty} \\frac{1}{k} \\sum_{r=0}^k \\frac{M_r(e)}{\\lambda_{\\PF}^r} \n& = \\lim_{k \\rightarrow +\\infty} \\frac{1}{k} \\sum_{r=0}^k \\frac{ x_{\\ra{e}}^{\\intercal} T^r \\mathbf{1}+x_{\\la{e}}^{\\intercal} T^r \\mathbf{1} }{\\lambda_{\\PF}^r} \\\\ & = (\\mathbf{p}_{\\ra{e}}+\\mathbf{p}_{\\la{e}}) \\sum_{e' \\in E} (\\mathbf{p}_{\\ra{e'}}+\\mathbf{p}_{\\la{e'}}) =: \\tilde\\sigma_e, \\nonumber \\end{align}\nwith $$ \\tilde \\sigma_e = \\alpha \\sigma_e \\mbox{ for } \\alpha = \\sum_{e' \\in E} \\sigma_{e'}. $$ \nHence the numbers $\\tilde \\sigma_{{e}}$ and $\\pi_e$ can be reconstructed from $\\mathcal{D}^e(G)$, since the left hand side of the above formulas (\\ref{PFfs}) and (\\ref{mff}) can. Since the entries of the Perron-Frobenius eigenvector are all non-negative, we find that $\\alpha$\nis positive. Adding up all terms in (\\ref{mff}), we find that \n$$ \\sum_{e \\in E} \\tilde \\sigma_e= \\alpha^2,$$\nhence $\\alpha \\geq 0$ is determined, and so also $\\sigma_e=\\tilde \\sigma_e\/\\alpha$ is edge-reconstructible. The final statement follows since the elements of the unordered pair $\\{\\mathbf{p}_{\\ra{e}},\\mathbf{p}_{\\la{e}}\\}$ are the roots of $x^2-\\sigma_e x + \\pi_e = 0$. \n\\end{proof} \n\nSimilar to Proposition \\ref{BP}, we get\n\\begin{proposition} If $G$ is bipartite of average degree $\\bar d \\geq 4$, the unordered pairs $\\{\\mathbf{p}_{\\ra{e}}, \\mathbf{p}_{\\la{e}} \\}$ are edge-reconstructible for all $r>0$. \\qed\n\\end{proposition}\n\n\n\\bibliographystyle{amsplain}\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section{Introduction}\\label{sec:Intro}\n\nMusic transcription is one of the most fundamental and challenging problems in music information processing \\cite{Klapuri2006,Benetos2013}.\nThis problem, which involves conversion of audio signals into symbolic musical scores, can be divided into two subproblems, pitch analysis and rhythm transcription, which are often studied separately.\nPitch analysis aims to convert the audio signals into the form of a piano roll, which can be represented as a MIDI signal, and multi-pitch analysis methods for polyphonic music have been extensively studied \\cite{Vincent2010,OHanlon2014,Yoshii2015,Sigtia2016}.\nRhythm transcription, on the other hand, aims to convert a MIDI signal into a musical score by locating note onsets and offsets in musical time ({\\it score time}) \\cite{LonguetHiggins1987,Desain1989,Raphael2002,Takeda2002,Hamanaka2003,Cemgil2003,Kapanci2005,Temperley2009,Tsuchiya2013,Nakamura2017}.\nIn order to track time-varying tempo, beat tracking is employed to locate beat positions in music audio signals \\cite{Dixon2000,Dixon2001,Peeters2011,Krebs2015,Durand2015}.\n\nAlthough most studies on rhythm transcription and beat tracking have focused on estimating onset score times, to obtain complete musical scores it is necessary to locate note offsets, or equivalently, identify {\\it note values} defined as the difference between onset and offset score times.\nThe configuration of note values is especially important to describe the acoustic and interpretative nature of polyphonic music where there are multiple voices and the overlapping of notes produces different harmonies.\nNote value recognition has been addressed only in a few studies \\cite{Takeda2002,Temperley2009} and the results of this study reveal that it is a non-trivial problem.\n\nThe difficulty of the problem arises from the fact that observed note durations in performances deviate largely from the score-indicated lengths so that the use of a prior (language) model for musical scores is crucial.\nBecause of its structure with overlapping multiple streams (voices), construction of a language model for polyphonic music is challenging and gathers increasing attention recently \\cite{Temperley2009,Kameoka2012,Raczynski2013,Sigtia2016,Nakamura2017}.\nIn particular, building a model at the symbolic level of musical notes (as opposed to the frame level of audio processing) that properly describes the multiple-voice structure while retaining computational tractability is a remaining problem.\n\n\\begin{figure}[t]\n\\begin{center}\n\\includegraphics[clip,width=0.9\\columnwidth]{fig_Overview.pdf}\n\\end{center}\n\\vspace{-2mm}\n\\caption{An outcome obtained by our method (Mozart: Piano Sonata K576). While previous rhythm transcription methods could only estimate onset score times accurately from MIDI performances, our method can also estimate offset score times, providing a complete representation of polyphonic musical scores.}\n\\label{fig:Overview}\n\\vspace{-3mm}\n\\end{figure}\nThe purpose of this paper is to investigate the problem of note value recognition using a statistical approach (Fig.~\\ref{fig:Overview}).\nWe formulate the problem as a post-processing step of estimating offset score times given onset score times obtained by rhythm transcription methods for note onsets.\nFirstly, we present results of statistical analyses and point out that the information of onset score times and the pitch context together with interdependence between note values provide clues for model construction.\nSecondly, we propose a Markov random field model that integrates a prior model for musical scores and a performance model that relates note values and actual durations (Sec.~\\ref{sec:Method}).\nTo determine an optimal set of contexts\/features for the score model from data, we develop a statistical learning method based on context-tree clustering \\cite{ContextTreeClustering,Takaki2014,Shinoda2000}, which is an adaptation of statistical decision tree analysis.\nFinally, results of systematic evaluations of the proposed method and baseline methods are presented (Sec.~\\ref{sec:Evaluation}).\n\nThe contributions of this study are as follows.\nWe formulate a statistical learning method to construct a highly predictive prior model for note values and quantitatively demonstrate its importance for the first time.\nThe discussions cover simple methods and more sophisticated machine learning techniques and the evaluation results can serve as a reference for the state-of-the-art.\nOur problem is formulated in a general setting following previous studies on rhythm transcription and the method is applicable to a wide range of existing methods of onset rhythm transcription.\nResults of statistical analyses and learning in Secs.~\\ref{sec:Observation} and \\ref{sec:Method} can also serve as a useful guide for research using other approaches such as rule-based methods and neural networks.\nLastly, source code of our algorithms and evaluation tools is available from the accompanying web page \\cite{Webpage} to facilitate future comparisons and applications.\n\n\\section{Related Work}\\label{sec:RelatedWork}\n\nBefore beginning the main discussion, let us review previous studies related to this paper.\n\nThere have been many studies on converting MIDI performance signals into a form of musical score.\nOlder studies \\cite{LonguetHiggins1987,Desain1989} used rule-based methods and networks in attempts to model the process of human perception of musical rhythm.\nSince around 2000, various statistical models have been proposed to combine the statistical nature of note sequences in musical scores and that of temporal fluctuations in music performance.\nThe most popular approach is to use hidden Markov models (HMMs) \\cite{Raphael2002,Takeda2002,Hamanaka2003,Cemgil2003,Nakamura2017}.\nThe score is described either as a Markov process on beat positions (metrical Markov model) \\cite{Raphael2002,Hamanaka2003,Cemgil2003} or a Markov model of notes (note Markov model) \\cite{Takeda2002}, and the performance model is often constructed as a state-space model with latent variables describing locally defined tempos.\nRecently a merged-output HMM incorporating the multiple-voice structure has been proposed \\cite{Nakamura2017}.\nTemperley \\cite{Temperley2009} proposed a score model similar to the metrical Markov model in which the hierarchical metrical structure is explicitly described.\nThere are also studies that investigated probabilistic context-free grammar models \\cite{Tsuchiya2013}.\n\nA recent study \\cite{Nakamura2017} reported results of systematic evaluation of (onset) rhythm transcription methods.\nTwo data sets, polyrhythmic data and non-polyrhythmic data, were used and it was shown that HMM-based methods generally performed better than others and the merged-output HMM was most effective for polyrhythmic data.\nIn addition to the accuracy of recognising onset beat positions, the metrical HMM has the advantage of being able to estimate metrical structure, i.e.\\ the metre (duple or triple) and bar (or down beat) positions, and to avoid grammatically incorrect score representations that appeared in other HMMs.\n\nAs mentioned above, there have been only a few studies that discussed the recognition of note values in addition to onset score times.\nTakeda et al.\\ \\cite{Takeda2002} applied a similar method of estimating onset score times to estimating note values of monophonic performances and reported that the recognition accuracy dropped from 97.3\\% to 59.7\\% if rests are included.\nTemperley's Melisma Analyzer \\cite{Temperley2009}, based on a statistical model, outputs estimated onset and offset beat positions together with voice information for polyphonic music.\nThere, offset score times are chosen from one of the following tactus beats according to some probabilities, or chosen as the onset position of the next note of the same voice.\nThe recognition accuracy of note values has not been reported.\n\n\\section{Preliminary Observations and Analyses}\\label{sec:Observation}\n\nWe explain here basic facts about the structure of polyphonic piano scores and discuss how it is important and non-trivial to recognise note values for such music based on observations and statistical analyses.\nThis provides motivations for the architecture of our model.\nSome terminology and notions used in this paper are also introduced.\nWe consider the music style of the common practice period and similar music styles such as popular and jazz music in this paper.\n\n\\subsection{Structure of Polyphonic Musical Scores}\\label{sec:ScoreStructure}\n\n\\begin{figure}[t]\n\\begin{center}\n\\includegraphics[clip,width=0.85\\columnwidth]{fig_Score.pdf}\n\\end{center}\n\\vspace{-3mm}\n\\caption{Example of (a) a polyphonic piano score (Mozart: Sonata KV570) and (b) a reduced score represented with one voice. Notes that have different note values in the two representations are indicated with red note heads.}\n\\label{fig:ExampleScore}\n\\vspace{-3mm}\n\\end{figure}\nTo discuss recognition of note values in polyphonic piano music, we first explain the structure of polyphonic scores.\nThe left-hand and right-hand parts are usually written in separate staffs and each staff can contain several {\\it voices}\\footnote{Our ``voice'' corresponds to the voice information defined in music notation file formats such as MusicXML and Finale file format.}, or streams of notes (Fig.~\\ref{fig:ExampleScore}(a)).\nIn piano scores, each voice can contain chords and the number of voices can vary locally.\nHereafter we use the word {\\it chords} to indicate those within one voice.\nExcept for rare cases of partial ties in chords, notes in a chord must have simultaneous onset and offset score times.\nThis means that the offset score time of a note must be equal to or earlier than the onset score time of the next note\/chord of the same voice.\nIn the latter case, the note is followed by a rest.\nSuch rests are rare \\cite{Temperley2009} and thus the configuration of note values and the voice structure are inter-related.\n\nThe importance of voice structure in the description of note values can also be understood by comparing a polyphonic score with a reduced score obtained by putting all notes with simultaneous onsets into a chord and forming one `big voice' without any rests as in Fig.~\\ref{fig:ExampleScore}(b).\nSince these two scores are the same in terms of onset score times, the differences are only in offset score times.\nOne can see that appropriate voice structure is necessary to recover correct note values from the reduced score.\nIt can also be confirmed that note values are influential to realise the expected acoustic effect of polyphonic music.\nBecause one can automatically obtain the reduced score given the onset score times, recovering the polyphonic score as in Fig.~\\ref{fig:ExampleScore}(a) from the reduced score as in Fig.~\\ref{fig:ExampleScore}(b) is exactly the aim of note value recognition.\n\n\\subsection{Distribution of Durations in Music Performances}\\label{sec:DurationDistribution}\n\nA natural approach to recover note values from MIDI performances is finding those note values that best fit the actual note durations in the performances.\nIn this paper, {\\it duration} always means the time length measured in physical time, and a score-written note length is called a note value.\nTo relate durations to note values, one needs the (local) tempo that provides the conversion ratio.\nAlthough estimating tempos from MIDI performances is a nontrivial problem (see Sec.~\\ref{sec:Method}), let us suppose here they are given, for simplicity.\nGiven a local tempo and a note value, one can calculate an expected duration, and conversely, one can estimate a note value given a local tempo and actual duration.\n\n\\begin{figure}[t]\n\\begin{center}\n\\subfigure[]\n{\\includegraphics[clip,width=0.49\\columnwidth]{fig_keyHoldingDurationRatio.pdf}}\n\\subfigure[]\n{\\includegraphics[clip,width=0.49\\columnwidth]{fig_damperLiftingDurationRatio.pdf}}\n\\vspace{-5mm}\n\\end{center}\n\\caption{Distributions of the ratios of actual duration, (a) key-holding durations and (b) damper-lifting durations, to the expected duration.}\n\\label{fig:Distribution}\n\\vspace{-4mm}\n\\end{figure}\nFig.~\\ref{fig:Distribution} shows distributions of the ratios of actual durations in performances and the durations expected from note values and tempos estimated from onset times (used performance data is described in Sec.~\\ref{sec:Learning}).\nBecause information of key-press and key-release times for each note and pedal movements can be obtained from MIDI signals, one can define the following two durations.\nThe {\\it key-holding duration} is the time interval between key-press and key-release times and the {\\it damper-lifting duration} is obtained by extending the offset time as long as the sustain\/sostenuto pedal is held.\nAs can be seen from the figure, both distributions have large variances and thus precise prediction of note values is impossible by using only the observed values.\nAs mentioned previously \\cite{Cemgil2003,Temperley2009}, this makes note value recognition a difficult problem and it has often been avoided in previous studies.\nAdditionally, due to the large deviations of durations, most tempo estimation methods use only onset time information.\n\nA similar situation happens in speech recognition where the presence of acoustic variations and noise makes it difficult to extract symbolic text information by pure feature extraction.\nSimilarly to using a prior language model, which was the key to improve the accuracy of speech recognition \\cite{Levinson1983}, a prior model for musical scores ({\\it score model}) would be a key to solving our problem, which we seek in this paper.\n\n\\subsection{Hints for Constructing a Score Model}\\label{sec:HintsForScoreModel}\n\nThe simplest score model for note value recognition would be a discrete probability distribution over a set of note values.\nFor example, one can consider the following 15 types of note values (e.g.\\ $1\/2=\\text{half note}$, $3\/16=\\text{dotted eighth note}$, etc.):\n\\begin{equation}\n\\big\\{\\tfrac{1}{32},\\tfrac{1}{48},\\tfrac{1}{16},\\tfrac{1}{24},\\tfrac{3}{32},\\tfrac18,\\tfrac{1}{12},\\tfrac{3}{16},\\tfrac14,\\tfrac16,\\tfrac38,\\tfrac12,\\tfrac13,\\tfrac34,1\\big\\}.\n\\label{eq:NoteValues}\n\\end{equation}\nThe distribution taken from a score data set (see Sec.~\\ref{sec:Learning}) is shown in Fig.~\\ref{fig:DistrIONVClass}(a).\nAlthough the distribution has clear tendencies, it is not sufficiently sharp to compensate the large variance of the duration distributions.\nWe will confirm that this simple model yields a poor recognition accuracy in Sec.~\\ref{sec:Comparisons}.\n\n\\begin{figure}[t]\n\\begin{center}\n\\includegraphics[clip,width=0.65\\columnwidth]{fig_IONV.pdf}\n\\vspace{-4mm}\n\\end{center}\n\\caption{Onset clusters and inter-onset note values (IONVs).}\n\\label{fig:IONV}\n\\vspace{-4mm}\n\\end{figure}\nHints for constructing a score model can be obtained by again observing the example in Fig.~\\ref{fig:ExampleScore}.\nIt is observed that most notes in the reduced score have the same note values as in the original score, and even when they do not, the offset score times tend to correspond with one of the onset score times of following notes.\nTo explain this more precisely in a statistical way, we define an {\\it onset cluster} as the set of all notes with simultaneous onsets in the score and {\\it inter-onset note values} ({\\it IONVs}) as the intervals between onset score times of succeeding onset clusters (Fig.~\\ref{fig:IONV}).\nAs in the figure, for later convenience, we define IONVs for each note, even though they are same for all notes in an onset cluster.\nIf one counts frequencies that each note value matches one of the first ten IONVs (or none of them), the result is as shown in Fig.~\\ref{fig:DistrIONVClass}(b).\nWe see that the distribution has lower entropy than that in Fig.~\\ref{fig:DistrIONVClass}(a) and the probability that note values would be different from any of the first ten IONVs is small (3.50\\% in our data).\nThis suggests that a more efficient search space for note values can be obtained by using the onset score time information.\n\nEven more predictive distributions of note values can be obtained by using the pitch information.\nThis is because neighbouring notes (either horizontally or vertically) in a voice tend to have close pitches, as discussed in studies on voice separation \\cite{Cambouropoulos2008,McLeod2016,HandSeparation}.\nFor example, if we select notes that have a note within five semitones in the next onset cluster, the distribution of note values in the space of IONVs becomes as in Fig.~\\ref{fig:DistrIONVClass}(c), reflecting the fact that inserted rests are rare.\nOn the other hand, if we impose a condition of having a note with five semitones in the second next onset cluster but not having any notes within 14 semitones in the next cluster, then the distribution becomes as in Fig.~\\ref{fig:DistrIONVClass}(d), which reflects the fact that this condition implies that the note has an adjacent note in the same voice in the second next onset cluster.\nThese results suggest on one side that pitch information together with onset score time information can provide distributions of note values with more predictive ability and on the other side that those distributions are highly dependent on the pitch context.\n\n\\begin{figure}[t]\n\\begin{center}\n\\includegraphics[clip,width=1.\\columnwidth]{fig_Ex_NVDistr.pdf}\n\\end{center}\n\\vspace{-3mm}\n\\caption{Distributions of note values. In (a), note values are categorised into 15 types in Eq.~(\\ref{eq:NoteValues}) and another type including all others; in (b)(c)(d), they are categorised into the first ten IONVs and others. Samples in (c)(d) were selected by conditions on the pitch context described in the text.}\n\\label{fig:DistrIONVClass}\n\\vspace{-3mm}\n\\end{figure}\nAlthough so far we have considered note values as independent distributions, their interdependence can also provide clues in estimating note values.\nOne such interdependence can be inferred from the logical constraint of voice structure described in Sec.~\\ref{sec:ScoreStructure}.\nAs chordal notes have the same note values and they also tend to have close pitches, notes with simultaneous onset score times and close pitches tend to have identical note values.\nThis is another case where pitch information has influence on the distribution of note values.\n\n\\subsection{Summary of the Section}\n\nHere we summarise the findings in this section:\n\\begin{itemize}\n\n\\item The voice structure and the configuration of note values are inter-related and the logical constraints for musical scores induce interdependence between note values.\n\n\\item Performed durations contain large deviations from those implied by the score and a score model is crucial to accurately estimate note values from performance signals.\n\n\\item Information about onset score times provides an efficient search space for note values through the use of IONVs. In particular, the probability that a note value falls into one of the first ten IONVs is quite high.\n\n\\item The distribution of note values is highly dependent on the pitch context, which would be useful for improving their predictability.\n\n\\end{itemize}\nIn the rest of this paper, we construct a computational model to incorporate these findings and examine by numerical experiments how they quantitatively influence the accuracy of note value recognition.\n\n\n\\section{Proposed Method}\\label{sec:Method}\n\n\\subsection{Problem Statement}\\label{sec:ProblemStatement}\n\nFor rhythm transcription, the input is a MIDI performance signal, represented as a sequence of pitches, onset times and offset times $(p_n,t_n,t^{\\rm off}_n,\\bar{t}^{\\rm off}_n)_{n=1}^N$ where $n$ is an index for musical notes and $N$ is the number of notes.\nAs explained in Sec.~\\ref{sec:DurationDistribution}, we can define two offset times for each note, the key-release time and damper-drop time, denoted by $t^{\\rm off}_n$ and $\\bar{t}^{\\rm off}_n$.\nThe corresponding key-holding and damper-lifting duration will be denoted by $d_n=t^{\\rm off}_n-t_n$ and $\\bar{d}_n=\\bar{t}^{\\rm off}_n-t_n$.\nThe aim is to recognise the score times of the note onsets and offsets, which are denoted by $(\\tau_n,\\tau^{\\rm off}_n)_{n=1}^N$.\nIn general, $\\tau_n$ and $\\tau^{\\rm off}_n$ take values in the set of rational numbers in units of a beat unit, say, the whole-note length.\nFor example, $\\tau_1=0$ and $\\tau^{\\rm off}_1=1\/4$ means that the first note is at the beginning of the score and has a quarter-note length.\nWe use the following notations for sequences: $\\bm d=(d_n)_{n=1}^N$, $\\bm\\tau^{\\rm off}=(\\tau^{\\rm off}_n)_{n=1}^N$, etc.\nWe call the difference $r_n=\\tau^{\\rm off}_n-\\tau_n$ the {\\it note value}.\nFrequently used mathematical symbols are listed in Table \\ref{tab:MathSymbols}.\n\n\\begin{table}[t]\n\\begin{center}\n\n\\begin{tabular}{ll}\\toprule\nVariable & Notation\\\\\n\\midrule\nIndex for note & $n$\\\\\nPitch & $p_n$\\\\\nOnset time & $t_n$\\\\\nKey-release [Damper-drop] (offset) time & $t^{\\rm off}_n$ [$\\bar{t}^{\\rm off}_n$]\\\\\nKey-holding [Damper-lifting] duration & $d_n$ [$\\bar{d}_n$]\\\\\nOnset [offset] score time & $\\tau_n$ [$\\tau^{\\rm off}_n$]\\\\\nNote value & $r_n$\\\\\nLocal tempo & $v_n$\\\\\nSequence of variables & $\\bm p=(p_n)_{n=1}^N$ etc.\\\\\n\\bottomrule\n\\end{tabular}\n}\n\\end{center}\n\\caption{List of Frequently Used Mathematical Symbols.}\n\\label{tab:MathSymbols}\n\\vspace{-7mm}\n\\end{table}\nIn this paper, we consider the situation that the onset score times $\\bm\\tau$ are given as estimations from conventional onset rhythm transcription algorithms.\nIn addition, we assume that a local tempo $v_n$, which gives a smoothed ratio of the time interval and score time interval at each note $n$, is given.\nLocal tempos $\\bm v=(v_n)_{n=1}^N$ can be obtained from the sequences $\\bm t$ and $\\bm\\tau$ by applying some smoothing methods such as Kalman smoothing and local averaging, and typically they can be obtained as outputs of onset rhythm transcription algorithms.\n\nIn summary, we set up the problem of note value recognition as estimating the sequence $\\bm\\tau^{\\rm off}$ (or $\\bm r$) with inputs $\\bm p,\\bm d,\\bar{\\bm d},\\bm\\tau$ and $\\bm v$.\nFor concreteness, in this paper, we mainly use as $\\bm\\tau$ and $\\bm v$ the outputs from a method based on a metrical HMM (Sec.~\\ref{sec:OnsetPositionAndTempo}), but our method is applicable as a post-processing step for any rhythm transcription method that outputs $\\bm\\tau$.\n\n\\subsection{Estimation of Onset Score Times and Local Tempos}\\label{sec:OnsetPositionAndTempo}\n\nTo estimate onset score times $\\bm\\tau$ and local tempos $\\bm v$ from a MIDI performance $(\\bm p,\\bm t,\\bm t^{\\rm off},\\bar{\\bm t}^{\\rm off})$, we use a metrical HMM \\cite{Raphael2002}, which is one of the most accurate onset rhythm transcription methods (Sec.~\\ref{sec:RelatedWork}).\nHere we briefly review the model.\n\nIn the metrical HMM, the probability $P(\\bm\\tau)$ of the score is generated from a Markov process on periodically defined beat positions denoted by $(s_n)_{n=1}^N$ with $s_n\\in\\{1,\\ldots,G\\}$ ($G$ is a period of beats such as a bar).\nThe sequence $\\bm s$ is generated with the initial and transition probabilities as\n\\begin{equation}\nP(\\bm s)=P(s_1)\\prod_{n=2}^NP(s_n|s_{n-1}).\n\\label{eq:MetricalMM}\n\\end{equation}\nWe interpret $s_n$ as $\\tau_n$ modulo $G$, or more explicitly, we obtain $\\bm\\tau$ incrementally as follows:\n\\begin{align}\n\\tau_1&=s_1,\n\\\\\n\\tau_{n+1}&=\\tau_n+\\begin{cases}\ns_{n+1}-s_n, &{\\rm if}~s_{n+1}>s_n;\\\\\nG+s_{n+1}-s_n, &{\\rm if}~s_{n+1}\\leq s_n.\n\\end{cases}\n\\end{align}\nThat is, if $s_{n+1}\\leq s_n$, we interpret that $s_{n+1}$ indicates the beat position in the next bar.\nWith this understood, $P(\\bm\\tau)$ is equivalent to $P(\\bm s)$ as long as $r_n\\leq G$ for all $n$.\nAn extension is possible to allow note onset intervals larger than $G$ \\cite{NakamuraEUSIPCO2016}.\n\nIn constructing the performance model, local tempo variables $\\bm v$ are introduced to describe the indeterminacy and temporal variations of tempos.\nThe probability $P(\\bm t,\\bm v|\\bm\\tau)$ is decomposed as $P(\\bm t|\\bm\\tau,\\bm v)P(\\bm v)$ and each factor is described with the following Gaussian Markov process:\n\\begin{align}\n&P(v_{n}|v_{n-1})={\\sf N}(v_{n};v_{n-1},\\sigma_v^2),\n\\\\\n&P(t_{n+1}|t_n,\\tau_{n+1},\\tau_n,v_n)\n\\notag\n\\\\\n&\\quad={\\sf N}(t_{n+1};t_n+(\\tau_{n+1}-\\tau_n)v_n,\\sigma_t^2)\n\\end{align}\nwhere ${\\sf N}(\\,\\cdot\\,;\\mu,\\Sigma)$ denotes a normal distribution with mean $\\mu$ and variance $\\Sigma$, and $\\sigma_v$ and $\\sigma_t$ are standard deviations representing the degree of tempo variations and onset time fluctuations, respectively.\nAn initial distribution for $v_1$ is described similarly as a Gaussian ${\\sf N}(v_1;v_{\\rm ini},\\sigma_{v,{\\rm ini}}^2)$.\n\nAn algorithm to estimate onset score times and local tempos can be obtained by maximising the posterior probability $P(\\bm\\tau,\\bm v|\\bm t)\\propto P(\\bm t,\\bm v|\\bm\\tau)P(\\bm\\tau)$.\nThis can be done by a standard Viterbi algorithm after discretisation of the tempo variables \\cite{NakamuraEUSIPCO2016,Krebs2015}.\nNote that this method does not use the pitch and offset information to estimate onset score times, which is typical in conventional onset rhythm transcription methods.\nSince the period $G$ and rhythmic properties encoded in $P(s_n|s_{n-1})$ are dependent on the metre, in practice it is effective to consider multiple metrical HMMs corresponding to different metres, such as duple metre and triple metre, and choose the one with the maximum posterior probability in the stage of inference.\n\n\\subsection{Markov Random Field Model}\\label{sec:Model}\n\nHere we describe our main model.\nAs explained in Sec.~\\ref{sec:Observation}, it is essential to combine a score model that enables prediction of note values given the input information of onset score times and pitches and a performance model that relates note values to actual durations realised in music performances.\nTo enable tractable inference and efficient parameter estimation, one should typically decompose each model into component models that involve a smaller number of stochastic variables.\n\nAs a framework to combine such component models, we consider the following Markov random field (MRF):\n\\begin{align}\n&P(\\bm r|\\bm p,\\bm d,\\bar{\\bm d},\\bm\\tau,\\bm v)\n\\notag\n\\\\\n&\\propto{\\rm exp}\\bigg[-\\sum^N_{n=1}H_1(r_n;\\bm\\tau,\\bm p)-\\sum_{(n,m)\\in\\mathscr{N}}H_2(r_n,r_m)\n\\notag\n\\\\\n&\\qquad\\quad~~-\\sum^N_{n=1}H_3(r_n;d_n,\\bar{d}_n,v_n)\\bigg].\n\\label{eq:MRF}\n\\end{align}\nHere $H_1$ (called the {\\it context model}) represents the prior model for each note value that depends on the onset score times and pitches, $H_2$ (the {\\it interdependence model}) represents the interdependence of neighbouring pairs of note values ($\\mathscr{N}$ denotes the set of neighbouring note pairs specified later) and $H_3$ (the {\\it performance model}) represents the likelihood model.\nEach term can be interpreted as an energy function that has small values when the arguments have higher probabilities.\nThe explicit forms of these functions are given as follows:\n\\begin{align}\nH_1&=-\\beta_1{\\rm ln}\\,P(r_n;\\bm\\tau,\\bm p),\n\\\\\nH_2&=-\\beta_2{\\rm ln}\\,P(r_n,r_m),\n\\\\\nH_3&=-\\beta_{31}{\\rm ln}\\,P(d_n;r_n,v_n)-\\beta_{32}{\\rm ln}\\,P(\\bar{d}_n;r_n,v_n).\n\\label{eq:H3}\n\\end{align}\nEach energy function is constructed with a negative log probability function multiplied by a positive weight.\nThese weights $\\beta_1$, $\\beta_2$, $\\beta_{31}$ and $\\beta_{32}$ are introduced to represent the relative importance of the component models.\nFor example, if we take $\\beta_1=\\beta_{31}=\\beta_{32}=1$ and $\\beta_2=0$, the model reduces to a Naive Bayes model with the durations considered as features.\nFor other values of $\\beta$\\,s, the model is no longer a generative model for the durations but still a generative model for the note values, which are the only unknown variables in our problem.\nIn the following we explain the component models in detail.\nLearning parameters including $\\beta$\\,s is discussed in Sec.~\\ref{sec:Learning}.\n\n\\subsubsection{Context Model}\n\nThe context model $H_1$ describes a prior distribution for note values that is conditionally dependent on given onset score times and pitches.\nTo construct this model, one should first specify the sample space of $r_n$, or, the set of possible values that each $r_n$ can take.\nBased on the observations in Sec.~\\ref{sec:Observation}, we consider the first ten IONVs as possible values of $r_n$.\nSince $r_n$ can take other values in reality, we also consider a formally defined value `{\\sf other}', which represents all other values of $r_n$.\nLet\n\\[\n\\Omega_r(n)=\\{{\\rm IONV}(n,1),\\ldots,{\\rm IONV}(n,10),{\\sf other}\\}\n\\]\ndenote the sample space.\nTherefore $P(r_n;\\bm\\tau,\\bm p)$ is considered as an 11-dimensional discrete distribution.\n\n\\begin{figure}[t]\n\\begin{center}\n\\includegraphics[clip,width=0.95\\columnwidth]{fig_MRF_Detail.pdf}\n\\end{center}\n\\vspace{-5mm}\n\\caption{Statistical dependencies in the Markov random field model.}\n\\label{fig:MRF_Detail}\n\\vspace{-3mm}\n\\end{figure}\nAs we saw in Sec.~\\ref{sec:Observation}, the distribution $P(r_n;\\bm\\tau,\\bm p)$ depends heavily on the pitch context.\nBased on our intuition that for each note $n$ the succeeding notes with a close pitch are most influential on the voice structure, in this paper we use the feature vector $c_n=(c_n(1),\\ldots,c_n(10))$ as a context of note $n$, where $c_n(k)$ denotes the unsigned pitch interval between note $n$ and the closest pitch in its $k$-th next onset cluster.\nAn example of the context is given in Fig.~\\ref{fig:MRF_Detail}.\nThus we have\n\\begin{equation}\nP(r_n;\\bm\\tau,\\bm p)=P(r_n;c_n(1),\\ldots,c_n(10)).\n\\label{eq:ContextProbability}\n\\end{equation}\nWe remark that in general we can additionally consider different features (for example, metrical features) and our formulation in this section and in Sec.~\\ref{sec:Learning} is valid independently of our particular choice of features.\n\nDue to the huge number of different contexts for notes, it is not practical to use Eq.~(\\ref{eq:ContextProbability}) directly.\nWith 88 pitches on a piano keyboard, each $c_n(k)$ can take 87 values and thus the right-hand side (RHS) of Eq.~(\\ref{eq:ContextProbability}) has $11\\cdot87^{10}$ parameters (or slightly less free parameters after normalisation), which is computationally infeasible.\n(If one uses additional features, the number of parameters increases further.)\nTo solve this problem, we use a context-tree model \\cite{ContextTreeClustering,Takaki2014}, in which contexts are categorised according to a set of criteria that are represented as a tree (as in decision tree analysis) and all contexts in one category have the same probability distribution.\n\n\\begin{figure}[t]\n\\begin{center}\n\\includegraphics[clip,width=0.6\\columnwidth]{fig_ContextTreeModel.pdf}\n\\end{center}\n\\vspace{-5mm}\n\\caption{In a context-tree model, the distribution of a quantity $r$ is categorised with a set of criteria on the context $c$.}\n\\label{fig:ContextTreeModel}\n\\vspace{-3mm}\n\\end{figure}\nFormally, a context-tree model is defined as follows.\nHere we consider a general {\\it context} $c=(c(1),\\ldots,c(F))$, which is an $F$-dimensional feature vector.\nWe assume that the set of possible values for $c(f)$ is an ordered set for all $f=1,\\ldots,F$ and denote it by $R_f$.\nLet us denote the leaf nodes of a binary tree $T$ by $\\partial T$.\nEach node $\\nu\\in T$ is associated with a set of contexts denoted by $C_\\nu$.\nIn particular, for the root node $0\\in T$, $C_0$ is the set of all contexts ($R_1\\times\\cdots\\times R_F$).\nEach internal node $\\nu\\in T\\setminus\\partial T$ is associated with a criterion $\\gamma(\\nu)$ for selecting a subset of $C_\\nu$.\nA {\\it criterion} $\\gamma=(f_\\gamma,\\kappa_\\gamma)$ is defined as a pair of a feature dimension $f_\\gamma\\in\\{1,\\ldots,F\\}$ and a cut $\\kappa_\\gamma\\in R_{f_\\gamma}$.\nThe criterion divides a set of contexts $C$ into two subsets as\n\\begin{align}\nC^L(\\gamma)&=\\{c\\in C\\,|\\,c(f_\\gamma)\\leq\\kappa_\\gamma\\},\n\\\\\nC^R(\\gamma)&=\\{c\\in C\\,|\\,c(f_\\gamma)>\\kappa_\\gamma\\},\n\\end{align}\nso that $C^L(\\gamma)\\cap C^R(\\gamma)=\\phi$ and $C^L(\\gamma)\\cup C^R(\\gamma)=C$.\nNow denoting the left and right child of $\\nu\\in T\\setminus\\partial T$ by $\\nu L$ and $\\nu R$, their sets of contexts are defined as $C_{\\nu L}=C_\\nu\\cap C_0^L(\\gamma(\\nu))$ and $C_{\\nu R}=C_\\nu\\cap C_0^R(\\gamma(\\nu))$, which recursively defines a {\\it context tree} $(T,f,\\kappa)$ (Fig.~\\ref{fig:ContextTreeModel}).\nBy definition, a context is associated to a unique leaf node: for all $c\\in C_0$ there exists a unique $\\lambda\\in\\partial T$ such that $c\\in C_\\lambda$.\nWe denote such a leaf by $\\lambda(c)$.\nFinally, for each node $\\nu\\in T$, a probability distribution $Q_\\nu(\\,\\cdot\\,)$ is associated.\nNow we can define the probability $P_\\mathscr{T}(\\,\\cdot\\,;c)$ as\n\\begin{equation}\nP_\\mathscr{T}(\\,\\cdot\\,;c)=Q_{\\lambda(c)}(\\,\\cdot\\,).\n\\end{equation}\nThe tuple $\\mathscr{T}=(T,f,\\kappa,Q)$ defines a {\\it context-tree model}.\n\nFor a context-tree model with $L$ leaves, the number of parameters for the distribution of note values is now reduced to $11L$.\nIn general a model with a larger tree size has more ability to approximate Eq.~(\\ref{eq:ContextProbability}) at the cost of an increasing number of model parameters.\nThe next problem is to find the optimal tree size and the optimal criterion for each internal node.\nWe will explain this in Sec.~\\ref{sec:ContextTreeClustering}.\n\n\\subsubsection{Interdependence Model}\n\nAlthough the distribution of note values in the context model is dependent on the pitch context, it is independently defined for each note value.\nAs explained in Sec.~\\ref{sec:Observation}, interdependence of note values is also important since it arises from logical constraint on the voice structure.\nSuch interdependence can be described with a joint probability of note values of a pair of notes in $H_2$.\nAs in the context model, we consider the set $\\Omega_r$ as a sample space for note values so that the joint probability $P(r_n,r_m)$ for notes $n$ and $m$ has $11^2$ parameters.\n\nThe choice of the set of neighbouring note pairs $\\mathscr{N}$ in Eq.~(\\ref{eq:MRF}) is most important for the interdependence model.\nIn order to capture the voice structure we define $\\mathscr{N}$ as\n\\begin{equation}\n\\mathscr{N}=\\{(n,m)\\,|\\,\\tau_n=\\tau_m,~|p_n-p_m|\\leq \\delta_{\\rm nbh}\\}\n\\label{eq:Neighbour}\n\\end{equation}\nwhere $\\delta_{\\rm nbh}$ is a parameter to define the vicinity of the pitch.\nThe value of $\\delta_{\\rm nbh}$ is determined from data (see Sec.~\\ref{sec:Optimisation}).\n\n\\subsubsection{Performance Model}\\label{sec:PerformanceModel}\n\nThe performance model is constructed with the probability of actual durations in performances given a note value and a local tempo.\nSince we can use two durations $d_n$ and $\\bar{d}_n$, two distributions, $P(d_n;r_n,v_n)$ and $P(\\bar{d}_n;r_n,v_n)$, are considered for each note as in the RHS of Eq.~(\\ref{eq:H3}).\nTo regulate the effect of varying tempos and avoid the increase in the complexity of the model to handle possibly many types of note values, we consider distributions over normalised durations, $d'_n=d_n\/(r_nv_n)$ and $\\bar{d}'_n=\\bar{d}_n\/(r_nv_n)$, as we did in Sec.~\\ref{sec:Observation}.\nWe therefore assume\n\\begin{equation}\nP(d_n;r_n,v_n)=g(d'_n)\\quad{\\rm and}\\quad P(\\bar{d}_n;r_n,v_n)=\\bar{g}(\\bar{d}'_n)\n\\label{eq:PerfmModel}\n\\end{equation}\nwhere $g$ and $\\bar{g}$ are one-dimensional probability distributions supported on positive real numbers.\n\nThe histograms corresponding to $g$ and $\\bar{g}$ taken from performance data described in Sec.~\\ref{sec:Learning} are illustrated in Fig.~\\ref{fig:Distribution}.\nOne can recognise two (one) peak(s) for the distribution of normalised key-holding (damper-lifting) durations.\nSince theoretical forms of these distributions are unknown, we use as phenomenologically fitting distributions the following generalised inverse-Gaussian (GIG) distribution:\n\\begin{equation}\n{\\sf GIG}(x;a,b,h)=\\frac{(a\/b)^{h\/2}}{2K_h(2\\sqrt{ab})}x^{h-1}e^{-(ax+b\/x)}\n\\end{equation}\nwhere $a,b>0$ and $h\\in\\mathbb{R}$ are parameters and $K_h$ denotes the modified Bessel function of the second kind.\nThe GIG distributions are supported on positive real numbers and include the gamma ($a\\to0$), inverse-gamma $(b\\to0$) and inverse-Gaussian ($h=-1\/2$) distributions as special cases.\nSince a GIG distribution has only one peak, we use a mixture of GIG distributions to represent $g$.\nWe parameterise $g$ and $\\bar{g}$ as\n\\begin{align}\ng(x)&=w_1{\\sf GIG}(x;a_1,b_1,h_1)+w_2{\\sf GIG}(x;a_2,b_2,h_2),\n\\label{eq:g}\n\\\\\n\\bar{g}(x)&={\\sf GIG}(x;a_3,b_3,h_3)\n\\label{eq:gbar}\n\\end{align}\nwhere $w_1$ and $w_2=1-w_1$ are mixture weights.\nParameter values obtained from data are given in Sec.~\\ref{sec:PerformanceModelLearning}.\n\n\n\\subsection{Model Learning}\\label{sec:Learning}\n\nSimilarly as the language model and the acoustic model for a speech recognition system are generally trained separately with different data, our three component models can be trained separately and combined afterwards to determine the optimal weights (the $\\beta$\\,s).\nThe context model and the interdependence model can be learned with musical score data and we used a dataset of 148 classical piano pieces (with $3.4\\times10^6$ notes) by various composers\\footnote{The lists of used pieces for the score data and the performance data are available at the accompanying web page \\cite{Webpage}.}.\nOn the other hand, the performance model requires performance data aligned with reference scores.\nThe used data consisted of 180 performances (60 phrases $\\times$ 3 different players) by various composers and various performers that are mostly collected from publicly available MIDI performances recorded in international piano competitions \\cite{eCompetition}.\nDue to the lack of abundant data, we used the same performance data for training and evaluation.\nBecause the number of parameters for the performance model is small (ten independent parameters in $g$ and $\\bar{g}$ and two weight parameters) and they are not fine-tunable, there should be little concern about overfitting here and most comparative evaluations in Sec.~\\ref{sec:Evaluation} are done with equal conditions.\n(See also the discussion in Secs.~\\ref{sec:PerformanceModelLearning} and \\ref{sec:Examinations}.)\nTo avoid overfitting, the score data and the performance data contained no overlapping musical pieces (at least in units of movements).\nLearning methods for the component models are described in the following sections and Sec.~\\ref{sec:Optimisation} describes the optimisation of the $\\beta$\\,s.\n\n\\subsubsection{Learning the Context Model}\\label{sec:ContextTreeClustering}\n\nThe context-tree model can be learned by growing the tree based on the maximum likelihood (ML) principle, which is called {\\it context-tree clustering}.\nThis is usually done by recursively splitting a node that minimises the likelihood \\cite{ContextTreeClustering}.\nAlthough it is not essentially new, we describe the learning method here for the readers' convenience because context-tree clustering is not commonly used in the field of music informatics and in articles for speech processing (where it is widely used) the notations are adapted for the case with Gaussian distributions, which is not ours.\n\nLet $x_i=(r_i,c_i)$ denote a sample extracted from score data, where $i$ denotes a note in the score data, $r_i$ denotes an element in $\\Omega_r(i)$ and $c_i$ denotes the context of note $i$.\nThe set of all samples will be denoted by $\\bm x=(x_i)_{i=1}^I$.\nThe log likelihood $L_\\mathscr{T}(\\bm x)$ of a context-tree model $\\mathscr{T}=(T,f,\\kappa,Q)$ is given as\n\\begin{align}\nL_\\mathscr{T}(\\bm x)&=\\sum_{i=1}^I{\\rm ln}\\,P_\\mathscr{T}(x_i)=\\sum_{i=1}^I{\\rm ln}\\,Q_{\\lambda(c_i)}(x_i)\n\\notag\n\\\\\n&=\\sum_{\\lambda\\in\\partial T}\\sum_{i:\\,c_i\\in C_\\lambda}q_\\lambda(x_i)\n\\end{align}\nwhere in the second line we decomposed the samples according to the criteria of the leaves and hereafter we denote $q_\\nu(\\,\\cdot\\,)={\\rm ln}\\,Q_\\nu(\\,\\cdot\\,)$ for each node $\\nu$.\nThe parameters for each distribution $Q_\\nu$ for node $\\nu\\in T$ are learned from the samples $\\{x_i|c_i\\in C_\\nu\\}$ according to the ML method.\nWe implicitly understand that all $Q$\\,s are already learned in this way.\n\nGiven a context tree $\\mathscr{T}^{(m)}$ (one begins with a tree $\\mathscr{T}^{(0)}$ containing only the root node and proceeds $m=0,1,2,\\ldots$ as follows), one of the leaves $\\lambda\\in\\partial T^{(m)}$ is split according to some additional criterion $\\gamma(\\lambda)$.\nLet us denote the expanded context-tree model by $\\mathscr{T}^{(m)}_\\lambda$.\nSince $\\mathscr{T}^{(m)}_\\lambda$ is same as $\\mathscr{T}^{(m)}$ except for the new leaves $\\lambda L$ and $\\lambda R$, the difference of log likelihoods $\\Delta L(\\lambda)=L_{\\mathscr{T}^{(m)}_\\lambda}(\\bm x)-L_{\\mathscr{T}^{(m)}}(\\bm x)$ is given as\n\\begin{equation}\n\\sum_{i:\\,c_i\\in C_{\\lambda L}}q_{\\lambda L}(x_i)+\\sum_{i:\\,c_i\\in C_{\\lambda R}}q_{\\lambda R}(x_i)-\\sum_{i:\\,c_i\\in C_\\lambda}q_{\\lambda}(x_i).\n\\end{equation}\nNote that $\\Delta L(\\lambda)\\geq0$ since $Q_{\\lambda L}$ and $Q_{\\lambda R}$ have the ML.\nNow the leaf $\\lambda^*$ and the criterion $\\gamma(\\lambda^*)$ that maximise $\\Delta L(\\lambda)$ are selected for growing the context tree: $\\mathscr{T}^{(m+1)}=\\mathscr{T}^{(m)}_{\\lambda^*}$.\n\nAccording to the above ML criterion, the context tree can be expanded to the point where all samples are completely separated by contexts, for which the model often suffers from overfitting.\nTo avoid this and find an optimal tree size according to the data, the minimal description length (MDL) criterion for model selection can be used \\cite{Shinoda2000,Rissanen1984}.\nThe MDL $\\ell_{\\cal M}(\\bm x)$ for a model ${\\cal M}$ with parameters $\\theta_{\\cal M}$ is given as\n\\begin{equation}\n\\ell_{\\cal M}(\\bm x)=-{\\rm log}_2P(\\bm x;\\hat{\\theta}_{\\cal M})+\\frac{|{\\cal M}|}{2}{\\rm log}_2I\n\\label{eq:MDL}\n\\end{equation}\nwhere $I$ is the length of $\\bm x$, $|{\\cal M}|$ is the number of free parameters of model ${\\cal M}$ and $\\hat{\\theta}_{\\cal M}$ denotes the ML estimate of $\\theta_{\\cal M}$ according to data $\\bm x$.\nHere, the first term in the RHS is the negative log likelihood, which in general decreases when the model's complexity increases.\nOn the other hand, the second term increases when the number of model parameters increases.\nThus a model that minimises the MDL is chosen by a trade off of the model's precision and complexity.\nThe MDL criterion is justified by an information-theoretic argument \\cite{Rissanen1984}.\n\nFor our context-tree model, each $Q$ is an 11-dimensional discrete distribution and has ten free parameters, and therefore the increase of parameters by expanding a node is ten.\nSubstituting this into Eq.~(\\ref{eq:MDL}), we find\n\\begin{align}\n\\Delta\\ell(\\lambda^*)&=\\ell_{\\mathscr{T}^{(m+1)}}(\\bm x)-\\ell_{\\mathscr{T}^{(m)}}(\\bm x)\n\\notag\n\\\\\n&=-\\Delta L(\\lambda^*)\/({\\rm ln}\\,2)+(10\/2){\\rm log}_2I.\n\\end{align}\nIn summary, the context tree is expanded by splitting the optimal leaf $\\lambda^*$, up to a step where $\\Delta\\ell(\\lambda^*)$ becomes positive.\n\n\\begin{figure}[t]\n\\begin{center}\n\\includegraphics[clip,width=1.\\columnwidth]{tree_IONVDistr_Illustration.pdf}\n\\end{center}\n\\vspace{-3mm}\n\\caption{A subtree of the obtained context-tree model. Above each node are indicated the node ID, number of samples and their proportion in the whole data and the green number indicates the highest probability in each distribution. See text for explanation of the labels for each distribution.}\n\\label{fig:ContextTree}\n\\vspace{-3mm}\n\\end{figure}\nWith our score data of $3.4\\times10^6$ musical notes, the learned context tree had 132 leaves.\nA subtree is illustrated in Fig.~\\ref{fig:ContextTree} where the node ID is shown in square brackets and the labels $1,\\ldots,10$ in the distribution show those probabilities correspond to ${\\rm IONV}(1),\\ldots,{\\rm IONV}(10)$ and the label 0 is assigned to the `{\\sf other}'.\nFor example, one finds a distribution with a sharp peak at ${\\rm IONV}(1)$ in node 2 whose contexts satisfy $c(1)\\leq 2$.\nThis can be interpreted as follows: if note $n$ has a pitch within 2 semitones in the next onset cluster, then it is highly probable that they are in the same voice and note $n$ has $r_n={\\rm IONV}(n,1)$.\nOn the other hand, the ${\\rm IONV}(2)$ has the largest probability in node 7 (the distribution is the same one as in Fig.~\\ref{fig:DistrIONVClass}(d)) with contexts satisfying $c(2)\\leq 5$ and $c(1)>14$, whose interpretation was explained in Sec.~\\ref{sec:HintsForScoreModel}. \nSimilar interpretations can be made for node 11 and other nodes.\nThese results show that the context tree tries to capture the voice structure through the pitch context.\nAs this is induced from data in an unsupervised way, it serves as an information-scientific confirmation that the voice structure has a strong influence on the configuration of note values.\n\n\\subsubsection{Learning the Interdependence Model}\\label{sec:LearningH2}\n\nThe interdependence model for each $\\delta_{\\rm nbh}$ can be directly learned from score data: for all note pairs defined by Eq.~(\\ref{eq:Neighbour}), one obtains the joint probability of their note values.\nThe obtained results for $\\delta_{\\rm nbh}=12$ is shown in Fig.~\\ref{fig:InterDepIONVProb} where the same labels are used as in Fig.~\\ref{fig:ContextTree}.\nThe diagonal elements, which have the largest probability in each row and column, clearly reflect the constraint of chordal notes having the same note values.\n\nSince the interdependence model is by itself not as precise a generative model as the context model and these models are not independent, we optimise $\\delta_{\\rm nbh}$ in combination with the context model.\nThis is described in Sec.~\\ref{sec:Optimisation}, together with the optimisation of the weights.\nIn preparation for this, we learned the joint probability for each of $\\delta_{\\rm nbh}=0,1,\\ldots,15$.\n\\begin{figure}[t]\n\\begin{center}\n\\includegraphics[clip,width=0.85\\columnwidth]{fig_InterDepIONVProb.pdf}\n\\end{center}\n\\vspace{-3mm}\n\\caption{Joint probability distribution of note values obtained for the interdependence model for $\\delta_{\\rm nbh}=12$. See text for explanation of the labels.}\n\\label{fig:InterDepIONVProb}\n\\vspace{-3mm}\n\\end{figure}\n\n\\subsubsection{Learning the Performance Model}\\label{sec:PerformanceModelLearning}\n\n\\begin{figure}[t]\n\\begin{center}\n\\subfigure[]\n{\\includegraphics[clip,width=0.85\\columnwidth]{fig_fit_keyHoldingDurationRatio.pdf}}\\\\\n\\subfigure[]\n{\\includegraphics[clip,width=0.85\\columnwidth]{fig_fit_damperLiftingDurationRatio.pdf}}\n\\vspace{-3mm}\n\\end{center}\n\\caption{Distributions used for the performance model for (a) key-holding durations and (b) damper-lifting durations. In each figure, the background histogram is the one obtained from the whole training data (same as Fig.~\\ref{fig:Distribution}) and the superposed histograms are obtained from 10-fold training datasets.}\n\\label{fig:VarPerfmModel}\n\\vspace{-3mm}\n\\end{figure}\nThe parameters for the performance model in Eqs.~(\\ref{eq:g}) and (\\ref{eq:gbar}) are learned from the distributions given in Fig.~\\ref{fig:Distribution}.\nWe performed a grid search for minimising the squared fitting error for each distribution.\nThe obtained values are the following:\n\\begin{align}\na_1&=2.24\\pm0.02,\\quad b_1=0.24\\pm0.01,\\quad h_1=0.69\\pm0.01,\n\\notag\n\\\\\na_2&=13.8\\pm0.1,\\quad b_2=15.2\\pm0.1,\\quad h_2=-1.22\\pm0.04,\n\\notag\n\\\\\nw_1&=0.814\\pm0.004,\\quad w_2=0.186\\pm0.004,\n\\notag\n\\\\\na_3&=0.94\\pm0.01,\\quad b_3=0.51\\pm0.01,\\quad h_3=0.80\\pm0.01.\n\\notag\n\\end{align}\nThe fitting curves are illustrated in Fig.~\\ref{fig:VarPerfmModel}.\nIn the figure, we also show histograms of normalised durations obtained from ten different subsets of the training data that are constructed similarly as the 10-fold cross-validation method: i.e.\\ we split the training data into ten separate sets (each containing 10\\% of the performances) and the remaining 90\\% of the data were used as one of the 10-fold training datasets.\nWe can see in Fig.~\\ref{fig:VarPerfmModel} that the differences among these histograms are not large.\nTwo other parameter sets for $g$ and $\\bar{g}$ were chosen as trial distributions shown in the figure, which deviate from the best fit distribution more than the differences among the 10-fold histograms.\nThese distributions are used in Sec.~\\ref{sec:InfluenceOfPerfmModel} to examine the influence of the parameter values for the performance model.\n\n\\subsubsection{Optimisation of the Weights}\\label{sec:Optimisation}\n\nSince the three component models for the MRF model in Eq.~(\\ref{eq:MRF}) are not independent, the weights $\\beta$ should be obtained by simultaneous optimisation using performance data in general.\nHowever, since the amount of score data at hand is significantly larger than that of the performance data, we optimise the weights in a more efficient way.\nNamely, we first optimise $\\beta_1$ and $\\beta_2$ with the score data and then optimise $\\beta_{31}$ and $\\beta_{32}$ with the performance data (with fixed $\\beta_1$ and $\\beta_2$).\nWhen examining the influence of varying these weights in Sec.~\\ref{sec:Examinations}, we will discuss that the influence of this sub-optimisation procedure is seemingly small.\n\nWe obtained the first two weights simultaneously with $\\delta_{\\rm nbh}$ by the ML principle with the following results:\n\\begin{equation}\n\\hat{\\beta}_1=0.965\\pm0.005,\\quad\\hat{\\beta}_2=0.03\\pm0.005,\\quad\\hat{\\delta}_{\\rm nbh}=12.\n\\label{eq:UsedBeta12}\n\\end{equation}\nThe result $\\hat{\\beta}_2\\ll\\hat{\\beta}_1$ indicates that the interdependence model has little influence in the score model.\nAlthough it seems somewhat contradictory to the results in Sec.~\\ref{sec:LearningH2} at first sight, we can understand this by noticing that both the context model and interdependence model make use of pitch proximity to capture the voice structure.\nThe former model uses pitch proximity in the horizontal (time) direction and the latter model does so in the vertical (pitch) direction, and they have overlapping effects since whenever a note pair (say, note $n$ and $n'$) in an onset cluster have close pitches, they tend to share notes in succeeding onset clusters with close pitches (see e.g.\\ the chords in the left-hand part in the score in Fig.~\\ref{fig:ExResult}).\nThus note $n$ and $n'$ tend to obey similar distributions in the context model.\nSince the interdependence model is weaker in terms of predictive ability, this results in small $\\hat{\\beta}_2$.\n\nWe optimised $\\beta_{31}$ and $\\beta_{32}$ according to the accuracy of note value recognition (more precisely, the average error rate defined in Sec.~\\ref{sec:Measure}) and the obtained values are as follows:\n\\begin{equation}\n\\hat{\\beta}_{31}=0.21\\pm0.01,\\quad\\hat{\\beta}_{32}=0.003\\pm0.001.\n\\label{eq:UsedBeta3132}\n\\end{equation}\nOne can notice that $\\hat{\\beta}_{32}\\ll\\hat{\\beta}_{31}$, which can be explained by the significantly larger variance of the distribution of damper-lifting durations than that of key-holding durations in Fig.~\\ref{fig:Distribution}.\nOn the other hand, the result that $\\hat{\\beta}_{31}$ is considerably smaller than $\\hat{\\beta}_1$ can be interpreted as that the score model has more importance for estimating note values (in our model).\nThe effect of varying weights is examined in Sec.~\\ref{sec:Examinations}.\n\n\\subsection{Inference Algorithm and Implementation}\\label{sec:Implementation}\n\nWe can develop a note value recognition algorithm based on the maximisation of the probability in Eq.~(\\ref{eq:MRF}) with respect to $\\bm r$.\nAs a search space, we consider $\\Omega_r(n)\\setminus\\{{\\sf other}\\}$ for each $r_n$.\nWithout $H_2$, the probability is independent for each $r_n$ and the optimisation is straightforward.\nWith $H_2$, we should optimise those $r_n$\\,s connected in $\\mathscr{N}$ simultaneously.\nSince there are only vertical interdependencies in our model, the optimisation can be done independently for each onset cluster.\nWith $J$ notes in an onset cluster, the set of candidate note values has size $10^J$.\nTypically $J\\leq6$ for piano scores and the global search can be done directly.\nOccasionally, however, $J$ can be ten or more and the computation time can be too large.\nTo reduce the size of search space in this case, cutoffs are placed on the order of IONVs when $J>6$ in our implementation: instead of the first ten IONVs, we use the first $(14-J)$ IONVs for $6 < J \\leq 10$ and two IONVs for $J > 10$.\nAlthough with this approximation we lose a certain proportion of possible solutions, we know that this proportion is small from the small probability of $r$ having higher IONVs in Fig.~\\ref{fig:DistrIONVClass}(b).\n\nOur implementation of the MRF model and the metrical HMM for onset rhythm transcription and tempo estimation is available \\cite{Webpage}.\nA tempo estimation algorithm based on a Kalman smoother is also provided for applying our method to results of other onset rhythm transcriptions that do not include tempo information as output.\n\n\n\\section{Evaluation}\\label{sec:Evaluation}\n\n\\subsection{Evaluation Measures}\\label{sec:Measure}\n\nWe first define evaluation measures used in our study.\nFor each note $n=1,\\ldots,N$, let $r^{\\rm c}_n$ and $r^{\\rm e}_n$ be the correct and estimated note values.\nThen the {\\it error rate} ${\\cal E}$ is defined as\n\\begin{equation}\\label{eq:ErrorRate}\n{\\cal E}=\\frac{1}{N}\\sum_{n=1}^N\\mathbb{I}(r^{\\rm e}_n\\neq r^{\\rm c}_n)\n\\end{equation}\nwhere $\\mathbb{I}({\\cal C})$ is 1 if condition ${\\cal C}$ is true and 0 otherwise.\nThis measure does not take into account how close the estimation is to the correct value when they are not exactly equal.\nAlternatively one can consider the averaged `distance' between the estimated and correct note values.\nAs such a measure we define the following {\\it scale error} ${\\cal S}$:\n\\begin{equation}\\label{eq:NoteWiseMeasure}\n{\\cal S}={\\rm exp}\\bigg[\\frac{1}{N}\\sum_n|{\\rm ln}(r^{\\rm e}_n\/r^{\\rm c}_n)|\\bigg].\n\\end{equation}\nThe difference and average is defined in the logarithmic domain to avoid bias for larger note values.\n${\\cal S}$ is unity if all note values are correctly estimated, and for example, ${\\cal S}=2$ if all estimations are doubled or halved from the correct values.\n\nBecause of the ambiguity of defining the beat unit, score times estimated by rhythm transcription methods often have doubled, halved or other scaled values \\cite{Nakamura2017,Cemgil2000B}, which should not be treated as complete errors.\nTo handle such scaling ambiguity, we normalise note values with the first IONV as\n\\begin{align}\nr'^{\\rm e}_n=r^{\\rm e}_n\/{\\rm IONV}^{\\rm e}(n,1),\n\\\\\nr'^{\\rm c}_n=r^{\\rm c}_n\/{\\rm IONV}^{\\rm c}(n,1)\n\\end{align}\nwhere ${\\rm IONV}^{\\rm e}(n,1)$ and ${\\rm IONV}^{\\rm c}(n,1)$ is the first IONV defined for the estimated and correct score, respectively.\nScale-invariant evaluation measures can be obtained by applying Eqs.~(\\ref{eq:ErrorRate}) and (\\ref{eq:NoteWiseMeasure}) for $r'^{\\rm e}_n$ and $r'^{\\rm c}_n$.\n\n\\subsection{Comparative Evaluations}\\label{sec:Comparisons}\n\nIn this section, we evaluate the proposed method, a previously studied method \\cite{Temperley2009} and a simple model discussed in Sec.~\\ref{sec:Observation} on our data set and compare them in terms of the accuracy of note value recognition.\n\n\\subsubsection{Setup}\n\n\\begin{figure}[t]\n\\begin{center}\n\\subfigure\n{\\includegraphics[clip,width=0.95\\columnwidth]{fig_ErrorRate.pdf}}\n\\\\\n\\subfigure\n{\\includegraphics[clip,width=0.95\\columnwidth]{fig_ScaleError.pdf}}\n\\end{center}\n\\vspace{-3mm}\n\\caption{Piece-wise average error rates and scale errors of note value recognition. Each red cross corresponds to one performance. The circle indicates the average (AVE) and the blue box indicates the range from the first to third quartiles, and STD and STE indicate the standard deviation and the standard error.}\n\\label{fig:ErrorRate}\n\\vspace{-3mm}\n\\end{figure}\nTo study the contribution of the component models of our MRF model, we evaluated the full model, a model without the interdependence model ($\\beta_2=0$), a model without the performance model ($\\beta_{31}=\\beta_{32}=0$) and an MRF model with a context model having no (or a trivial) context tree, all applied to the result of onset rhythm transcription by the metrical HMM.\nFor the metrical HMM, we use the parameter values taken from a previous study \\cite{Nakamura2017}.\nThese parameters were learned with the same score data and different performance data.\n\nIn addition, we evaluated a method based on a simple prior distribution on note values (Fig.~\\ref{fig:DistrIONVClass}(a)) combined with an output probability $P(d_n;r_n,v_n)$ in Eq.~(\\ref{eq:PerfmModel}), which uses no information of onset score times.\nFor comparison, we evaluated the Melisma Analyzer (version 2) \\cite{Temperley2009}, which is to our knowledge the only major method that can estimate onset and offset score times, and we also applied post-processing by the proposed method on the onset score times obtained by the Melisma Analyzer.\nThe used data is described in Sec.~\\ref{sec:Learning}.\n\n\\subsubsection{Results}\n\nThe piece-wise average error rates and scale errors are shown in Fig.~\\ref{fig:ErrorRate} where the mean (AVE) over all pieces and the standard error for the mean (corresponding to $1\\sigma$ deviation in the $t$-test) are also given.\nOut of the 180 performances, only 115 performances were properly processed by the Melisma Analyzer and are depicted in the figure.\nIn addition, 30.0\\% of the note values estimated by the method were zero and scale errors were calculated without these values.\nOne can see that the Melisma Analyzer and the simple model without using the onset score time information have high error rates and the proposed methods clearly outperformed them.\n\nThe distributions of note-wise scale errors $r'^{\\rm e}\/r'^{\\rm c}$ for incorrect estimations ($r'^{\\rm e}\/r'^{\\rm c}\\neq1$) in Fig.~\\ref{fig:NotewiseScaleError} show that the Melisma Analyzer (simple model) more often estimates note values shorter (longer) than the correct ones.\nFor the simple model, this is because it mostly relies on, other than a relatively weak prior distribution in Fig.~\\ref{fig:DistrIONVClass}(a), the distribution of key-holding durations in Fig.~\\ref{fig:Distribution}(a), which has the highest peak position lower than its mean.\nFor the Melisma Analyzer, the short and zero note values arise because the method quantises the onset and (key-release) offset times into analysis frames of 50 ms.\nWhereas the comparison is not fair in that the Melisma Analyzer can potentially identify grace notes with zero note values, which our data did not contain and our method cannot recognise, the rate (30.0\\%) is considerably higher than their typical frequency in piano scores.\n\n\\begin{figure}[t]\n\\begin{center}\n\\includegraphics[clip,width=0.85\\columnwidth]{fig_HistScErr.pdf}\n\\end{center}\n\\vspace{-3mm}\n\\caption{Distributions of note-wise scale errors $r'^{\\rm e}\/r'^{\\rm c}$ for notes with $r'^{\\rm e}\/r'^{\\rm c}\\neq1$.}\n\\label{fig:NotewiseScaleError}\n\\end{figure}\nAmong the different conditions for the proposed method, the full model had the best accuracy and the case with no context tree had significantly worse results, showing a clear effect of the context model.\nCompared to the full model, the average error rate for the model without the performance model was worse but within $1\\sigma$ deviation and the average scale error was significantly worse, indicating that the performance model has an effect in approximating the estimated note values to the correct ones.\nOn the other hand, results without the interdependence model were slightly worse but almost the same as the full model, which is because of the small $\\hat{\\beta}_2$.\nThe last result indicates that one can remove the interdependence model without much increase of estimation errors, which simplifies the inference algorithm as the distributions of note values become independent for each note.\n\n\\subsection{Examining the Proposed Model}\\label{sec:Examinations}\n\nHere we examine the proposed model in greater depth.\n\n\\subsubsection{Error Analyses}\n\n\\begin{figure}[t]\n\\begin{center}\n\\includegraphics[clip,width=0.9\\columnwidth]{fig_HistEstIONVClass.pdf}\n\\end{center}\n\\vspace{-3mm}\n\\caption{Distributions of true and estimated note values relative to IONVs.}\n\\label{fig:ErrorAnalysis}\n\\end{figure}\nTo examine the effect of the component models, let us look at the distribution of the estimated note values in the space of IONVs (Fig.~\\ref{fig:ErrorAnalysis}).\nNote that the distribution for the ground truth is essentially the same as that in Fig.~\\ref{fig:DistrIONVClass}(b) but slightly different because the data is different and the onset clusters here are defined with the result of onset rhythm transcription by the metrical HMM.\n\nFirstly, the model without a context tree assigns the first IONV to note values with a high probability ($>98\\%$), indicating that estimated results by the model are almost the same as for the one-voice representation in Fig.~\\ref{fig:ExampleScore}(b).\nThis is consistent with the results in Fig.~\\ref{fig:NotewiseScaleError} that this model tends to estimate note values shorter than the correct values.\nSecondly, one can notice that the model without the performance model has a higher probability for the first IONV and smaller probabilities for most of the later IONVs compared with the full model.\nThis suggests that the performance model uses the information of actual durations to correct (or better approximate) the estimated note values more frequently to larger values, leading to decreased scale errors.\nFinally, the proportion of errors corresponding to note values that are larger than ${\\rm IONV}(10)$ is about 0.8\\%, indicating that the effect of enlarging the search space of note values by including higher IONVs is limited.\n\n\\subsubsection{Influence of the context-tree size and weights}\n\n\\begin{figure}[t]\n\\begin{center}\n\\includegraphics[clip,width=0.97\\columnwidth]{fig_ER_VarTreeSize.pdf}\n\\end{center}\n\\vspace{-5mm}\n\\caption{Average error rates and scale errors for various sizes of the context tree. The figure close to each point indicates the number of leaves. 132 is the optimal number predicted by the MDL criterion. All data points have statistical errors of order 1\\% for error rate and order 0.01 for scale error.}\n\\label{fig:ERVarTreeSize}\n\\vspace{-3mm}\n\\end{figure}\nFig.~\\ref{fig:ERVarTreeSize} shows the average error rates and scale errors for various sizes of the context tree.\nThe case with only one leaf (not shown in the figure) is the same as the case without a context tree explained above.\nThe errors rapidly decreased as the tree size increased for small numbers of leaves and but changed only slightly above 50 leaves.\nThere was a gap between the error rates for the cases with 50 and 75 leaves, which we confirmed is caused by a discontinuity of results for 52 and 53 leaves.\nWe have not succeeded in finding a good explanation for this gap.\nFar above the predicted value (132 leaves) by the MDL criterion, the errors tended to increase slightly, confirming that it is close to the optimal choice.\n \n\\begin{figure}[t]\n\\begin{center}\n\\includegraphics[clip,width=0.97\\columnwidth]{fig_ER_VarBetas.pdf}\n\\end{center}\n\\vspace{-4mm}\n\\caption{Average error rates and scale errors with (a) varying $\\beta_1$ and $\\beta_2$ and (b) varying $\\beta_{31}$ and $\\beta_{32}$. The $\\beta$\\,s are scaled in logarithmically equally spaced scaling factors, which are partly indicated by numbers, and the centre values (indicated by `$1$') are given in Eqs.~(\\ref{eq:UsedBeta12}) and (\\ref{eq:UsedBeta3132}). All data points have statistical errors of order 1\\% for error rate and order 0.01 for scale error.}\n\\label{fig:InfluenceOfBeta}\n\\vspace{2mm}\n\\end{figure}\nFig.~\\ref{fig:InfluenceOfBeta} shows the average error rate and scale error when varying the weights from the values in Eqs.~(\\ref{eq:UsedBeta12}) and (\\ref{eq:UsedBeta3132}).\nThe context tree had 132 leaves.\nFirst, variations by increasing and decreasing the weights by 50\\% are within $1\\sigma$ statistical significance, showing that the error rates are not very sensitive to these parameters.\nSecond, the values $\\hat{\\beta}_1$ and $\\hat{\\beta}_2$, which were optimised based on ML using the score data, are found to be optimal with respect to the error rate.\nFinally, the similar shapes of the curves when fixing $\\beta_1\/\\beta_2$ and fixing $\\beta_{31}\/\\beta_{32}$ show that their relative values influences the results more than their absolute values in the examined region.\nThe results together with the large-variance nature of the distributions of durations in Fig.~\\ref{fig:Distribution} suggest that it is likely that more elaborate fitting functions for the performance model would not improve the results significantly and also that the sub-optimisation procedure for $\\beta$\\,s described in Sec.~\\ref{sec:Optimisation} did not deteriorate the results much.\n\n\\subsubsection{Influence of the parameters of the performance model}\n\\label{sec:InfluenceOfPerfmModel}\n\n\\begin{table}[t]\n\\begin{center}\n{\\tabcolsep = 3pt\n\\begin{tabular}{cccc}\\toprule\nKey-holding $g$ & Damper-lifting $\\bar{g}$ & Error rate ${\\cal E}$ (\\%) & Scale error ${\\cal S}$\\\\\n\\midrule\nBest fit & Best fit & $25.66$ & $1.225$ \\\\\nBest fit & Trial 1 & $25.67$ & $1.225$ \\\\\nBest fit & Trial 2 & $25.67$ & $1.225$ \\\\\nTrial 1 & Best fit & $25.97$ & $1.225$ \\\\\nTrial 1 & Trial 1 & $25.98$ & $1.225$ \\\\\nTrial 1 & Trial 2 & $25.97$ & $1.225$ \\\\\nTrial 2 & Best fit & $25.46$ & $1.225$ \\\\\nTrial 2 & Trial 1 & $25.46$ & $1.225$ \\\\\nTrial 2 & Trial 2 & $25.46$ & $1.225$ \\\\\n\\bottomrule\n\\end{tabular}\n}\n\\end{center}\n\\caption{Average error rates and scale errors for different distributions for the performance model. The best fit and trial distributions are shown in Fig.~\\ref{fig:VarPerfmModel}.}\n\\label{tab:VarPerfmModel}\n\\vspace{-6mm}\n\\end{table}\nTo examine the influence of the parameter values of the performance model in Eqs.~(\\ref{eq:g}) and (\\ref{eq:gbar}), we run the proposed model for each of three distributions shown in Figs.~\\ref{fig:VarPerfmModel}(a) and \\ref{fig:VarPerfmModel}(b).\nThe other parameters were set to the optimal values and the size of the context tree was $132$.\nResults in Table \\ref{tab:VarPerfmModel} show that despite the differences among distributions, the average scale error was almost constant and the variation of the average error rate is also smaller than the standard error.\nMore precisely, the influence of the choice of parameters for $\\bar{g}$ is negligible, which can be explained by the small value of $\\beta_{32}$.\nThis confirms that the influence of the performance model is small and there is little effect of overfitting in using the test data for learning.\n\n\\subsubsection{Example Result}\n\n\\begin{figure}[t]\n\\begin{center}\n\\includegraphics[clip,width=1.\\columnwidth]{fig_res_132-3.pdf}\n\\end{center}\n\\vspace{-5mm}\n\\caption{Example result of rhythm transcription by the metrical HMM and the proposed MRF model (Beethoven: Waldstein sonata 1st mov.). Voice, staff and time signature are added manually to the estimated result for the purpose of this illustration.}\n\\label{fig:ExResult}\n\\vspace{-3mm}\n\\end{figure}\nLet us discuss an example\\footnote{Sound files are available at the accompanying web page \\cite{Webpage}.} in Fig.~\\ref{fig:ExResult}, which has a typical texture of piano music with the left-hand part having harmonising chords and the right-hand part having melodic notes, both of which have multiple voices inside.\nBy comparing the performed durations to the score, we can see that overall the damper-lifting durations are closer to the score-indicated durations for the left-hand notes and the key-holding durations are closer for the right-hand notes.\nThis is because pianists tend to lift the pedal when harmonising chords change.\nThis example shows that the two types of durations provide complementary information and one should not rely on one of them.\nOn the other hand, for most notes, the offset score time matches to the onset score time of a succeeding note with a close pitch, which is what our context model describes.\n\nThe result by the MRF model shows that the model uses the score and performance models complementarily to find the optimal estimation.\nThe correctly estimated half notes (as ${\\rm IONV}(6)$), A4 in the first bar and E5 in the second bar, have a close pitch in the next onset cluster and the incorrect estimates as ${\\rm IONV}(1)$ are avoided by using the duration (and perhaps because of the existence of very close pitches at the sixth next onset clusters).\nOn the other hand, the quarter-note F\\#4 and D\\#4 in the left-hand part in the second bar could not be correctly estimated probably because the voice makes a big leap here, closer notes in the right-hand part succeed them and the key-holding durations are short.\n\n\\section{Conclusion and Discussion}\n\nWe discussed note value recognition of polyphonic piano music based on an MRF model combining the score model and the performance model.\nAs suggested in the discussion in Sec.~\\ref{sec:Observation} and confirmed by evaluation results, performed durations can deviate greatly from the score-indicated lengths and thus the performance model aline has little predictive ability.\nThe construction of the score model is then the key to solve the problem.\nWe formulated a context-tree model that can learn highly predictive distributions of note values from data, using onset score times and the pitch context.\nIt was demonstrated that this score model brings significant improvements on the recognition accuracy.\n\nRefinement of the score model is possible in a number of ways.\nUsing more features for the context-tree model could improve the results.\nUsing other feature-based model learning schemes such as deep neural networks are similarly possible.\nThe refinement and extension of the search space for note values is another issue since the set of the first ten IONVs used in this study loses a certain proportion of solutions.\nThe result that the context-tree model learned to capture the voice structure suggests that building a model with explicit voice structure is also interesting for creating generative models to reduce reliance on arbitrarily chosen features.\n\nRemaining issues to obtain musical scores in a fully automatic way include the assignment of voice and staff to the transcribed notes.\nVoice separation methods and staff estimation methods exist (e.g.\\ \\cite{Cambouropoulos2008,McLeod2016,HandSeparation}) and the information of transcribed note values can be useful to identify chordal notes within each voice.\nAnother issue is the recognition of time signature.\nUsing multiple metrical HMMs learned with score data for each metres is one possibility and we could also apply other metre detection methods (e.g.\\ \\cite{Haas2016}) to the transcribed result.\n\nTo apply this work, the construction of a complete polyphonic music transcription system from audio signals to musical scores is attractive.\nThe framework developed in this study can be combined with existing multi-pitch analysers \\cite{Vincent2010,OHanlon2014,Yoshii2015,Sigtia2016} for this purpose.\nIt is worth mentioning that the performance model should be trained on piano rolls obtained with these methods since the distribution of durations would differ from that of recorded MIDI signals.\nExtension of the model to correct audio transcription errors such as note insertions and deletions would also be of great importance.\n\n\\section*{Acknowledgement}\nWe are grateful to David Temperley for providing source code for the Melisma Analyzer.\nE.~Nakamura would like to thank Shinji Takaki for useful discussions about context-tree clustering.\nThis work is in part supported by JSPS KAKENHI Nos.\\ 24220006, 26280089, 26700020, 15K16054, 16H01744 and 16J05486, JST ACCEL No.\\ JPMJAC1602, and the long-term overseas research fund by the Telecommunications Advancement Foundation.\n\n\n\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section{Introduction}\n\n\nRecently \\emph{visual attributes} have raised significant interest in the community~\\cite{farhadi2009describing,patterson2012sun,bourdev2011describing,kumar2011describable}. A ``visual attribute'' is a property of an object that can be measured visually and has a semantic connotation, such as the \\emph{shape} of a hat or the \\emph{color} of a ball. Attributes allow characterizing objects in far greater detail than a category label and are therefore the key to several advanced applications, including understanding complex queries in {\\em semantic search}, learning about objects from {\\em textual description}, and accounting for the content of images in great detail. Textural properties have an important role in object descriptions, particularly for those objects that are best qualified by a pattern, such as a shirt or the wing of bird or a butterfly as illustrated in Fig.~\\ref{fig:examples}. Nevertheless, so far the attributes of textures have been investigated only tangentially. In this paper we address the question of whether there exists a ``universal'' set of attributes that can describe a wide range of texture patterns, whether these can be reliably estimated from images, and for what tasks they are useful.\n\n\\begin{figure}[!t]\n\\centering\n\\includegraphics[width=0.99\\linewidth]{fig\/figure1.pdf}\n\\caption{\\label{fig:examples} Both the man-made and the natural world are an abundant source of richly textured objects. The textures of objects shown above can be described (in no particular order) as dotted, striped, chequered, cracked, swirly, honeycombed, and scaly.\nWe aim at identifying these attributes automatically and generating descriptions based on them.}\n\\end{figure}\n\n\\begin{figure*}[!t]\n\\raggedright\n\\foreach \\n in {banded, blotchy,braided,bubbly, bumpy,chequered, cobwebbed, cracked, crosshatched, crystalline, dotted, fibrous, flecked, freckled, frilly,gauzy,grid, grooved, honeycombed, interlaced, knitted, lacelike, lined, marbled, matted, meshed, paisley, perforated, pitted, pleated, polka-dotted, porous, potholed, scaly, smeared, spiralled, sprinkled, stained, stratified, striped, studded, swirly, veined, waffled, woven, wrinkled, zigzagged}\n{\\renewcommand{\\baselinestretch}{0.7}\\normalsize\n\\begin{overpic}[width=0.079\\textwidth,trim=0 0 -1pt -4pt]{fig\/figure2\/\\n_0002}\n\\put(0,0){\\includegraphics[trim=0 0 130pt -4pt,clip,width=0.039\\textwidth]{fig\/figure2\/\\n_0001}} \n\\put(50,0){\\linethickness{0.5pt}\\color{white}\\line(0,1){100}} \n\\put(2,78){\\scriptsize\\colorbox{white}{\\strut\\n}}\n\\end{overpic} }\n\\caption{The 47 texture words in the \\textbf{describable texture dataset} introduced in this paper. Two examples of each attribute are shown to illustrate the significant amount of variability in the data.}\\label{f:words}\n\\end{figure*}\n\nThe study of perceptual attributes of textures has a long history starting from pre-attentive aspects and grouping~\\cite{julesz81textons}, to coarse high-level attributes~\\cite{tamura78textural, amadasun89textural,bajcsy73computer}, to some recent work aimed at discovering such attributes by automatically mining descriptions of images from the Internet~\\cite{berg2010automatic, ferrari2008learning}. However, the texture attributes investigated so far are rather few or too generic for a detailed description most ``real world'' patterns. Our work is motivated by the one of Bhusan et al.~\\cite{bhushan1997texture} who studied the relationship between commonly used English words and the perceptual properties of textures, identifying a set of words sufficient to describing a wide variety of texture patterns. While they study the psychological aspects of texture perception, the focus of this paper is the challenge of estimating such properties from images automatically.\n\n\n\n\nOur {\\bf first contribution} is to select a subset of 47 \\emph{describable texture attributes}, based on the work of Bhusan et al., that capture a wide variety of visual properties of textures and to introduce a corresponding \\emph{describable texture dataset} consisting of 5,640 texture images \\emph{jointly} annotated with the 47 attributes (Sect.~\\ref{s:dtd}). In an effort to support directly real world applications, and inspired by datasets such as \\emph{ImageNet}~\\cite{deng09imagenet} and the \\emph{Flickr Material Dataset} (FMD)~\\cite{sharan09material}, our images are captured ``in the wild'' by downloading them from the Internet rather than collecting them in a laboratory. We also address the practical issue of crowd-sourcing this large set of joint annotations efficiently accounting for the co-occurrence statistics of attributes, the appearance of the textures, and the reliability of annotators (Sect.~\\ref{s:design}).\n\n\n\nOur {\\bf second contribution} is to identify a {\\em gold standard texture representation} that achieves optimal recognition of the describable texture attributes in challenging real-world conditions. Texture classification has been widely studied in the context of recognizing materials supported by datasets such as~\\emph{CUReT}~\\cite{dana99reflectance}, \\emph{UIUC}~\\cite{lazebnik05sparse}, \\emph{UMD}~\\cite{xu09viewpoint}, \\emph{Outex}~\\citep{ojala2002multiresolution}, \\emph{Drexel Texture Database}~\\cite{oxholm2012texture}, and \\emph{KTH-TIPS}~\\citep{caputo05class,hayman04learning}. These datasets address material recognition under variable occlusion, viewpoint, and illumination and have motivated the creation of a large number of specialized texture representations that are invariant or robust to these factors~\\cite{varma2005statistical,ojala2002multiresolution,varma2003texture,leung2001representing}. In contrast, generic object recognition features such as SIFT was shown to work the best for material recognition in FMD, which, like DTD, was collected ``in the wild''. Our findings are similar, but we also find that Fisher vectors~\\cite{perronnin07fisher} computed on SIFT features and certain color features can significantly boost performance. Surprisingly, these descriptors outperform specialized state-of-the-art texture representations not only in recognizing our describable attributes, but also in a variety of datasets for material recognition, achieving an accuracy of 63.3\\% on FMD and 67.5\\% on KTH-TIPS2-b dataset (Sect.~\\ref{s:representation},~\\ref{s:exp1}).\n\nOur {\\bf third contribution} consists in several \\emph{applications} of the proposed describable attributes. These can serve a complimentary role for recognition and description in domains where the material is not-important or is known ahead of time, such as fabrics or wallpapers. However, can these attributes improve other texture analysis tasks such as material recognition? We answer this question in the affirmative in a series of experiments on the challenging FMD and KTH datasets. We show that estimates of these properties when used a features can boost recognition rates even more for material classification achieving an accuracy of 53.1\\% on FMD and 64.6\\% on KTH when used alone as a 47 dimensional feature, and 65.4\\% on FMD and 74.6\\% on KTH when combined with SIFT and simple color descriptors (Sect.~\\ref{s:exp2}). \\emph{These represent more than an absolute gain of 8\\% in accuracy over previous state of the art. Our 47 dimensional feature contributed with 2.2 to 7\\% to the gain}. Furthermore, these attribute are easy to describe by design, hence they can serve as intuitive dimensions to explore large collections of texture patterns -- for e.g., product catalogs (wallpapers or bedding sets) or material datasets. We present several such visualizations in the paper (Sect.~\\ref{s:exp3}). \n\n\\section{The describable texture dataset}\\label{s:dtd}\n\nThis section introduces the \\emph{Describable Textures Dataset} (DTD), a collection of real-world texture images annotated with one or more adjectives selected in a vocabulary of 47 English words. These adjectives, or \\emph{describable texture attributes}, are illustrated in Fig.~\\ref{f:words} and include words such as {\\em banded}, \\emph{cobwebbed}, \\emph{freckled}, \\emph{knitted}, and \\emph{zigzagged}.\n\nDTD investigates the problem of {\\bf texture description}, intended as the recognition of describable texture attributes. This problem differs from the one of {\\em material recognition} considered in existing datasets such as CUReT, KTH, and FMD. While describable attributes are correlated with materials, attributes do not imply materials (\\eg \\emph{veined} may equally apply to leaves or marble) and materials do not imply attributes (not all marbles are \\emph{veined}). Describable attributes can be {\\em combined} to create rich descriptions (Fig.~\\ref{f:co-occurence}; marble can be \\emph{veined}, \\emph{stratified} and \\emph{cracked} at the same time), whereas a typical assumption is that textures are made of a single material. Describable attributes are \\emph{subjective} properties that depend on the imaged object as well as on human judgments, whereas materials are objective. In short, attributes capture properties of textures {\\em beyond} materials, supporting human-centric tasks where describing textures is important. At the same time, they will be shown to be helpful in material recognition as well (Sect.~\\ref{s:high} and~\\ref{s:exp2}).\n\nDTD contains {\\bf textures in the wild}, \\ie texture images extracted from the web rather than begin captured or generated in a controlled setting. Textures fill the images, so we can study the problem of texture description independently of texture segmentation. With 5,640 such images, this dataset aims at supporting real-world applications were the recognition of texture properties is a key component. Collecting images from the Internet is a common approach in categorization and object recognition, and was adopted in material recognition in FMD. This choice trades-off the systematic sampling of illumination and viewpoint variations existing in datasets such as CUReT, KTH-TIPS, Outex, and Drexel datasets for a representation of real-world variations, shortening the gap with applications. Furthermore, the invariance of describable attributes is not an intrinsic property as for materials, but it reflects invariance in the human judgments, which should be captured empirically.\n\nDTD is designed as a {\\bf public benchmark}, following the standard practice of providing 10 preset splits into equally-sized training, validation and test subsets for easier algorithm comparison (these splits are used in all the experiments in the paper). DTD will be made publicly available on the web at [annonymized], along with standardized evaluation, as well as code reproducing the results in Sect.~\\ref{s:experiments}.\n\n\\paragraph{Related work.} Apart from material datasets, there have been numerous attempts at collecting attributes of textures at a smaller scale, or in controlled settings. Our work is related to the work of~\\cite{matthews13enriching}, where they analyzed images in the Outex dataset~\\citep{ojala2002multiresolution} using a subset of the attributes we consider. Their attributes were demonstrated to perform better than several low-level descriptors, but these were trained and evaluated on the \\emph{same} dataset. Hence it is not clear if their learned attributes generalize well to other settings. In contrast, we show that: (i) our texture attributes trained on DTD outperform their semantic attributes on Outex and (ii) they can significantly boost performance on a number of other material and texture benchmarks (Sect.~\\ref{s:exp2}).\n\n\n\\subsection{Dataset design and collection}\\label{s:design}\n\nThis section discusses how DTD was designed and collected, including: selecting the 47 attributes, finding at least 120 representative images for each attribute, collecting a full set of multiple attribute labels for each image in the dataset, and addressing annotation noise.\n\n\\paragraph{Selecting the describable attributes.} Psychological experiments suggest that, while there are a few hundred words that people commonly use to describe textures, this vocabulary is redundant and can be reduced to a much smaller number of representative words. Our starting point is the list of $98$ words identified by Bhusan, Rao and Lohse~\\cite{bhushan1997texture}. Their seminal work aimed to achieve for texture recognition the same that color words have achieved for describing color spaces~\\cite{berlin1991basic}. However, their work mainly focuses on the cognitive aspects of texture perception, including perceptual similarity and the identification of directions of perceptual texture variability. Since we are interested in the visual aspects of texture, we ignored words such as ``corrugated\" that are more related to surface shape properties, and words such as ``messy\" that do not necessarily correspond to visual features. After this screening phase we analyzed the remaining words and merged similar ones such as ``coiled\", ``spiraled\" and ``corkscrewed\" into a single term. This resulted in a set of $47$ words, illustrated in Fig.~\\ref{f:words}.\n\n\\paragraph{Bootstrapping the key images.} Given the 47 attributes, the next step was collecting a sufficient number (120) of example images representative of each attribute. A very large initial pool of about a hundred-thousands images was downloaded from Google and Flickr by entering the attributes and related terms as search queries. Then Amazon Mechanical Turk (AMT) was used to remove low resolution, poor quality, watermarked images, or images that were not almost entirely filled with a texture. Next, detailed annotation instructions were created for each of the 47 attributes, including a dictionary definition of each concept and examples of correct and incorrect matches. Votes from three AMT annotators were collected for the candidate images of each attribute and a shortlist of about $200$ highly-voted images was further manually checked by the authors to eliminate residual errors. The result was a selection of $120$ {\\em key representative images} for each attribute.\n\n\\begin{figure*}[t]\n\\includegraphics[width=0.70\\textwidth]{fig\/figure3a}\\hfill\n\\raisebox{0.85in}{\n\\setlength{\\tabcolsep}{3pt}\n\\begin{tabular}{cc}\n\\raisebox{0.8in}{$q$} & {\\setlength\\fboxsep{0pt}\\fbox{\\includegraphics[width=0.25\\textwidth]{fig\/figure3b.jpg}}}\\\\\n& $q'$ \\\\\n\\end{tabular}\n}\n\\caption{{\\bf Quality of joint sequential annotations.} Each bar shows the average number of occurrences of a given attribute in a DTD image. The horizontal dashed line corresponds to a frequency of 1\/47, the minimum given the design of DTD (Sect.~\\ref{s:design}). The black portion of each bar is the amount of attributes discovered by the sequential procedure, using only 10 annotations per image (about one fifth of the effort required for exhaustive annotation). The orange portion shows the additional recall obtained by integrating CV in the process. {\\bf Right: co-occurrence of attributes.} The matrix shows the joint probability $p(q,q')$ of two attributes occurring together (rows and columns are sorted in the same way as the left image).}\\label{f:ja}\\label{f:co-occurence}\n\\end{figure*}\n\n\\paragraph{Sequential join annotations.} So far only the key attribute of each texture image is known while any of the remaining 46 attributes may apply as well. Exhaustively collecting annotations for 46 attributes and 5,640 texture images was found to be too expensive. To reduce this cost we propose to exploiting the correlation and sparsity of the attribute occurrences (Fig.~\\ref{f:co-occurence}). For each attribute $q$, twelve key images are annotated exhaustively and used to estimate the probability $p(q'|q)$ that {\\em another} attribute $q'$ could co-exist with $q$. Then for the remaining key images of attribute $q$, only annotations for attributes $q'$ with non negligible probability -- in practice 4 or 5 -- are collected, assuming that the attributes would not apply. This procedure occasionally misses attribute annotations; Fig.~\\ref{f:ja} evaluates attribute recall by 12-fold cross-validation on the 12 exhaustive annotations for a fixed budget of collecting 10 annotations per image (instead of 47).\n\nA further refinement is to suggest which attributes $q'$ to annotated not just based on $q$, but also based on the individual appearance of an image $\\ell_i$. This was done by using the attribute classifier learned in Sect.~\\ref{s:experiments}; after Platt's calibration~\\cite{platt00probabilistic} on an held-out test set, the classifier score $c_{q'}(\\ell_i) \\in \\mathbb{R}$ is transformed in a probability\n$p(q'|\\ell_i) = \\sigma(c_{q'}(\\ell))$ where $\\sigma(z) = 1 \/ (1 + e^{-z})$ is the sigmoid function. By construction, Platt's calibration reflects the prior probability $p(q') \\approx p_0 = 1\/47$ of $q'$ on the validation set. To reflect the probability $p(q'|q)$ instead, the score is adjusted as\n\\[\n p(q'|\\ell_i, q) \\propto\n \\sigma(c_{q'}(\\ell_i)) \\times\n \\frac{p(q'|q)} {1 - p(q'|q)} \\times\n \\frac{1 - p_0}{p_0}\n\\]\nand used to find which attributes to annotated for each image. As shown in Fig.~\\ref{f:ja}, for a fixed annotation budged this method increases attribute recall. Overall, with roughly 10 annotations per images it was possible to recover of all the attributes for at least 75\\% of the images, and miss one out of four (on average) for another 20\\% while keeping the annotation cost to a reasonable level.\n\n\\paragraph{Handling noisy annotations.} So far it was assumed that annotators are perfect: deterministic and noise-free. This is not the case, in part due to the intrinsic subjectivity of describable texture attributes, and in part due to distracted, adversarial, or unqualified annotators. As commonly done, we address this problem by collecting the same annotation multiple times (five) using different annotators, and forming a consensus.\n\nBeyond simple voting, we found that the method of~\\cite{welinder10online} can effectively remove or down-weigh bad annotators improving agreement. This method models each annotator $\\alpha_j$ as a classifier with a given bias and error rate. Then, given a collection $\\hat{a}_{qij}\\in\\{0,1\\}$ of binary annotations for attribute $q$, image $i$, and annotator $j$, it tries to estimate simultaneously the ground truth labels $a_{qi}$ and the quality $\\alpha_j$ of the individual annotators. The method is appealing as several quantities are easily interpretable. For example, the prior $p(\\alpha_j)$ on annotators encodes how frequently we expect to find good and bad annotators (\\eg we found that 0.5\\% of them labeled images randomly). A major difference compared to the scenario considered in~\\cite{welinder10online} is that, in our case, the key attribute of each image is already known. By incorporating this as additional prior, the method can use the key attributes to implicitly benchmark and calibrate annotators. The final set of annotations $\\{a_{qi}\\}$ is obtained by thresholding the (approximated) posterior marginal $p(a_{qi}|\\{\\hat a_{qij}\\})$ to 60\\%, similar to choosing three out of five votes in the basic voting scheme, computed using variational inference. In general, we found most probabilities to be very close to 100\\% or 0\\%, suggesting that there is little residual noise in the process. We also inspected the top 30 images of each attribute based on simple voting and this posterior marginals and found the ranking to be significantly improved.\n\n\\section{Texture representations}\\label{s:representation}\n\nGiven the DTD dataset developed in Sect.~\\ref{s:dtd}, this section moves on to the problem of designing a system that can automatically recognize the attributes of textures. Given a texture image $\\ell$ the first step is to compute a {\\em representation} $\\phi(\\ell) \\in \\mathbb{R}^d$ of the image; the second step is to use a classifier such as a Support Vector Machine (SVM) $\\langle \\mathbf{w}, \\phi(\\ell)\\rangle$ to score how strongly the $\\ell$ matches a given perceptual category. We propose two such representations: a gold-standard low-level texture descriptor based on the improved Fisher Vector (Sect.~\\ref{s:low}) and a mid-level texture descriptor consisting of the describable attributes themselves (Sect.~\\ref{s:high}). The details of the classifiers are discussed in Sect.~\\ref{s:experiments}.\n\n\\subsection{Improved Fisher vectors}\\label{s:low}\n\nThis section introduces our gold-standard low-level texture representation, the {\\em Improved Fisher Vector} (IFV) of and relates it to existing texture descriptors. We port IFV from the object recognition literature~\\cite{perronnin10improving} and we show that it substantially outperforms specialized texture representations (Sect.~\\ref{s:experiments}).\n\nGiven an image $\\ell$, the {\\em Fisher Vector} (FV) formulation of~\\cite{perronnin07fisher} starts by extracting local SIFT~\\cite{lowe99object} descriptors $\\{\\mathbf{d}_1,\\dots,\\mathbf{d}_n\\}$ densely and at multiple scales. It then soft-quantizes the descriptors by using a Gaussian Mixture Model (GMM) with $K$ modes, prior probabilities $\\pi_k$, mode means $\\mu_k$ and mode covariances $\\Sigma_k$. Covariance matrices are assumed to be diagonal, but local descriptors are first decorrelated and optionally dimensionality reduced by PCA. Then first and second order statistics are computed as\n\\begin{align*}\nu_{jk} &=\n{1 \\over {n \\sqrt{\\pi_k}}}\n\\sum_{i=1}^{n}\nq_{ik} \\frac{d_{ji} - \\mu_{jk}}{\\sigma_{jk}},\n\\\\\nv_{jk} &=\n{1 \\over {n \\sqrt{2 \\pi_k}}}\n\\sum_{i=1}^{n}\nq_{ik} \\left[ \\left(\\frac{d_{ji} - \\mu_{jk}}{\\sigma_{jk}}\\right)^2 - 1 \\right],\n\\end{align*}\nwhere $j$ spans descriptor dimensions and $q_{ik}$ is the posterior probability of mode $k$ given descriptor $\\mathbf{d}_i$, i.e. $q_{ik} \\propto \\exp\\left[-\\frac{1}{2} (\\mathbf{d}_i - \\mu_k)^T \\Sigma_k^{-1} (\\mathbf{d}_i - \\mu_k)\\right]$. These statistics are then stacked into a vector $(\\mathbf{u}_1, \\mathbf{v}_1, \\dots, \\mathbf{u}_K, \\mathbf{v}_K)$. In order to obtain the {\\em improved} version of the representation, the signed square root $\\sqrt{|z|} \\operatorname{sign} z$ is applied to its components and the vector is $l^2$ normalized.\n\nAt least two key ideas in IFV were pioneered in texture analysis: the idea of sum-pooling local descriptors was introduced by~\\cite{malik90preattentive}, and the idea of quantizing local descriptors to construct histogram of features was pioneered by~\\cite{leung2001representing} with their computational model of textons. However, three key aspects of the IFV representation were developed in the context of object recognition. The first one is the use of the SIFT descriptors, originally developed for object matching~\\cite{lowe99object}, that are more distinctive that local descriptors popular in texture analysis such as filter banks~\\cite{leung2001representing,varma2005statistical,geusebroek03fast}, local intensity patterns~\\cite{ojala2002multiresolution}, and patches~\\cite{varma2003texture}. The second one is replacing histogramming with the more expressive FV pooling method ~\\cite{perronnin07fisher}. And the third one is the use of the square-root kernel map~\\cite{perronnin10improving} in the improved version of the Fisher Vector.\n\nWe are not the first to use SIFT or IFV in texture recognition. For example, SIFT was used in~\\cite{sharan13recognizing}, and Fisher Vectors were used in~\\cite{sharma12local}. However, neither work tested the standard IFV formulation~\\cite{perronnin10improving}, which is well tuned for object recognition, developing instead variations specialized for texture analysis. We were therefore somewhat surprised to discover that the off-the-shelf method surpasses these approaches (Sect.~\\ref{s:exp1}).\n\n\\subsection{Describable attributes as a representation}\\label{s:high}\n\nThe main motivation for recognizing describable attributes is to support human-centric applications, enriching the vocabulary of visual properties that machines can understand. However, once extracted, these attributes may also be used as texture descriptors in their own right. As a simple incarnation of this idea, we propose to collect the response of attribute classifiers trained on DTD in a 47-dimensional feature vector $\\phi(\\ell) = (c_1(\\ell), \\dots, c_{47}(\\ell))$. Sect.~\\ref{s:experiments} shows that this very compact representation achieves excellent performance in material recognition; in particular, combined with IFV (SIFT and color) it sets the new state-of-the-art on KTH-TIPS2-b and FMD. In addition to the contribution to the best results, our proposed attributes generate meaningful descriptions of the materials from KTH-TIPS2-b (aluminium foil: wrinkled; bread: porous).\n\n\\section{Experiments}\\label{s:experiments}\n\n\\subsection{Improved Fisher Vectors for textures}\\label{s:exp1}\n\nThis section demonstrates the power of IFV as a texture representation by comparing it to established texture descriptors. Most of these representations can be broken down into two parts: computing local image descriptors $\\{\\mathbf{d}_1,\\dots,\\mathbf{d}_n\\}$ and encoding them into a global image statistics $\\phi(\\ell)$.\n\nIn IFV the {\\bf local descriptors} $\\mathbf{d}_i$ are 128-dimensional {\\em SIFT} features, capturing a spatial histogram of the local gradient orientations; here spatial bins have an extent of $6 \\times 6$ pixels and descriptors are sampled every two pixels and at scales $2^{i\/3},i=0,1,2,\\dots$. We also evaluate as local descriptors the \\emph{Leung and Malik} (LM)~\\cite{leung2001representing} (48-D) and \\emph{MR8} (8-D)~\\cite{varma2005statistical,geusebroek03fast} filter banks, the $3 \\times 3$ and $7\\times 7$ raw image patches of\\cite{varma2003texture}, and the {\\em local binary patterns} (LBP) of~\\cite{ojala2002multiresolution}.\n\n\n{\\bf Encoding} maps image descriptors $\\{\\mathbf{d}_1,\\dots,\\mathbf{d}_n\\}$ to a statistics $\\phi(\\ell) \\in \\mathbb{R}^d$ suitable for classification. Encoding can be as simple as averaging (sum-pooling) descriptors~\\cite{malik90preattentive}, although this is often preceded by a high-dimensional sparse coding step. The most common coding method is to vector quantize the descriptors using an algorithm such as $K$-means~\\cite{leung2001representing}, resulting in the so-called {\\em bag-of-visual-words} (BoVW) representation~\\cite{csurka04visual}. Variations include soft quantization by a GMM in FV (Sect.~\\ref{s:low}) or specialized quantization schemes, such as mapping LBPs to {\\em uniform patterns}~\\cite{ojala2002multiresolution} (LBP$^{u}$; we use the rotation invariant multiple-radii version of~\\cite{matthews13enriching} for comparison purposes). For LBP, we also experiment with a variant (LBP-VQ) where standard LBP$^{u2}$ is computed in $8 \\times 8$ pixel neighborhoods, and the resulting local descriptors are further vector quantized using $K$-means and pooled as this scheme performs significantly better in our experiments.\n\nFor each of the selected features, we experimented with several {\\bf SVM kernels}: linear $K(\\mathbf{x}',\\mathbf{x}'') = \\langle \\mathbf{x}', \\mathbf{x}''\\rangle$, Hellinger's $\\sum_{i=1}^d \\sqrt{x_i' x_i''}$, additive-$\\chi^2$ $\\sum_{i=1}^d {x_i' x_i''}\/(x_i'+x_i'')$, and exponential-$\\chi^2$ $\\exp\\left[ - \\lambda \\sum_{i=1}^d {(x_i' -x_i'')^2}\/(x_i'+x_i'') \\right]$ kernels sign-extended as in~\\cite{vedaldi10efficient}. In the latter case, $\\lambda$ is selected as one over the mean of the kernel matrix on the training set. The data is normalized so that $K(\\mathbf{x}',\\mathbf{x}'')=1$ as this is often found to improve performance. Learning uses a standard non-linear SVM solver and validation in order to select the parameter $C$ in the range $\\{0.1, 1, 10, 100\\}$ (the choice of $C$ was found to have little impact on the result).\n\n\\begin{table}\n\\centering\n{\\small\n\\setlength{\\tabcolsep}{3pt}\n\\begin{tabular}{l|cccc}\n & \\multicolumn{4}{|c}{{Kernel}} \\\\ \\hline\n{Local d.} & {Linear} & {Hellinger} & add-$\\chi^2$ & exp-$\\chi^2$ \\\\ \\hline\n{MR8} & 15.9 $\\pm$ 0.8 & 19.7 $\\pm$ 0.8 & 24.1 $\\pm$ 0.7 & 30.7 $\\pm$ 0.7 \\\\\n{LM} & 18.8 $\\pm$ 0.5 & 25.8 $\\pm$ 0.8 & 31.6 $\\pm$ 1.1 & 39.7 $\\pm$ 1.1 \\\\\n{Patch$_{3\\times3}$} & 14.6 $\\pm$ 0.6 & 22.3 $\\pm$ 0.7 & 26.0 $\\pm$ 0.8 & 30.7 $\\pm$ 0.9 \\\\\n{Patch$_{7\\times7}$} & 18.0 $\\pm$ 0.4 & 26.8 $\\pm$ 0.7 & 31.6 $\\pm$ 0.8 & 37.1 $\\pm$ 1.0 \\\\\n{LBP$^{u}$} & 8.2 $\\pm$ 0.4 & 9.4 $\\pm$ 0.4 & 14.2 $\\pm$ 0.6 & 24.8 $\\pm$ 1.0 \\\\\n{LBP-VQ} & 21.1 $\\pm$ 0.8 & 23.1 $\\pm$ 1.0 & 28.5 $\\pm$ 1.0 & 34.7 $\\pm$ 1.3 \\\\\n{SIFT} & \\textbf{34.7 $\\pm$ 0.8} & \\textbf{45.5 $\\pm$ 0.9} & \\textbf{49.7 $\\pm$ 0.8} & \\textbf{53.8 $\\pm$ 0.8} \\\\\n\\end{tabular}\n}\n\\caption{Comparison of local descriptors and kernels on the DTD data, averaged over ten splits.}\n\\label{tbl:results}\n\\end{table}\n\n\\begin{table*}[t]\n\\centering\n{\\small\n\\setlength{\\tabcolsep}{3pt}\n\\begin{tabular}{l|ccc|c|ccc}\n\\multirow{2}{*}{Dataset} & \\multicolumn{3}{|c|}{SIFT} & \\multicolumn{2}{|c}{Published} \\\\\n & IFV & BoVW & VLAD & Best & \\citep{sifre13rotation} \\\\ \\hline\n{CUReT} & \\textbf{99.6 $\\pm$ 0.3} & 98.1 $\\pm$ 0.9 & 98.8 $\\pm$ 0.6 & $\\rightarrow$ & 99.4 \\\\\n{UMD} & 99.2 $\\pm$ 0.4 & 98.1 $\\pm$ 0.8 & 99.3 $\\pm$ 0.4 & $\\rightarrow$ & \\textbf{99.7 $\\pm$ 0.3} \\\\\n{UIUC} & 97.0 $\\pm$ 0.9 & 96.1 $\\pm$ 2.4 & 96.5 $\\pm$ 1.0 & $\\rightarrow$ & \\textbf{99.4 $\\pm$ 0.4} \\\\\n{KTH-TIPS} & \\textbf{99.7 $\\pm$ 0.1} & 98.6 $\\pm$ 1.0 & 99.2 $\\pm$ 0.8 & $\\rightarrow$ & 99.4 $\\pm$ 0.4 \\\\\n{KTH-TIPS-2a}$^\\alpha$ & \\textbf{82.5 $\\pm$ 5.2} & \\textbf{74.8 $\\pm$ 5.4} & \\textbf{76.5 $\\pm$ 5.2} & 73.0 $\\pm$ 4.7 \\citep{sharma12local} & -- \\\\\n{KTH-TIPS-2b}$^{\\beta}$ & \\textbf{69.3 $\\pm$ 1.0} & 58.4 $\\pm$ 2.2 & 63.1 $\\pm$ 2.1 & 66.3 \\citep{timofte12trainingfree} & -- \\\\\n{FMD} & \\textbf{58.2 $\\pm$ 1.7} & 49.5 $\\pm$ 1.9 & 52.6 $\\pm$ 1.5 & 57.1 \/ 55.6~\\citep{sharan13recognizing}$^{\\gamma}$ & $41.4 \\pm 1.3$ \\\\ \\hline\n\\textbf{{DTD}} & \\textbf{61.5 $\\pm$ 1.4} & 55.6 $\\pm$ 1.3 & 59.8 $\\pm$ 1.0 & -- & $40.2 \\pm 0.5$ \\\\\n\\end{tabular}\n\\vline\n\\vline\n\\vline\n\\hfill \n\\begin{tabular}{ l|c|c }\n Feature & KTH-TIPS-2b & FMD \\\\\n \\hline\n $\\text{DTD}_\\text{LIN}$\\xspace & 61.1 $\\pm$ 2.8 & 48.9 $\\pm$ 1.9 \\\\\n $\\text{DTD}_\\text{RBF}$\\xspace & 64.6 $\\pm$ 1.5 & 53.1 $\\pm$ 2.0 \\\\\n \\hline\n $\\text{IFV}_\\text{SIFT}$\\xspace & 69.3 $\\pm$ 1.0 & 58.2$\\pm$ 1.7 \\\\\n $\\text{IFV}_\\text{RGB}$\\xspace & 58.8 $\\pm$ 2.5 & 47.0 $\\pm$ 2.7 \\\\\n $\\text{IFV}_\\text{SIFT}$\\xspace + $\\text{IFV}_\\text{RGB}$\\xspace & 67.5 $\\pm$ 3.3 & 63.3 $\\pm$ 1.9 \\\\\n \\hline\n $\\text{DTD}_\\text{RBF}$\\xspace + $\\text{IFV}_\\text{SIFT}$\\xspace & 68.4 $\\pm$ 1.4 & 60.1 $\\pm$ 1.6 \\\\\n $\\text{DTD}_\\text{RBF}$\\xspace + $\\text{IFV}_\\text{RGB}$\\xspace & 70.9 $\\pm$ 3.5 & 61.3 $\\pm$ 2.0 \\\\\n All three & \\textbf{74.6 $\\pm$ 3.0} & \\textbf{65.4 $\\pm$ 2.0} \\\\\n \\hline\n Prev. state of the art & 66.3~\\cite{timofte12trainingfree} & 57.1~\\cite{sharan13recognizing} \\\\\n\\end{tabular}\n\n}\n\\caption{{\\bf Left:} Comparison of encodings and state-of-the-art texture recognition methods on DTD as well as standard material recognition benchmarks. $\\alpha:$ three samples for training, one for evaluation; $\\beta:$ one sample for training, three for evaluation. $\\gamma:$ with\/without ground truth masks (\\cite{sharan13recognizing} Sect. 6.5); our results do not use them. {\\bf Right:} Combined with $\\text{IFV}_\\text{SIFT}$\\xspace and $\\text{IFV}_\\text{RGB}$\\xspace, the $\\text{DTD}_\\text{RBF}$\\xspace features achieve a significant improvement in classification performance on the challenging KTH-TIPS-2b and FMD compared to published state of the art results.}\n\\label{tbl:dataset-results}\\label{tbl:fmd-results}\n\\end{table*}\n\n\\begin{figure}[t]\n\\centering\n\\includegraphics[width=\\linewidth]{fig\/figure4}\n\\caption{Per-class AP of the 47 describable attribute classifiers on DTD using the $\\text{IFV}_\\text{SIFT}$\\xspace representation and linear classifiers.}\\label{fig:perclassap}\n\\end{figure}\n\n\\paragraph{Local descriptor comparisons on DTD.} This experiments compares local descriptors and kernels on DTD. All comparison use the bag-of-visual-word pooling\/encoding scheme using $K$-means for vector quantization the descriptors. The DTD data is used as a benchmark averaging the results on the ten train-val-test splits. $K$ was cross-validated, finding an optimal setting of 1024 visual words for SIFT and color patches, 512 for LBP-VQ, 470 for the filter banks. Tab.~\\ref{tbl:results}, reports the mean Average Precision (mAP) for 47 SVM attribute classifiers. As expected, the best kernel is exp-$\\chi^2$, followed by additive $\\chi^2$ and Hellinger, and then linear. Dense SIFT (53.82\\% mAP) outperforms the best specialized texture descriptor on the DTD data (39.67\\% mAP for LM). Fig.~\\ref{fig:perclassap} shows AP for each attribute: concepts like \\emph{chequered} achieve nearly perfect classification, while others such as \\emph{blotchy} and \\emph{smeared} are far harder.\n\n\\paragraph{Encoding comparisons on DTD.} This experiment compares three encodings: BoVW, VLAD~\\citep{jegou10aggregating} and IFV. VLAD is similar to IFV, but uses $K$-means for quantization and stores only first-order statistics of the descriptors. Dense SIFT is used as a baseline descriptor and performance is evaluated on ten splits of DTD in Tab.~\\ref{tbl:dataset-results}. IFV (256 Gaussian modes) and VLAD (512 $K$-means centers) performs similarly (about 60\\% mAP) and significantly better than BoVW (53.82\\% mAP). As we will see next, however, IFV significantly outperforms VLAD in other texture datasets. We also experimented with the state-of-the-art descriptor of \\citep{sifre13rotation} which we did not find to be competitive with IFV on FMD and DTD (Tab.~\\ref{tbl:dataset-results}); unfortunately could not obtain an implementation of~\\citep{sharan13recognizing} to try on our data -- however $\\text{IFV}_\\text{SIFT}$\\xspace outperforms it on material recognition. \n\n\\paragraph{State-of-the-art material classification.} This experiments evaluates the encodings on several material recognition datasets: CUReT~\\cite{dana99reflectance}, UMD~\\cite{xu09viewpoint}, UIUC~\\cite{lazebnik05sparse}, KTH-TIPS~\\cite{hayman04learning}, KTH-TIPS2(a and b)~\\cite{caputo05class}, and FMD~\\cite{sharan09material}. Tab.~\\ref{tbl:dataset-results} compares with the existing state-of-the-art~\\citep{timofte12trainingfree,sifre13rotation,sharma12local} on each of them. For saturated datasets such as CUReT, UMD, UIUC, KTH-TIPS the performance of most methods is above to 99\\% mean accuracy and there is little difference between them. In harder datasets the advantage of IFV is evident: KTH-TIPS-2a (+5\\%), KTH-TIPS-2b (+3\\%), and FMD (+1\\%). In particular, while FMD includes manual segmentations of the textures, these are not used here here. Furthermore, IFV is conceptually simpler than the multiple specialized features used in~\\citep{sharma12local} for material recognition.\n\n\n\\subsection{Describable attributes as a representation}\\label{s:exp2}\n\nThis section evaluates using the 47 describable attributes as a texture descriptor applying it to the task of material recognition. The attribute classifiers are trained on DTD using the IFV+SIFT representation and linear classifiers as in the previous section ($\\text{DTD}_\\text{LIN}$\\xspace). As explained in Sect.~\\ref{s:high}, these are then used to form 47-dimensional descriptors of each texture image in FMD and KTH-TIPS2-b.\n\nWhen combined with a linear SVM classifier, results are promising (Tab.~\\ref{tbl:fmd-results}): on KTH-TIPS2-b, the describable attributes yield 61.1\\% mean accuracy and\n49.0\\% on FMD outperforming the aLDA model of~\\citep{sharan13recognizing} combining color, SIFT and edge-slice (44.6\\%). While results are not as good as the $\\text{IFV}_\\text{SIFT}$\\xspace representation, the dimensionality of this descriptor is \\emph{three orders of magnitude smaller} than IFV. For this reason, using an RBF classifier with the DTD features is relatively cheap. Doing so improves the performance by 3.5--4\\% ($\\text{DTD}_\\text{RBF}$\\xspace).\n\nWe also investigated combining multiple features: $\\text{DTD}_\\text{RBF}$\\xspace with $\\text{IFV}_\\text{SIFT}$\\xspace and $\\text{IFV}_\\text{RGB}$\\xspace. $\\text{IFV}_\\text{RGB}$\\xspace computes the IFV representation on top of all the $3\\times 3$ RGB patches in the image in the spirit of~\\cite{varma2003texture}. The performance of $\\text{IFV}_\\text{RGB}$\\xspace is notable given the simplicity of the local descriptors; however, it is not as good as $\\text{DTD}_\\text{RBF}$\\xspace which is also 26 times smaller. The combination of $\\text{IFV}_\\text{SIFT}$\\xspace and $\\text{IFV}_\\text{RGB}$\\xspace is already notably better than the previous state-of-the-art results and the addition of $\\text{DTD}_\\text{RBF}$\\xspace improves by another significant margin. Overall, our best result on KTH-TIPS-2b is \\textbf{74.6\\%} (vs. the previous best of 66.3) and on FMD of \\textbf{65.4\\%} (vs. 57.1) on FMD, with an improvement of more than~\\textbf{8\\%} accuracy in both cases.\n\nFinally, we compared the semantic attributes of~\\cite{matthews13enriching} with $\\text{DTD}_\\text{LIN}$\\xspace on the Outex data. Using $\\text{IFV}_\\text{SIFT}$\\xspace as an underlying representation for our attributes, we obtain 49.82\\% mAP on the retrieval experiment of~\\cite{matthews13enriching}, which is is not as good as their result with $\\text{LBP}^u$ (63.3\\%). However, $\\text{LBP}^u$ was developed on the Outex data, and it is therefore not surprising that it works so well. To verify this, we retrained our DTD attributes with IFV using $\\text{LBP}^u$ as local descriptor, obtaining a score of 64.52\\% mAP. This is remarkable considering that their retrieval experiment contains the data used to \\emph{train} their own attributes (target set), while our attributes are trained on a completely different data source. Tab.~\\ref{tbl:results} shows that $\\text{LBP}^u$ is not competitive on DTD.\n\n\\renewcommand{\\dim}{.09\\textwidth}\n\\begin{figure*}[!t]\n\\vspace{-0.1in}\n\\centering\n\t\\subfloat[aluminium]{\\includegraphics[width=\\dim]{fig\/figure5\/figure5a}}\n\t\\hfill\n\t\\subfloat[brown bread]{\\includegraphics[width=\\dim]{fig\/figure5\/figure5b}}\n\t\\hfill\n\t\\subfloat[corduroy]{\\includegraphics[width=\\dim]{fig\/figure5\/figure5c}}\n\t\\hfill\n\t\\subfloat[cork]{\\includegraphics[width=\\dim]{fig\/figure5\/figure5d}}\n\t\\hfill\n\t\\subfloat[cotton]{\\includegraphics[width=\\dim]{fig\/figure5\/figure5e}}\n\t\\hfill\n\t\\subfloat[cracker]{\\includegraphics[width=\\dim]{fig\/figure5\/figure5f}}\n\t\\hfill\n\t\\subfloat[lettuce leaf]{\\includegraphics[width=\\dim]{fig\/figure5\/figure5g}}\n\t\\hfill\n\t\\subfloat[linen]{\\includegraphics[width=\\dim]{fig\/figure5\/figure5h}}\n\t\\hfill\n\t\\subfloat[white bread]{\\includegraphics[width=\\dim]{fig\/figure5\/figure5i}}\n\t\\hfill\n\t\\subfloat[wood]{\\includegraphics[width=\\dim]{fig\/figure5\/figure5j}}\n\t\\hfill\n\t\\subfloat[wool]{\\includegraphics[width=\\dim]{fig\/figure5\/figure5k}}\n\\caption{Descriptions of materials from KTH-TIPS-2b dataset. These words are the most frequent top scoring texture attributes (from the list of 47 we proposed), when classifying the images from the KTH-TIPS-2b dataset.}\n\\label{f:kth-tips-described}\n\\end{figure*}\n\n\n\\subsection{Search and visualization}\\label{s:exp3}\n\nFig.~\\ref{f:kth-tips-described} shows that there is an excellent semantic correlation between the ten categories in KTH-TIPS-2b and the attributes in DTD. For example, aluminium foil is found to be \\emph{wrinkled}, while bread is found as: \\emph{bumpy}, \\emph{pitted}, \\emph{porous} and \\emph{flecked}.\n\nIn what follows, we experimented with describing images from a challenging material dataset, FMD and encouraged by the good results, we applied the same technique to images from the wild, from some online catalog.\n\n\\subsubsection{Subcategorizing FMD materials using describable texture attributes}\\label{s:fmd}\n\n\\begin{figure}[hb!]\n\\centering\n\\includegraphics[width=0.49\\textwidth]{fig\/figure6}\n\\caption{Per class AP results on FMD dataset using DTD classification scores as features.\n\\label{fig:fmd-ap}}\n\\end{figure}\n\nThe results shown in Fig.~\\ref{fig:fmd-ap} extends the results in Table~\\ref{tbl:dataset-results} and Sect.~\\ref{s:exp2} and illustrate the classification performance of the 47-dimensional DTD descriptors on the FMD materials -- note the excellent performance obtained for foliage, wood, and water, which are above 70\\%.\n\nOur experiments illustrate how the DTD attributes can be used to find ``semantic structures'' in a dataset such as FMD, for example by distinguishing between ``knitted vs pleated fabric'', ``gauzy vs crystalline glass'', ``veined vs frilly foliage'' etc. To do so, FDM images for each material were clustered based on the 47 attribute vectors using $K$-means into 3-5 clusters each. Examples of the most meaningful clusters are shown in Fig.~\\ref{fig:fmd-clusters} along with the dominant attributes in each.\n\nNotable fine-grained material distinctions include \\emph{knitted} vs \\emph{pleated} fabrics and \\emph{frilly} vs \\emph{pleated \\& veined} foliage which contain linear structures. In the latter case, veins often have a radial pattern which is captured by the dominant \\emph{spiralled} attribute. The method distinguishes \\emph{bumpy} stones such as pebbles from \\emph{porous} or \\emph{pitted} stones for zoomed \/ detailed views of stone blocks. Water is divided into \\emph{swirly \\& spiralled} images, which show the orientation of the waves, and \\emph{bubbly, sprinkled} images, which show splashing drops. Glass is more challenging but some images are correctly identified as \\emph{crystalline}. Fig.~\\ref{fig:challenging} shows other challenging examples illustrating the variety of materials and patterns that can be described by the DTD attributes. Metal is one of the hardest class to identify (Fig.~\\ref{fig:fmd-ap}), but attributes such as ``interlaced'' and ``braided'' are still correctly recognized in the third (jewelry) and last (metal wires) image.\n\n{\n\\renewcommand{\\dim}{0.144\\textwidth}\n\\begin{figure*}[!t]\n\\centering\n\\includegraphics[width=\\dim, height=\\dim]{fig\/figure7\/figure7a}\n~\n\\includegraphics[width=\\dim, height=\\dim]{fig\/figure7\/figure7b} \n~\n\\includegraphics[width=\\dim, height=\\dim]{fig\/figure7\/figure7c}\n~\n\\includegraphics[width=\\dim, height=\\dim]{fig\/figure7\/figure7d}\n~\n\\includegraphics[width=\\dim, height=\\dim]{fig\/figure7\/figure7e}\n~\n\\includegraphics[width=\\dim]{fig\/figure7\/figure7f}\n\\caption{Challenging or difficult images which were correctly characterized by our DTD classifier.\n\\label{fig:challenging}}\n\\end{figure*}\n}\n\n\\subsubsection{Examples in the wild}\nAs an additional application of our describable texture attributes we compute them on a large dataset of 10,000 wallpapers and bedding sets (about 5,000 for each of the two categories) from \\url{houzz.com}. The 47 attribute classifiers are learned as explained in Sect.~\\ref{s:exp1} using the $\\text{IFV}_\\text{SIFT}$\\xspace representation and them apply them to the 10,000 images to predict the strength of association of each attribute and image. Classifiers scores are recalibrated on a subset of the target data and converted to probabilities using Platt's method~\\cite{platt00probabilistic}, for each individual attribute. Fig.~\\ref{fig:wallpapers} and Fig.~\\ref{fig:beddings} shows some example attribute predictions (excluding images used for calibrating the scores), for the best scoring 3-4 images for each category -- by top attribute. We show for each images the top three attributes -- the top two being very accurate, while the third is correct in about half of the cases. Please note that each score is calibrated on a per attribute basis, to the scores do not add up to 1.\n\n\n\n\\section{Summary}\n\nWe introduced a large dataset of 5,640 images collected ``in the wild'' jointly labeled with 47 describable texture attributes and used it to study the problem of extracting semantic properties of textures and patterns, addressing real-world human-centric applications. Looking for the best representation to recognize such describable attributes in natural images, we have ported IFV, an object recognition representation, to the texture domain. Not only IFV works best in recognizing describable attributes, but it also outperforms specialized texture representation on a number of challenging material recognition benchmarks. We have shown that the describable attributes, while not being designed to do so, are good predictors of materials as well, and that, when combined with IFV, significantly outperform the state-of-the-art on the FMD and KTH-TIPS recognition tasks.\n\n\n\\footnotesize\n\\bibliographystyle{ieee}\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}}