<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Michael Poli on Medium]]></title>
        <description><![CDATA[Stories by Michael Poli on Medium]]></description>
        <link>https://medium.com/@michaelpoli?source=rss-912c466c26f5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*2AFj8EmiqSTrFW_G4CVUbA.jpeg</url>
            <title>Stories by Michael Poli on Medium</title>
            <link>https://medium.com/@michaelpoli?source=rss-912c466c26f5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 19:49:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@michaelpoli/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Neural ODEs with PyTorch Lightning and TorchDyn]]></title>
            <link>https://medium.com/data-science/neural-odes-with-pytorch-lightning-and-torchdyn-87ca4a7c6ffd?source=rss-912c466c26f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/87ca4a7c6ffd</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[pytorch-lightning]]></category>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[differential-equations]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Michael Poli]]></dc:creator>
            <pubDate>Sun, 06 Dec 2020 04:52:25 GMT</pubDate>
            <atom:updated>2020-12-06T05:04:50.185Z</atom:updated>
            <content:encoded><![CDATA[<h4>Effortless, Scalable Training of Neural Differential Equations</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7KFuWlPq4q177LdLPL46dg.png" /><figcaption>Various <a href="https://papers.nips.cc/paper/2020/file/293835c2cc75b585649498ee74b395f5-Paper.pdf">classes</a> of Neural ODEs.</figcaption></figure><p>Traditional neural network models are composed of a finite number of layers. Neural Differential Equations (NDEs), a core model class of the so-called <em>continuous-depth learning</em> framework, challenge this notion by defining forward inference passes as the solution of an <a href="https://en.wikipedia.org/wiki/Initial_value_problem">initial value problem</a>. This effectively means that NDEs can be thought of as being comprised of a <em>continuum</em> of layers, where the <strong>vector field</strong> itself is parametrized by an <strong>arbitrary neural network</strong>. Since <a href="https://arxiv.org/abs/1806.07366">seminal work</a> that initially popularized the idea, <a href="https://arxiv.org/abs/2001.01328">the</a> <a href="https://arxiv.org/abs/2002.08071">framework</a> <a href="https://arxiv.org/abs/1907.03907">has</a> <a href="https://arxiv.org/abs/2007.09601">grown</a> <a href="https://arxiv.org/abs/2005.08926">quite</a> <a href="https://arxiv.org/abs/2002.02798">large</a>, seeing applications in control, generative modeling and forecasting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*DQpocxD62a_juxxvBYsAmA.gif" /><figcaption>A Neural Ordinary Differential Equation (Neural ODE) with parameters, and thus vector field, varying in “depth” (s), trained to perform a binary classification task.</figcaption></figure><p>NDEs are typically the correct choice whenever the underlying dynamics or model to approximate are known to evolve according to differential equations. Another domain in which continuous-depth have proven to be beneficial is density estimation and generative modeling, where properties of the continuous formulation are used directly to reduce the computational cost of normalizing flows.</p><p><a href="https://www.youtube.com/watch?v=-HZ3yb3qLmo&amp;t=3s&amp;app=desktop&amp;ab_channel=HKMLResearchLimited">Here</a> is a self-contained video introduction on the topic.</p><h4>TorchDyn: A library for neural differential equations</h4><p>Unlocking the full potential of continuous-depth models requires a specialized software ecosystem. For example, inference of NDEs is carried out via numerical differential equation solvers.</p><p><a href="https://github.com/DiffEqML/torchdyn">TorchDyn</a>, part of the broader <a href="https://github.com/DiffEqML">DiffEqML</a> software ecosystem, offers an intuitive access-point to model design for continuous-depth learning. The library follows core design ideals driving the success of modern deep learning frameworks; namely modular, object-oriented and with a focus on GPUs and batched operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*IWLgtCy-HO8kL0zm" /><figcaption>Some of the building blocks of TorchDyn models: <a href="https://github.com/DiffEqML/torchdyn">here</a> and <a href="https://arxiv.org/abs/2009.09346">here</a> for more information.</figcaption></figure><p>The API will be immediately familiar to anyone who has worked on PyTorch:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/695/0*XkRkWwOdZeySsch4" /></figure><p><a href="https://github.com/DiffEqML/torchdyn/blob/master/torchdyn/models/neuralde.py">NeuralDEs</a> represent the primary model class which can be interacted with in the usual PyTorch fashion. Internally, <a href="https://github.com/DiffEqML/torchdyn/blob/master/torchdyn/models/defunc.py">DEFunc</a> perform auxiliary operations required to preserve compatibility across NeuralDE variants, such as <a href="https://arxiv.org/abs/2002.08071">higher</a>-<a href="https://papers.nips.cc/paper/2019/hash/99a401435dcb65c4008d3ad22c8cdad0-Abstract.html">order</a> <a href="https://arxiv.org/abs/2006.07220">dynamics</a> or handling additional dimensions for <a href="https://papers.nips.cc/paper/2020/file/293835c2cc75b585649498ee74b395f5-Paper.pdf">integral cost functions</a>, distributed on the whole depth of the NDE.</p><p>What’s more, TorchDyn models leverage <a href="https://github.com/DiffEqML">PyTorch-Lightning</a> to allow for effortless and scalable training.</p><p>Below, we’ll step through Neural <em>Ordinary</em> Differential Equations (Neural ODEs) training with TorchDyn and PyTorch Lightning. At the end, we’ll dive deeper into recent advances and show how inference can be sped up through <a href="https://arxiv.org/abs/2007.09601">Hypersolvers</a>, also trained with PyTorch Lightning.</p><h4>Defining Neural ODE models</h4><p>We will start with a Neural ODE for a binary classification problem. In particular, our objective is separating these two classes of points. The dataset contains pairs (x, y) of 2D points and their label, indicated below in color</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*KWPhP-NwmZAxJcxm6UN7HA.png" /></figure><p>Generated as follows, using ToyDataset of TorchDyn:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7164c9cb7cac503b15ba0fc9ec9ff002/href">https://medium.com/media/7164c9cb7cac503b15ba0fc9ec9ff002/href</a></iframe><p>The next step involves defining a standard <a href="https://github.com/DiffEqML">pl.LightningModule</a> for classification tasks, whose forward will be handled by NeuralDE . A LightningModule is just a nn.Module, with added hooks to structure your model. It leaves the core training logic to you, and automate the engineering. Note how the NeuralDE object takes as input a neural network f defining the vector field:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ed7f3e3adff821fe299f6103a1b6b9a9/href">https://medium.com/media/ed7f3e3adff821fe299f6103a1b6b9a9/href</a></iframe><p>We then proceed as usual, creating a <a href="https://pytorch-lightning.readthedocs.io/en/stable/trainer.html">Trainer</a> and then leveraging any PyTorch-Lightning feature needed for training or logging. Here is a <a href="https://pytorch-lightning.readthedocs.io/en/stable/trainer.html">full list</a> of Lightning features such as compatibility with both GPUs and TPUs (multi-node) 16-bit precision training and early stopping.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4e2a38080bf5ac2aa24fdd2968088376/href">https://medium.com/media/4e2a38080bf5ac2aa24fdd2968088376/href</a></iframe><p>We can visualize the NDE <em>flows</em>, or the evolution of input data across their depth, through the trajectory method. s_span indicates the depth interval — as a mesh of points — we are interested in.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8e31df9bbb5bc8da9f4342757d582d6c/href">https://medium.com/media/8e31df9bbb5bc8da9f4342757d582d6c/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*u8OCL1-2vngyTWRxC8MspQ.png" /><figcaption>Flows of the trained Neural ODE. The points of each class are pulled apart. The final points are then linearly separable.</figcaption></figure><h3>Hypersolvers in PyTorch Lightning: Faster Neural Differential Equations</h3><p>Neural Differential Equations inference is typically slower than comparable discrete neural networks, since these continuous models come with the additional overhead of solving a differential equation. Various approaches have been proposed to alleviate these limitations e.g regularizing the vector field such that is <em>easier</em> to solve. In practice, an easier to solve NDE translates into a smaller number of function evaluations — with adaptive-step solvers — or in other words less calls to the neural network parametrizing the vector field.</p><p>However, regularizing the vector field may <strong>not</strong> always be an option, particularly in situations where the differential equation is partially known and specified <em>a prior — </em>as is the case for example in control applications.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FzfZ5ZiJoX-GcQiBOEv2Ig.gif" /><figcaption>Euler method versus its Hypersolver variant — solving a Neural ODE for MNIST image classification. HyperEuler maintains a lower error across the solution, in turn preserving more accurate class predictions.</figcaption></figure><p>The framework of <a href="https://papers.nips.cc/paper/2020/file/f1686b4badcf28d33ed632036c7ab0b8-Paper.pdf">hypersolvers</a> considers instead the interplay between model and solver, analyzing ways in which the solver and the training strategies can be adapted to maximize NDE speedups.</p><p>In their simplest form, hypersolvers take a base solver formulation and enhance its performance on an NDE with an additional learning component, trained by approximating <a href="https://en.wikipedia.org/wiki/Truncation_error_(numerical_integration)">local errors</a> of the solver. Other techniques are available, for example, adversarial training to exploit base solver weaknesses and aid in its generalization across dynamics.</p><p>We will use this <a href="https://github.com/DiffEqML/diffeqml-research/tree/master/hypersolver">HyperEuler implementation</a> to speed up inference of the Neural ODE of the previous section. Here, we will use as hypersolver network g a tiny neural network made up of a single linear layer:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bdb61f0f225b87ababbc84f0d70901e0/href">https://medium.com/media/bdb61f0f225b87ababbc84f0d70901e0/href</a></iframe><p>Do not be alarmed by the high number of <em>epochs</em>. These will be simple training iterations, since we are doing full-batch training.</p><p>After training, we can visualize the flows of the Neural ODE solved with our hypersolver variant of the Euler method, HyperEuler , and verify whether they are the same as those solved with the adaptive — step method:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/861d73e601b12bdc6f13d53e30900190/href">https://medium.com/media/861d73e601b12bdc6f13d53e30900190/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/344/1*Acmu_oLy0LQT-tphflLtCw.png" /><figcaption>Flows of the trained Neural ODE, solved with HyperEuler. The flows are almost identical to the solutions shown above, but are computed in 50% the number of function evaluations.</figcaption></figure><p>At the cost of only 12 additional parameters, we are able to successfully reduce the number of function evaluations to less than 20, starting from 40+. Not bad!</p><h4>Conclusion</h4><p>We’ve shown how to train Neural ODEs through TorchDyn and PyTorch-Lightning, including how to speed them up with hypersolvers. Much more is possible in the continuous-depth framework, we suggest the following <a href="https://torchdyn.readthedocs.io/en/latest/">set of tutorials</a> for those interested in a deeper dive.</p><p>The DiffEqML continuous-depth ecosystem is in rapid expansion, andTorchDyn itself is currently close to a new release including some of the latest advances from NeurIPS 2020. Our goal with DiffEqML is to take these models to the next level of practical relevance by allowing for effortless and scalable training of NDEs and traditional neural network — NDE hybrids across GPUs and GPU clusters. We will continue to base our efforts on the solid foundation provided by PyTorch-Lightning , and we are excited to strengthen our collaboration with even better integration.</p><p>For those interested in more content related to NDEs, follow us on <a href="https://twitter.com/Diffeq_ml">Twitter</a> for more updates. Feel free to check out our poster sessions at the upcoming NeurIPS 2020 to ask us more questions:</p><ul><li><a href="https://papers.nips.cc/paper/2020/file/293835c2cc75b585649498ee74b395f5-Paper.pdf">Dissecting Neural ODEs</a></li><li><a href="https://papers.nips.cc/paper/2020/file/f1686b4badcf28d33ed632036c7ab0b8-Paper.pdf%20Michael%20Poli%20and">Hypersolvers: Toward Fast Continuous-Depth Models</a></li></ul><p><a href="https://twitter.com/MichaelPoli6">Michael Poli</a> and <a href="https://twitter.com/Massastrello/status/1316344860635324418">Stefano Massaroli</a>, DiffEqML</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87ca4a7c6ffd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/neural-odes-with-pytorch-lightning-and-torchdyn-87ca4a7c6ffd">Neural ODEs with PyTorch Lightning and TorchDyn</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Graph Neural Ordinary Differential Equations]]></title>
            <link>https://medium.com/data-science/graph-neural-ordinary-differential-equations-a5e44ac2b6ec?source=rss-912c466c26f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5e44ac2b6ec</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Michael Poli]]></dc:creator>
            <pubDate>Thu, 21 Nov 2019 02:11:08 GMT</pubDate>
            <atom:updated>2019-11-22T04:38:03.462Z</atom:updated>
            <content:encoded><![CDATA[<h4>Extending Graph Neural Networks into a continuous depth domain</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*immsgP9jurT7sbH7EjLF6Q.png" /><figcaption><a href="https://en.wikipedia.org/wiki/Rayleigh%E2%80%93B%C3%A9nard_convection">Rayleigh–Bénard</a> convection. <a href="https://en.wikipedia.org/wiki/Finite_element_method">Finite element methods</a> discretize spatially continuous problems into sets of entities that display complex inductive relational biases. Source:<a href="https://www.youtube.com/watch?v=OM0l2YPVMf8&amp;t=74s."> original author</a>.</figcaption></figure><p>Multi — agent systems are prevalent across a variety of scientific fields: from <a href="https://en.wikipedia.org/wiki/N-body_simulation">physics</a> to<a href="https://en.wikipedia.org/wiki/Swarm_robotics"> robotics</a>, <a href="https://en.wikipedia.org/wiki/Auction_theory">game-theory</a>, finance and molecular biology, among others. Often, closed — form analytic formulations are not available and forecasting or decision making tasks have to rely on noisy, irregularly sampled observations.</p><p>This class of systems offers a crystal clear example of inductive relational biases. Introducing inductive biases in statistics or machine learning is a well known approach to improving sample efficiency and generalization performance. From the choice of objective function, to the design of ad — hoc deep learning architectures suited to the specific problem at hand, biases are common and effective.</p><p>Relational inductive biases [1] represent a special class of biases, concerned with relationship between entities. Graphical models, probabilistic or otherwise, are a traditional class of models specialized in imposing relational biases in the form of prior structures on entities. These graph structures are useful in different ways; namely reducing computational complexity by introducing conditional independence assumptions and increasing sample efficiency by encoding prior knowledge in graph — form.</p><p>Graph neural networks (GNNs) are the deep learning counterpart to graphical models. They are usually utilized when the target problem structure can be encoded as a graph or in settings where prior knowledge about relationships among input entities can itself be described as a graph. GNNs have shown remarkable results in various application areas such as node classification [2], graph classification and forecasting [3][4] as well as generative tasks [5].</p><h4>Ordinary differential equations in deep learning</h4><p>A different but equally important class of inductive biases is concerned with the class of systems from which the data is collected. Although deep learning has traditionally been a field dominated by discrete models, recent advances propose a treatment of neural networks as models equipped with a continuum of layers [6]. This view allows a reformulation of the forward pass as the solution of the <a href="https://en.wikipedia.org/wiki/Initial_value_problem">initial value problem</a> of an ordinary differential equation (ODE). This assumption allows direct modeling of ODEs and enhances the performance of neural networks on tasks involving continuous time processes.</p><p>Our work is aimed at bridging the gap between geometric deep learning and continuous models. <em>Graph neural ordinary differential equations</em> (GDEs) cast common tasks on graph — structured data into a system — theoretic framework:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*glTm2w79BhFnv7uI18QC4w.png" /><figcaption>GDEs model vector fields defined on graphs, both when the structure is fixed or evolves in time. This is achieved by equipping the model with a continuum of GNN layers.</figcaption></figure><p>GDEs provide flexibility due to their structure defined by a continuum of GNN layers and can therefore accommodate irregularly sampled sequential data.</p><p>The primary purpose of GDEs is to offer a data — driven approach to the modeling of structured systems, particularly when the dynamics are nonlinear and therefore challenging to approach with classical or analytical methods.</p><p>What follows is an introduction to GDEs. We refer to the full <a href="https://arxiv.org/abs/1911.07532">paper</a> for additional details and derivations. A <a href="https://github.com/Zymrael/gde">github repository</a> with introductory examples in the form of commented Jupyter notebooks is currently under development. We encourage requests/suggestions of additional applications of GDEs: our plan it to eventually include working examples with GDE variants of all major <em>graph neural network</em> (GNN) architectures, deployed across various settings (forecasting, control…)</p><h4><strong>Preliminaries and background</strong></h4><p>GDEs, like GNNs, operate on <a href="https://en.wikipedia.org/wiki/Graph_(discrete_mathematics)"><em>graphs</em></a><em>. </em>We refer to the excellent <a href="https://arxiv.org/abs/1901.00596">survey on GNNs</a> as well as the <a href="https://arxiv.org/abs/1911.07532">background section in our paper</a> for a more detailed introduction on notation and basic definitions. The GDE introduction to follow is in distilled form and only two basic facts about graphs are immediately necessary:</p><ol><li>Graphs are collections of nodes (entities) connected by edges. It is common for deep learning models to work on <em>attributed graphs, </em>that is graphs whose nodes are described by a set of features (often in the form of an embedding vector or tensor). For graphs with <strong>n</strong> nodes, each described by <strong>d</strong> features, we denote the<strong> <em>n</em></strong><em> x </em><strong><em>d</em></strong> node embedding matrix as <strong>H</strong>.</li><li>The structure of the graph is captured by its adjacency matrix <strong>A. </strong>The connectivity structure between nodes represents the main difference between standard deep learning models and GNNs [1], since the latter utilize it directly in a variety of ways to perform operations on node embeddings.</li></ol><h3>Graph Neural Ordinary Differential Equations</h3><p>A <strong><em>G</em></strong><em>raph neural ordinary </em><strong><em>D</em></strong><em>ifferential </em><strong><em>E</em></strong><em>quation</em> (GDE) is defined as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/1*ud9EB-YdoU3hRBZlZ143gw.png" /><figcaption>General GDE formulation</figcaption></figure><p>where <strong>H </strong>is the node feature matrix. The above defines a vector field for <strong>H</strong>, parametrized by function <strong>F </strong>which can be any known <em>graph neural network</em> (GNN) layer. In other words, <strong>F </strong>utilizes connectivity information of graph <strong><em>G</em></strong>, as well as its node features, to specify the evolution of <strong>H</strong> in <strong><em>S.</em></strong><em> </em>Here<em> </em><strong><em>S </em></strong>is the depth domain of the model; <strong><em>S </em></strong>is continuous, differently from GNNs with depth domain specified by subsets of the natural numbers, and represents the <em>integration domain </em>of the ordinary differential equation defined by <strong>F</strong>. GDEs can be trained in a variety of ways, much like standard Neural ODEs [6]. <a href="https://en.wikipedia.org/wiki/Well-posed_problem">Well-posedness</a> of the system is discussed in full in the <a href="https://arxiv.org/pdf/1911.07532.pdf">paper</a>.</p><p>The general GDE formulation carries with it several implications. In the case of general Neural ODEs, it has been observed that the choice of discretization scheme can describe previously known discrete multi — step variants of ResNets [7]. The continuous, dynamical system point of view of deep learning is therefore not limited to the modeling of differential equations and can guide discovery of novel general purpose models by leveraging a rich literature of <a href="https://en.wikipedia.org/wiki/Numerical_methods_for_ordinary_differential_equations">numerical methods</a>.</p><p>Compared to ResNets, GNNs are relatively younger as a model class. The literature of multi — step or variants with complicated, fractal — like residual connections is therefore not as developed; discovery of new GNNs variants can be guided by applying various discretization schemes to GDEs, instead of starting from scratch.</p><h4>Results on static graphs: node classification</h4><p>We show that GDEs can be utilized as high — performance general purpose models by performing a series of experiments on a semi — supervised node classification task on Cora, Pubmed and Citeseer. These datasets contain <em>static graphs</em>, where adjacency matrix <strong>A </strong>remains fixed, and are thus far removed from the dynamical system setting where GDEs shine. We evaluate performance of <em>Graph Convolutional ordinary Differential Equations </em>(GCDEs), defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*RaX7UkmWL7JJ1YOrSd3c2A.png" /><figcaption>GCDE model. A more detailed version is included in our paper, along with GDE versions of popular GNN variants</figcaption></figure><p>as well as their fully — discretized counterpart <a href="https://tkipf.github.io/graph-convolutional-networks/"><em>Graph Convolutional Networks</em></a> (GCN) [8]. We include well — known <em>Graph ATtention networks </em>(GAT) [9] for reference:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*XHdRl9KCx9KElEysio8Fpw.png" /><figcaption>Accuracy on node classification tasks. Mean and standard deviation of 100 runs.</figcaption></figure><p>GCDEs are shown to be competitive with state — of — the — art models and outperform their discrete counterparts. We evaluate two versions of GCDEs: discretized with a fixed step scheme, <a href="https://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods">Runge-Kutta</a>4 (GCDE — rk4), as well as an adaptive step scheme, <a href="https://en.wikipedia.org/wiki/Dormand%E2%80%93Prince_method">Dormand-Prince</a> (GDDE — dpr5). Fixed step discretizations do not ensure that the ODE approximation remains close to the analytical solution; in this case, where solving a proper ODE is not necessary, GCDE — rk4 simply offer a computationally efficient FractalNet — like structure for GCNs that improves accuracy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*TGA5cxFs8cfVZYiI4n6qzQ.png" /><figcaption>Training loss and accuracy on Cora. Shaded area is the 95% confidence interval</figcaption></figure><p>On the other hand, training GCDEs with adaptive step solvers naturally leads to deeper models than possible with vanilla GCNs, whose layer depth greatly reduces performance. In our experiments, we successfully trained GCDE — dpr5 with up to 200 ODE <em>function evaluations</em> (NFE), a significantly higher amount of computation on graphs than possible with vanilla GCNs, whose layer depth greatly reduces performance. It should be noted that GDEs do not require more parameters than their discrete counterparts, due to the fact that they reutilize their parameters across function evaluations. Interestingly, adaptive step GDEs do not seem to suffer from over — smoothing of node features. The over — smoothing issue [10] prevents effective use of deep GNNs in various domains, particularly <em>multi — agent reinforcement learning</em> (MARL); we are currently exploring this property of GDEs and will include a more detailed analysis soon.</p><h3>Spatio-Temporal GDEs</h3><p>A key setting for GDEs involves spatio — temporal graph data. When handling <em>sequences of graphs, </em>a recurrent version of GNNs is necessary [11][12]. However, much like regular recurrent neural networks (RNNs) and their variants, fixed discretizations do not allow operations on irregularly sampled data. This fact has motivated further developments in the form of RNNs with prior assumption on dynamics between arrival times [13] as well as the ODE version of RNN [14].</p><p>In scenarios involving a temporal component, the depth domain of GDEs <strong><em>S </em></strong>coincides with the time domain and can be adapted depending on the requirements. For example, given a time window <strong>Δt</strong>, the prediction performed by a GDE assumes the form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/375/1*HWXr2eoZFRc-kBzNx4clwQ.png" /></figure><p>regardless of the specific GDE architecture. GDEs represent a natural model class for autoregressive modeling of sequences of graphs and naturally lead to an extension of classical spatio — temporal architectures in the form of <a href="https://en.wikipedia.org/wiki/Hybrid_system"><em>hybrid dynamical systems</em></a><em>, </em>i.e. systems characterized by interacting continuous and discrete — time dynamics. The core idea is to have a GDE smoothly steering the latent node features between two time instants and then apply some discrete operator, resulting in a jump of node features <strong>H</strong> which is then processed by an output layer.</p><p>Given a set of time instants <strong>{(t ₖ)}</strong><em> </em>and a state — graph data stream <strong>{(X ₜ , G ₜ)} </strong>the general formulation of autoregressive GDEs is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/462/1*3D79_q5czchMWdOoe3manQ.png" /><figcaption>Autoregressive GDE. Continuous variants of known spatio — temporal GNN models can be obtained from this system by choosing appropriate <strong>F</strong>,<strong> G</strong>,<strong> K</strong></figcaption></figure><p>where <strong>F</strong>, <strong>G</strong>, <strong>K</strong> are GNN — like operators or general neural network layers and <strong>H</strong> <strong>⁺</strong> represents the value of <strong>H</strong> after the discrete transition. The evolution of the system can be visualized by means of <a href="https://en.wikipedia.org/wiki/Hybrid_automaton">hybrid automata</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/358/1*2R3DIJ1Ga3Lv4rVT315PcQ.png" /><figcaption>Hybrid automata schematic of autoregressive GDEs.</figcaption></figure><p>Compared to standard recurrent models which are only equipped with discrete jumps, autoregressive GDEs incorporate a continuous flow of latent node features <strong>H</strong> between jumps. This feature of autoregressive GDEs allows them to track dynamical systems from irregular observations. Different combinations of <strong>F</strong>, <strong>G</strong>, <strong>K</strong> can yield continuous variants of most common spatio-temporal GNN models.</p><p>To evaluate the effectiveness of autoregressive GDE models on forecasting tasks we perform a series of experiments on the established <a href="https://dot.ca.gov/programs/traffic-operations/mobility-performance-reports">PeMS traffic dataset</a>. We follow the experimental setup of [15] with an additional preprocessing step: undersampling of time series with a probability 0.7 of removal for each entry in order to simulate a challenging environment with irregular timestamps and missing values.</p><p>To measure performance gains obtained by GDEs in settings with data generated by continuous time systems, we employ a GCDE — GRU as well as its discrete counterpart GCGRU [12] and we contextualize the results with vanilla GRU metrics. For each model under consideration we collect <a href="https://en.wikipedia.org/wiki/Root-mean-square_deviation#Normalized_root-mean-square_deviation"><em>normalized RMSE</em></a> (NRMSE) and <a href="https://en.wikipedia.org/wiki/Mean_absolute_percentage_error"><em>mean absolute percentage error</em></a> (MAPE). More details about the chosen metrics and data are found in our <a href="https://arxiv.org/abs/1911.07532">paper</a>.</p><p>Non — constant differences between timestamps result in a challenging forecasting task for a single model since the average prediction horizon changes drastically over the course of training and testing. For a fair comparison between models we include delta timestamp information as an additional node feature for GCGNs and GRUs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*03SVpHXr9tIYbP0UioC0PQ.png" /><figcaption>Results of irregular data forecasting task. Mean and standard deviation across 5 training runs.</figcaption></figure><p>Since GCDE-GRUs and GCGRUs are designed to match in structure and number of parameters we can measure a performance increase of <strong>3%</strong> in NRSME and <strong>7%</strong> in MAPE<strong> </strong>over GCGRUs metrics. A variety of other application areas with continuous dynamics and irregular datasets could similarly benefit from adopting GDEs as modeling tools: medicine, finance or distributed control systems, to name a few. We are working on additional experiments in these domains and welcome requests, ideas or collaborations.</p><h4>Conclusions</h4><p>As mentioned before, we are currently working on a <a href="https://github.com/Zymrael/gde">github repository</a> with a series of examples and applications of different types of GDEs.</p><p>We encourage requests/suggestions of additional applications of GDEs: our plan it to eventually include working examples with GDE variants of all major <em>graph neural network</em> (GNN) architectures, deployed across various settings (forecasting, control…). Our paper is available on arXiv as preprint: consider <a href="https://arxiv.org/abs/1911.07532">citing us</a> if you find our work useful.</p><p><strong>References:</strong></p><p>[1] P. W. Battaglia et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018.</p><p>[2] J. Atwood and D. Towsley. Diffusion-convolutional neural networks. In Advances in Neural Information Processing Systems, pages 1993–2001, 2016.</p><p>[3] Z. Cui, K. Henrickson, R. Ke, and Y. Wang. Traffic graph convolutional recurrent neural network: A deep learning framework for network-scale traffic learning and forecasting. arXiv preprint arXiv:1802.07007, 2018</p><p>[4] J. Park and J. Park. Physics-induced graph neural network: An application to wind-farm power estimation.Energy, 187:115883, 2019.</p><p>[5] Li, O. Vinyals, C. Dyer, R. Pascanu, and P. Battaglia. Learning deep generative models of graphs. arXiv preprint arXiv:1803.03324, 2018.</p><p>[6] T. Q. Chen, Y. Rubanova, J. Bettencourt, and D. K. Duvenaud. Neural ordinary differential equations. In Advances in neural information processing systems, pages 6571–6583, 2018.</p><p>[7] Y. Lu, A. Zhong, Q. Li, and B. Dong. Beyond finite layer neural networks: Bridging deep architectures and numerical differential equations. arXiv preprint arXiv:1710.10121, 2017.</p><p>[8] T. N. Kipf and M. Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.</p><p>[9] P. Velickovic, G. Cucurull, A. Casanova, A. Romero, P. Lio, and Y. Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017.</p><p>[10] Chen, Deli, et al. “Measuring and Relieving the Over-smoothing Problem for Graph Neural Networks from the Topological View.” <em>arXiv preprint arXiv:1909.03211</em> (2019).</p><p>[11] Y. Li, R. Yu, C. Shahabi, and Y. Liu. Diffusion convolutional recurrent neural network: Data-driven traffic forecasting. arXiv preprint arXiv:1707.01926, 2017</p><p>[12] X. Zhao, F. Chen, and J.-H. Cho. Deep learning for predicting dynamic uncertain opinions in network data. In 2018 IEEE International Conference on Big Data (Big Data), pages 1150–1155. IEEE, 2018.</p><p>[13] Z. Che, S. Purushotham, K. Cho, D. Sontag, and Y. Liu. Recurrent neural networks for multi-variate time series with missing values.Scientific reports, 8(1):6085, 2018.</p><p>[14] Rubanova, R. T. Chen, and D. Duvenaud. Latent odes for irregularly-sampled time series. arXiv preprint arXiv:1907.03907, 2019.</p><p>[15] B. Yu, H. Yin, and Z. Zhu. Spatio-temporal graph convolutional networks: A deep learning framework for traffic forecasting. In Proceedings of the 27th International Joint Conference on Artificial Intelligence (IJCAI), 2018.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5e44ac2b6ec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/graph-neural-ordinary-differential-equations-a5e44ac2b6ec">Graph Neural Ordinary Differential Equations</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Spearman’s rho. Why the 6?]]></title>
            <link>https://michaelpoli.medium.com/spearmans-rho-why-the-6-866a7020c004?source=rss-912c466c26f5------2</link>
            <guid isPermaLink="false">https://medium.com/p/866a7020c004</guid>
            <category><![CDATA[hypothesis]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[correlation]]></category>
            <category><![CDATA[hypothesis-testing]]></category>
            <dc:creator><![CDATA[Michael Poli]]></dc:creator>
            <pubDate>Sun, 09 Sep 2018 09:59:42 GMT</pubDate>
            <atom:updated>2018-09-11T12:53:36.597Z</atom:updated>
            <content:encoded><![CDATA[<p>Just the other day I came across this formula during one of my graduate classes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/229/1*AAu3B47ZvvDWCAe1IYlIiQ.png" /></figure><p>As someone with a background in control theory and deep learning I am very used to having my formulas work for arbitrary coefficients. You know, I like my deltas, epsilons and alphas. Of course, for the sake of my point, let us ignore the occasional “hacky” technique employed in deep learning to replace more thorough understanding of the underlying theory. The field is relatively young and for once the empirical engineering side of things seems to be outpacing pure math. Or possibly no one has realized yet that the theory is already in place, ready to be found in some obscure mathematical paper out there. But I digress.</p><p>Scouring online for an answer to my original question and title of this blog post, I came across this amazingly concise <a href="http://mathforum.org/library/drmath/view/52774.html">explanation</a>: simply put, it is a way to remove rho’s dependency on the number of data points <strong><em>N</em></strong> and rescale to the interval [-1, 1]. Let’s try to get there step by step with the help of some visualizations along the way.</p><p>First, what is Spearman’s rho and why is it useful? Spearman’s rho is a rank correlation coefficient, sometimes used in correlation analysis along other tools such as the well known Pearson’s correlation coefficient and Kendall’s tau. Pearson’s correlation usually suffices but sometimes when the dependency between variables is not linear it can fail to point out a perfect correlation. As a simple example, consider y = sin(x) in some interval <em>[x1, x2]</em>. There is a deterministic mapping between x and y, but it is not linear (assuming no <a href="https://en.wikipedia.org/wiki/Kernel_method">kernel transformations</a> applied to sin(x), y = k with k = sin(x) would be a different story) but corr(x,y) is not 1. To explain how it works I’m gonna borrow an example from the class where I originally came across Spearman’s rho:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*B_6auxQfNljJGakYgXGFaw.gif" /><figcaption>Two cases: high rank correlation and low rank correlation</figcaption></figure><p>Visually, it is easy to see how less overlap of the rank vectors implies a lower correlation of feature A and B. Of course this is also what the formula states: rho is calculated by subtracting to 1 the <em>square</em> of the element-wise distance of the rank vectors multiplied by 6/(n*(n²-1)). As it is defined, d² takes a minimum value of 0 when the rank vectors overlap perfectly and a maximum value of n(n²-1)/3 when the correlation is minimum, which happens when the ranks are in opposite order. ([5,4,3,2,1] and [1,2,3,4,5] → d² = 40). So what is happening is that our measure of correlation depends on the number of data points instead of being standardized like all others. Ideally, we would like to remain in the familiar range [-1, 1].</p><p>The next logical step then involves taking our values [0, n(n²-1)/3] and applying a linear transformation to [0, -2] . This way,</p><blockquote><em>if d² = 0 → rho = 1–0 = 1</em></blockquote><p>and</p><blockquote><em>if d² = n(n²-1)/3 → rho = 1–2 = -1</em></blockquote><p>The two points of interests are then P1 = (n(n²-1)/3, -2) and P2 = (0, 0) because of the mapping we have in mind.</p><p>Recall that the slope of the line between two points is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/112/1*x1DS24QR9aHMSFC832Qujw.png" /></figure><p>Which, if we take P1 and P2 as our two points, ends up being:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/81/1*sdg9rFtW_8ildJTEBzl2Vw.png" /><figcaption>slope of the line between P1 and P2</figcaption></figure><p>Looks familiar? Spearman’s rho formula can be broken down in the following steps. We take our measure of distance in rank space (d²) and then run it through a linear affine transformation of the form:</p><blockquote>T1 : [0, n(n²-1)/3] → [-2, 0], T1(x) = 6*x/(n*(n²-1))</blockquote><blockquote>T2 : [-2, 0] → [-1,1], T2(x) = 1-x</blockquote><blockquote>T2(T1(d²)): [0, n(n²-1)/3] → [-1,1]</blockquote><p>And the mystery is solved.</p><h3>Final words:</h3><p>I write these blog posts to mostly just to explain things to myself in order to gain a deeper and more complete understanding of whatever material I am currently captivated by. As such, please don’t hesitate to point out any mistakes, I would be more than happy to correct them right away. Also, please follow me on <a href="https://twitter.com/MichaelPoli6?lang=en">Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=866a7020c004" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>