<?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 Kissner on Medium]]></title>
        <description><![CDATA[Stories by Michael Kissner on Medium]]></description>
        <link>https://medium.com/@kayzaks?source=rss-612a91cef229------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ApfUu8Lq8-3kLbmXS_Wb1w.png</url>
            <title>Stories by Michael Kissner on Medium</title>
            <link>https://medium.com/@kayzaks?source=rss-612a91cef229------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 19:35:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kayzaks/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[Network of Networks — A Neural-Symbolic Approach to Inverse-Graphics]]></title>
            <link>https://medium.com/data-science/network-of-networks-a-neural-symbolic-approach-to-inverse-graphics-acf3998ab3d?source=rss-612a91cef229------2</link>
            <guid isPermaLink="false">https://medium.com/p/acf3998ab3d</guid>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[meta-learning]]></category>
            <category><![CDATA[capsule-networks]]></category>
            <dc:creator><![CDATA[Michael Kissner]]></dc:creator>
            <pubDate>Tue, 23 Jul 2019 13:00:45 GMT</pubDate>
            <atom:updated>2019-07-23T15:44:20.841Z</atom:updated>
            <content:encoded><![CDATA[<h3>Network of Networks — A Neural-Symbolic Approach to Inverse-Graphics</h3><p>One of the first ideas many people have once they get acquainted with deep learning and neural networks is, “what if we make a network of neural networks?”. That is a perfectly valid idea, one that is explored in many different ways. The most common place one finds this kind of approach is in automated machine learning (<a href="https://www.ml4aad.org/automl/">AutoML</a>), where small pieces of mini-networks are recombined to find a complete neural architecture that ideally suits some machine learning problem. What I want to explore in this article is both very similar to AutoML, yet very different. My goal is to convey an idea, rather than present formulas. If you are interested in the details, you can find them in our paper “A Neural-Symbolic Architecture for Inverse Graphics Improved by Lifelong Meta-Learning” (<a href="https://arxiv.org/abs/1905.08910">https://arxiv.org/abs/1905.08910</a>).</p><p>So, what if we could design a network for computer vision where each node represents some object and the connections indicate what objects are part of another object? What if this network encounters a new object and simply adds it as a node to the network? It might look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*KM9UrApsbYmmAgOOcuYZPA.png" /><figcaption>A Network that grows with each new object it sees, by connecting it to other objects that make up its parts.</figcaption></figure><p>Sure, in some sense our current convolutional neural networks (CNN) do something very similar internally. By retraining them, you’d probably also be able to learn additional objects as well. But why retrain everything, if most of the network isn’t doing anything new? And at what point do we need to enlarge a neural network to fit more object types? The above image seems to indicate that there might be an alternative approach.</p><h3>Generative Grammar</h3><p>Let’s take a step back. A large step back. Let’s look at the reverse scenario. What if we want to generate an image based on a single word, such as <em>[House]</em>? Well, we would take a look at what this <em>[House]</em> is made of. Probably a <em>[Roof]</em> and some <em>[Ground Floor]</em>. And what is the <em>[Ground Floor]</em> made of? Multiple <em>[Wall]s</em>, a <em>[Door] </em>and <em>[Window]s</em>. Everything is made of something. This process can be summarized in a <strong>generative grammar </strong>and we call the individual things we put in brackets a <strong>symbol</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*nJO-tEJ1NBMb7ZSrnW6XBw.png" /><figcaption>A partial parse-tree of a generative grammar for a [House].</figcaption></figure><p>Well, that looks awkwardly close to the network we had before, just the other way around… And we’ll get to that. But first, we’ll explore how to get from <em>[House] </em>to a fully drawn picture of an actual house. There is a set of extremely primitive graphical elements from which we can draw anything. The most basic is obviously the pixel, but we won’t go that deep (although you could). Take something higher level and let’s assume you can draw the entire world using nothing but <em>[Square]s, [Circle]s </em>and <em>[Triangle]s. </em>What would our house look like then?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*BZ087U72U54iliIBNITJjw.png" /><figcaption>A [House] drawn from a starting symbol using triangles and squares.</figcaption></figure><p>Cool. Do we have control over this process? Sure! Each element can have <strong>attributes </strong>that controls how it’s drawn. A <em>[House]</em> has a <em>position</em>, <em>size </em>and <em>rotation </em>which govern the rendering process. Think of them like the attributes an object has in a game engine. We might as well include more complex attributes, such as how <em>old </em>or <em>yellow </em>it is, i.e., adjectives.</p><p>Further, a <em>[House]</em> can have multiple floors. We can thus decide if a <em>[House] </em>should be drawn as <em>[Roof][Ground Floor]</em> or as <em>[Roof][Floor][Ground Floor]</em>. These different possibilities are called the <strong>rules </strong>of a grammar.</p><h3>Primitives</h3><p>Let’s focus on a <em>[Square] </em>for now. It has attributes of its own, but we still need a way to draw it to the screen. So, we introduce a rendering function that does this. This is quite easy for the primitives we chose. We’ll refer to this rendering function as the <strong>decoder</strong>, as it basically decodes the attributes into actual pixels.</p><p>Obviously, each symbol higher up in the hierachy also needs some sort of decoder that converts its own attributes into valid ones for those that follow. For example the decoder for the rule <em>[House] → [Roof][Ground Floor]</em> would take the house’s position located at the center and calculate the center position for the roof and ground floor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*itnfLiQEbvHONpPnyyxptw.png" /></figure><p>Very nice. We can draw images. The exact opposite of what we actually wanted to do… So, let’s flip the entire thing around.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1PLWVoBYClP5qdQz6LvEqw.png" /><figcaption>“Flipping” the Parse-Tree around.</figcaption></figure><p>But we must flip a lot more things than just the connections. First, we must invert the decoder, so that it becomes an <strong>encoder</strong>.</p><h3>Primitive Capsules</h3><p>The encoder of a <em>[Triangle] </em>takes in the pixel values and tries to find the valid attributes for that triangle. Easy enough. Let’s just take some some regression model and plug that in. We can even generate all the training data ourselves, as we know how to draw the triangle using the attributes.</p><p>But that’s not good enough. What if its shown a picture of a circle instead of a triangle? The regression model doesn’t care, it will just produce weird attributes. We need a way to verify that the image is truly a triangle.</p><p>How about, we take the attributes the regression model produced, render a triangle with it and check if those images agree. If it was a triangle in the first place, we should have agreement, otherwise not!</p><p>So, we are encoding and then decoding.. That’s just an <strong>auto-encoder</strong>! Well, not entirely, as we hand-crafted the decoder. But still… We then just add a small <strong>agreement function</strong> to it, which gives us a probability of how likely the image is a triangle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*omFaUrmJQPhufjlNHeAuuw.png" /><figcaption>A look at the internals of a primitive capsule. An example of agreement (a [Triangle] capsule shown a triangle).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yhrT5R-0JYLcZ7TcgGF9uw.png" /><figcaption>An example of disagreement (a [Triangle] capsule shown a circle).</figcaption></figure><p>We now have both, all the attributes and the probability from the agreement. Neat. Let’s call this inverted symbol with all its internals (encoder, decoder, agreement function, …) a <strong>capsule</strong>. More specifically a <strong>primitive capsule</strong>, as it represents the graphical primitives. These primitive capsules follow the simple rule: <strong>If we can render it, we can de-render it</strong>…<strong> </strong>at least into something that produces the same image.</p><h3>Semantic Capsules</h3><p>For the next layers of capsules, things are a bit more complicated. These take in the primitives from the primitive capsules and check if they are the correct parts for the object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/1*LGtgL5r-JGQvOMNvJVInsg.png" /><figcaption>A Semantic Capsule ([House]) activating based on the output of the Primitive Capsules ([Triangle] and [Square])</figcaption></figure><p>We don’t know how the decoder works that takes the ouputs of the primitive capsules and tells us the attributes of an object. Thus, we can’t train an encoder… What if we pretend we know what the encoder looks like? Seems strange, right… But consider our <em>[House]</em>, which is made up of a <em>[Triangle]</em> for the roof and a <em>[Square] </em>representing the ground floor. During a forward pass, we know all attributes of the square and triangle. The size of the entire house can then just be taken as the sum of the sizes of its parts. For the position and rotation of the house, we just take the mean of both the square and the triangle. This same process goes for all other attributes, such as color, where we can just take the mean. An old ground floor (1.0) with a new roof (0.0) just looks like a mid-age house (0.5). This is the rough idea: We assume, at least at the beginning, that our encoder is similar to a mean function.</p><p>Obviously, with such a general mean function, any <strong>configuration </strong>of <em>[Triangle]</em> and <em>[Square] </em>would make a valid <em>[House]</em>. We don’t want that. Let’s again create an encoder-decoder pair with an agreement function. This time, we need to train the decoder instead of the encoder, but we’ll train it on real houses. Now, each time a configuration of squares and triangles is passed to the <em>[House] </em>capsule, it encodes it and then attempts to recreate the house from those attributes. If the result somewhat agrees with the original, then its a house. Otherwise its not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XP7DUNWo6ZOdYPhvE9aUPQ.png" /><figcaption>A look at the internals of a semantic capsule.</figcaption></figure><p>Let’s call this type of capsule that checks part configurations, i.e., the agreement of semantics, a <strong>semantic capsule</strong>.</p><h3>Routing</h3><p>Now, I’ve mentioned that the symbols can have multiple different rules on how they are produced (A house with one or two floors, etc.). We need some way to do that with our capsules. What if we allow each capsule to have multiple such encoder-decoder pairs and check which one fits the best for the current image? Yeah, let’s do that! And let’s call each such possible pair a <strong>route</strong>. We’ll refer to the entire process as <strong>routing-by-agreement</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*N-Q5nJ0FXJBiZZ2O6e8gAQ.png" /><figcaption>Detailed look at the internals of a Capsule (Primitive and Semantic). Note the different routes highlighted in yellow.</figcaption></figure><p><em>(And here is why we call these things capsules. The idea of matching the inputs and finding the correct route is based on the capsule architecture introduced by </em><a href="https://arxiv.org/abs/1710.09829"><em>Sabour, Frosst and Hinton</em></a><em>. The capsules presented here, however, are a bit different and we refer to them as </em><strong><em>neural-symbolic capsules</em></strong><em> to not get things confused)</em></p><p>Each of the presented Capsules is essentially a small container for neural networks.</p><h3>Lifelong Meta-Learning</h3><p>Next, you might have noticed that each of the capsules presented here is independent of every other capsule. And you are right! Training one capsule has no effect on the others. We can add and move around capsules as we please (checking that the attributes match of course). How about we let the entire network grow with each new object it encounters!</p><p>First we need to find a way to determine when the network actually encounters something it does not understand. As it is based on grammar, this is quite easy. Everytime the individual capsules activate and detect an object, there is some “root” object, i.e., one object that represents the entire image. In grammar terms, this is called an <strong>axiom</strong>. In our capsule network, this “root” does not need to be at the highest layer. If the image just contains a <em>[Roof]</em> the <em>[House] </em>capsule won’t activate, but <em>[Roof]</em> will still be the “root” that fully represents the image. We’ll refer to this <strong>observed </strong>“root” as an axiom as well.</p><p>However, multiple such axioms can activate in a single image. Take a <em>[House]</em> and a <em>[Garage] </em>which both have activated but do not share a common parent. We thus seem to have two axioms, which we don’t allow. If this happens, it means we encountered a new object or scene to which all these axioms are mere parts, such as <em>[House]</em> and <em>[Garage] </em>are parts of an <em>[Estate].</em></p><p>Consider a different example and let’s again take our network that has learned how to detect <em>[House]</em>. It knows how to deal with a ground floor. But what if there are more? What if there are five additional <em>[Floor]</em> activations? Then the <em>[House] </em>capsule won’t activate. Sure, it can generate some attributes for the ground floor plus one of the five floors, but its agreement function will notice that the roof is way out of place. We must add a new capsule that acts as the new axiom for these activated capsules, such as an <em>[Appartement]</em> capsule.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*KM9UrApsbYmmAgOOcuYZPA.png" /><figcaption>Slightly different example of capsules activating (blue), but there is a shared axiom missing (left). This is rectified by adding a new capsule that acts as the parent to all previously dangling capsules (right).</figcaption></figure><p>Note, however, that we do not halt at distinct objects, but also describe scenes. <em>[Office]</em>, <em>[Singapore Orchard Road]</em>, <em>[Baseball Game]</em>, all are perfectly valid. Imagine a picture with 10 houses. We would have 10 <em>[House]</em> acrtivations. This, again, violates the “only one axiom” rule we have. So, we create one called <em>[Town Road Scene]</em>.</p><p>Of course, this decision requires some creativity. Coming up with names for now capsules or attributes is still a human task. What the capsule network can do, however, is pose a question and the network will respond with meta-learning. Like the following:</p><p>Q: “<strong>These floors and roof look like a house, but what is it?</strong>” <em>([House] did not activate even though multiple [Floor]s and [Roof] were present)</em></p><p>Now, this can trigger different responses by the human. Each indicating a different meta-learning procedure.</p><p>A.1: “<strong>It’s a House.</strong>” <em>(Meta-learning trains a new route for the existing [House] capsule)</em></p><p>A.2: “<strong>It’s an Appartement.</strong>” <em>(Meta-learning trains a new [Appartement] capsule)</em></p><p>B.1: “<strong>It’s an old House.</strong>” <em>(Meta-learning continues training the existing attribute “old” with new data for the [House] capsule)</em></p><p>B.2: “<strong>It’s a rich House.</strong>” <em>(Meta-learning trains a new attribute “rich” for the existing [House] capsule)</em></p><p>If we collect enough of these decisions by a human, we can train a decision matrix for the capsule network. Then, once it has learned enough responses, the network can make these decisions on its own and refine its original question or even answer it itself!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*amKoosICiS_yh_iL9usRTg.png" /><figcaption>An excerpt of a decision matrix. Each of those features says something about the current activations in the network, the details of which are unimportant at this point. For all features that evaluate to “True”, the values on the right are added up and the column with the highest value is equal to the decision (A.1 — B.2). Training this matrix simply means adding “1” to the column that was chosen by the human for the rows that evaluate to “True”.</figcaption></figure><p>But what do we train these newly added capsules, routes or attributes with? With the data that it just received? Sure, but that’s not enough now, is it? How about we <strong>augment </strong>that data! This is actually quite easy in our case. We have access to all the attributes after all. Moving the appartement around (adding to the position attributes of the appartement and the produced floor/roof symbols) doesn’t change the fact that its an appartement and we can generate huge amounts of data doing just that. Neither does rotating or resizing change the apartement. We can do this to almost all attributes. If each floor has an <em>old </em>or <em>yellow </em>attribute, we can shift those all at once and augment the training set. For an <em>old </em>appartement we would assume that all floors and the roof are <em>old, </em>but it would still remain an appartement.</p><p>Obviously we will make mistakes with this rough augmentation, but its a start. Better than nothing considering we only have one image to go by. Single-shot is difficult, even when we are cheating.</p><p>Now, next time the network sees an appartement, it will… maybe understand it. But we can always add more training data as the network encounts the same type of image, again using our augmentation strategy. This isn’t too intensive computationally, as we isolated each capsule and don’t need to retrain the rest of the network. And, slowly, it will understand… This entire meta-learning process is very much like teaching a toddler what objects are. And as with toddlers, it is subjective and depends very much on the what and in what order the parent teaches it. Take, for example, the following two capsule networks trained in a different way, but reaching the same conclusion:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KbYRKRjEmSZIrVicjN45GQ.png" /><figcaption>Two capsule networks meant to train for an asteroids like environment, but both end up with a different network configuration.</figcaption></figure><p>The difference is subtle, but as time goes on, those two networks will diverge further and further from each other.</p><p>We now have an entire network that can detect various objects, learn to detect new ones over time and even gives us attributes for it.</p><p>But we can also do some other neat things! We can</p><ul><li>generate a semantic network of the scene! I.e., the parse-tree of the underlying grammar.</li><li>re-use the capsule network and simply expand on it! No need to retrain the old stuff and allow for some federated learning.</li><li>use the capsule network in reverse (as the original grammar) and generate images with it! It’s just an inverse graphics engine under the hood.</li><li>use the attributes to segment the image! We know all the sizes and positions.</li><li>generate basic descriptions of the image! After all, a capsule’s symbol is just a noun (<em>[House]</em>, …), an attribute is just a preposition (position, rotation, …), an adjective (old, yellow, …) or a verb (explored in a later part), and their magnitude can be interpreted as an adverb (0.0 = not, very = 1.0, …)</li><li>do simple style transfers! Using multiple rules/routes, a <em>[Door]</em> can be drawn as a square (abstract) or as an actual door (real) and this automatically transfers to any object that has a <em>[Door] </em>as its part.</li><li>do physics! Inverse-simulation anyone?</li></ul><h3>Conclusion</h3><p>I’ve left out a lot of the details found <a href="https://arxiv.org/abs/1905.08910">in the paper</a>, such as how the network and the grammar deal with occlusion, how exactly the meta-learning agent expands on the network, the “observation table” to avoid using multiple copies of the same capsule and much more. But I hope I was able to convey a general idea.</p><p>In the next part, I want to explore how physics works using this approach ( <a href="https://arxiv.org/abs/1905.09891">https://arxiv.org/abs/1905.09891</a>) and how the capsule network evolves from an inverse-graphics-engine to an inverse-simulation-engine, hopefully one day ending with an inverse-game-engine.</p><p>And, yes. Most of the results so far are far from impressive and it remains to be shown if this can even be extended to real images instead of the MSPaint-level of inputs it currently works on. Kosiorek et. al. developed a different method based on similar principles called “Stacked Capsule Autoencoders” ( <a href="https://arxiv.org/abs/1906.06818">https://arxiv.org/abs/1906.06818</a>), which are definitely worth checking out if this sort of thing interests you!</p><p>My main hope is that this slightly different approach was both entertaining and perhaps gave you some ideas you could explore, by incorporating more old-school symbolic methods.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acf3998ab3d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/network-of-networks-a-neural-symbolic-approach-to-inverse-graphics-acf3998ab3d">Network of Networks — A Neural-Symbolic Approach to Inverse-Graphics</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[An Easy Guide to Gauge Equivariant Convolutional Networks]]></title>
            <link>https://medium.com/data-science/an-easy-guide-to-gauge-equivariant-convolutional-networks-9366fb600b70?source=rss-612a91cef229------2</link>
            <guid isPermaLink="false">https://medium.com/p/9366fb600b70</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[convolutional-network]]></category>
            <dc:creator><![CDATA[Michael Kissner]]></dc:creator>
            <pubDate>Fri, 24 May 2019 15:25:44 GMT</pubDate>
            <atom:updated>2019-05-27T06:20:26.368Z</atom:updated>
            <content:encoded><![CDATA[<p>Geometric deep learning is a very exciting new field, but its mathematics is slowly drifting into the territory of algebraic topology and theoretical physics. This is especially true for the paper “Gauge Equivariant Convolutional Networks and the Icosahedral CNN” by Cohen et. al.(<a href="https://arxiv.org/abs/1902.04615">https://arxiv.org/abs/1902.04615</a>), which I want to explore in this article. The paper uses the language of gauge theory, which lies in the center of anything in physics that likes to use the words “quantum” and “field” together. It promises to give an intuitive understanding of the basics of gauge theory and I must say, it delivers and is probably the nicest introduction I have seen so far. But it still remains a difficult subject.</p><p>What I want to do here, is give a purely intuitive understanding, with no math. While I don’t follow the structure of the paper exactly, you can still open the paper side-by-side, as I will try and highlight all important terminology.</p><p>In the following I’ll assume you know how convolutional neural networks (CNN) work, but have no idea what they have to do with manifolds. So let’s go!</p><h3>Manifolds</h3><p>A <strong>manifold</strong> is a simple thing. Every 2-D surface you see can be considered a manifold. The surface of a sphere, the surface of a cube, all manifolds. But its not restricted to 2-D, heck, its not even restricted to things that can be imagined. A curve is a manifold. 4-D Space-time is a manifold. Its quite general and describes a space. But let’s focus on 2-D surfaces. The simplest surface is a plane, such as a computer screen. And when we do convolution with CNNs, we usually do it on these flat images.</p><p>Let’s say, we want to predict the weather with CNNs. For a single country, this is quite easy: Use the local weather data as input and keras-keras-boom, you have a trained model. What if we want to classify the weather for the entire planet? How do you fit that onto a single image? Perhaps:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QrfdaFmrjd_ARGVR_NHOxA.jpeg" /><figcaption>(Image by Pixabay)</figcaption></figure><p>But there is a problem. The left and the right edge are the same spot in reality. Further, the entire top edge corresponds to a single point, as does the lower edge. The whole thing is distorted. Ever tried flattening a ping-pong-ball? Yeah, that doesn’t go well. When we try to apply convolution, we would get strange results. Unphysical things might happen at the edges. It might predict a strong east wind on the far right of the image, but nothing on the left side of the image, even though they represent the same spot. The CNN just doesn’t understand that the earth wraps around.</p><p>Alternatively, we could create multiple overlapping <strong>maps</strong> for the earth and have a CNN that operates on those. This collection of maps is also called an <strong>atlas</strong>.<strong> Shifting</strong> the CNN over all these individual maps, making sure to continue on the next map right at the same point they overlapped on, should then enable it to understand that the earth is round. This is the basic idea behind geometric deep learning: Directly apply deep learning to surfaces or manifolds to preserve their geometric structure. However, there’s a problem. A big one.</p><h3>Let’s go to Singapore!</h3><p>For now, let’s forget about weather for a second and take out a compass. Let’s say you are in Singapore. Head north, past Thailand, through China, Mongolia up to the north pole. And without changing direction, keep going forward. You’ll be going through Canada, the US until you end up somewhere in Central America. Stop right there and start swimming side-ways through the Pacific, without changing direction! After a few million strokes, you should end up back in Singapore. But wait. You never changed direction, why are you looking south?</p><p>Let’s repeat that, but this time we go sideways to the left once we reach the north pole. We’ll end up near Nigera and start walking backwards, again not changing our direction. Once we’re back in Singapore, this time we are looking west? Strange… Don’t believe me? Try it out yourself, just get a compass and start swimming…</p><p>This problem is due to the curvature of the sphere and we refer to “moving around without changing direction” as <strong>parallel transport</strong>. You saw that parallel transport is very dependent on the path taken on a sphere. On the 2-D plane, however, it doesn’t matter. You can walk every path without changing direction and have the same direction once you get back. Thus, we say that the plane is <strong>parallelizable</strong> (your direction vector stays parallel once you get back), whereas the sphere is not.</p><p>You can see that this is a problem for our CNN on a sphere. If we shift our CNN in different ways over all our maps, the direction seems to change. We need to find a way to make sure that this weirdness does not affect our result! Or, at least we should know how to deal with it.</p><h3>Hairy, Hairy Balls</h3><p>Before we find a solution, we must introduce more math concepts. A compass needle can be viewed as a vector on a plane pointing in some direction, mostly north. This plane the needle rotates on is tangential to the earth’s surface and we’ll refer to it as the earth’s <strong>tangent space</strong> at this spot. Even though the earth is round, the tangent space is perfectly flat. It acts like a local <strong>coordinate system</strong> with north and east being its <strong>coordinate vectors</strong>. And, as we can take our compass out at any spot on earth, each spot has its own tangent space. But we could also define 40° and 130° as our coordinate vectors. North and the other directions are nothing special in this case and the choice is arbitrary.</p><p>Now, let’s choose any direction in our tangent space and follow it with a step forward. We make sure to take the shortest path (<strong>geodesic</strong>) and end up at a new point. You might call this “going forward”, but to confuse everyone, we’ll call this process the <strong>exponential map </strong>(which comes from the fact that all these tiny steps magically resemble the series expansion of the exponential function… but that’s not important now).</p><p>Let’s look at our compass needle again. The fact that the compass assigns a vector to “every” spot on earth is called a <strong>(tangent) vector field</strong>. Wind can also be seen as a vector field, as it assigns a direction to every point. I specifically put “every” in quotes, as something goes wrong with the compass needle when you stand directly on magnetic north or magnetic south. As a matter of fact, it goes wrong for every non-zero continuous vector field on a sphere. We <em>must </em>have poles in our magnetic field on the sphere. This phenomena is called the hairy ball theorem, as it is akin to not being able to comb a hairy ball, without creating twirls:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/1*AdxLhUxZrAWxMAyL5iTFtQ.png" /><figcaption>(Image from Wikipedia)</figcaption></figure><p>Vector fields don’t need to have the same dimension as the tangent space. Instead, they can have their own <strong>vector space</strong> of arbitrary dimension at each point. This is important, because we also want to be able to assign 3-D or 99-D vectors to each point on earth and not just 2-D directions. This vector space at each point of a field is also referred to as a <strong>fiber</strong>.</p><p>(A special type of field is the <strong>scalar field</strong>. It has just one dimension and temperature can be viewed as such a scalar field)</p><h3>Gauge</h3><p>Temperature is measured differently everywhere. Here in Germany, we use Celsius. In the US they use Fahrenheit. This choice is called a <strong>gauge</strong>. And yes, that word derives from the measuring instrument. Now, when I read a weather forecast from the US, I have to calculate what the temperature in Fahrenheit means in Celsius. We have different <strong>frames </strong>of reference. This calculation is called a <strong>gauge transformation</strong>. Note that the actual temperature didn’t change, just the value we use to understand it and the transformation is a simple linear function.</p><p>If we look at vector fields, such as wind direction, things get more complicated. To take this to the extreme, let’s pretend theres some country, Gaugeland, that doesn’t really care about north and south and has its own direction system based on star constellations or the direction a hedgehog runs when its scared. When these people describe wind, we must perform a gauge transformation to understand the direction they are talking about. Now the gauge transformation becomes a multiplication by an <strong>invertible matrix </strong>(it must go both ways obviously). This group of matrices is called<strong> </strong>the <strong>general linear group</strong> or <strong>GL</strong>.</p><p>For a theoretical flat earth, a choice of gauge for wind can be global. But on a sphere, we run into problems. We can’t define a single global gauge, but must instead rely on multiple gauges and maps. From our problem of parallelization on the sphere and the hairy ball theorem, we should have some intuition why this must be so.</p><p>This automatically means, that we need multiple wind maps. However, we no longer allow all of Gaugeland’s shenaniganz and demand that at least the magnitude of the vectors they use (wind speed) must be the same as ours. We only allow them to use different directions. Each gauge transformation is thus reduced to a rotation. These transformations also form a group, namely the <strong>special orthogonal group</strong> or<strong> SO</strong>, which is a subgroup of GL. We have effectively <strong>reduced </strong>the allowed transformations our gauge theory may have, by choosing a different <strong>structure group</strong>.</p><h3><strong>Back to Deep Learning</strong></h3><p>We are back to our original problem and want to perform convolution on a vector field of wind directions. Here, the wind represents the input features. Say we want to to find tornado directions as output. We can perform convolution on “small patches” to extract these output features from the wind directions. (<em>Note: I have no idea if this makes meteorological sense… input vectors to output vectors... that’s all we need to know</em>)</p><p>But “small patches” is a very vague description. On the 2-D plane, it is straightforward, we can just take everything that is inside some ball around the center of the patch. This also works, to some extent, on a perfect sphere. But on an arbitrary manifold? Things get tricky. Take a look at this funky manifold:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*UE9wAohOCT72Q5C0w0sD3w.png" /><figcaption>(Image from Wikipedia)</figcaption></figure><p>It’s called a Klein bottle and we can see that taking the raw distance between points is… problematic. We will probably never need the Klein bottle for deep learning, but we want to keep things as general as possible.</p><p>What we need is a way to only include points in convolution that are nearby on the manifold. And we do have a way to do that. Recall that the exponential map does tiny steps on our manifold to find nearby points. So let’s use that. Starting at the center, we go a step in every direction the tangent space allows us and include that point in our convolution.</p><p>All we need now is some function to do convolution with. So, we define a <strong>kernel </strong>that assigns a matrix to each poin-… wait, no, each direction of the tangent space we went with our exponential map. It’s a bit strange, but when you look at classic 2-D convolution, it actually does the same. Its just not that obvious, because its on a plane.</p><p>This matrix multiplies an input vector and produces an output vector. Here, the authors identified the first problem. This matrix is only defined for the center. But we are applying it to field vectors of nearby points, that have their own weird properties. On a plane, this isn’t a problem, but on our sphere, they are slightly different and we can’t just apply the kernel.</p><p>Let’s fix that and parallel transport the vectors at those points back to the center of our little patch. Here, we can apply our matrix, without having to worry about weird curvature problems.</p><h3>Gauge Equivariance</h3><p>The convolution we defined so far, seems sensible. We apply our kernels to wind data and get a nice result: tornados moving <em>east</em>. But somehow, we still get different results compared to Gaugeland? They predicted tornados are moving <em>hedgehog-left</em>?</p><p>Ahhh, yes: We need to gauge transform their result into our frame aaaand voila: They predict tornados going <em>west..</em>. Still wrong...</p><p>What happened? We forgot to make our convolution <strong>gauge equivariant</strong>. In short, the result of the kernel must depend on the chosen gauge and transform equivariantly. If it doesn’t, we just get weird results all over that can’t be correlated or compared with one another.</p><p>But the output vector might be a different dimension or have a different interpretation than the input, how do we relate gauge transformations of the inputs to equivariant “gauge transformations” of the outputs? Well, as the structure group only acts on the inputs, the idea is to find a <strong>representation </strong>of that same group that acts on the output vectors. For example, a transformation of a 2-D input vector with a rotation group as its structure group can be represented by a 3-D output vector being rotated around a single axis. When the 2-D vector rotates, the 3-D output also rotates around a fixed axis. Generally, there can be many representations, like there could be many different rotation axis in 3-D. The point is, that it does something that represents the same action.</p><p>With the idea of representation in place, we can make convolution gauge equivariant. We just need to make sure that a gauge transformation of the input vector results in an equivariant transformation (i.e., the same transformation, but in the appropriate representation) of the output vector.</p><p>Now, with gauge equivariance, when we perform convolution on different maps, we get different results numerically, but their results agree. This is the best way we can define convolution to make sense over the entire sphere.</p><h3>Icosahedron?</h3><p>We basically covered Section 2 of the paper. The authors now move on to Icosahedrons, which are very similar to spheres topologically, but nicer. They are nicer in the sense that we can discretize them far more easily than the sphere.</p><p>Just like when we covered the earth with multiple maps, let’s cover the Icosahedron with 5 overlapping maps (overlap is indicated by the tiny all white triangles):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*TDowJdT-tvhOmFzo79vCdQ.png" /><figcaption>(Image from the paper)</figcaption></figure><p>Beautiful, the maps even are the same size. No wonder they chose this manifold. We can also view it as a graph. Note that each node, i.e., each intersection, is a point on the manifold with an input feature vector (not visible in the image above). Each little triangle has 3 corners, with each corner being one of these nodes. They are what interests us.</p><p>So, let’s do convolution!</p><p>First, we need to see what our exponential map looks like. Well, on our discrete manifold, that’s easy. We just start at a node and go one step in any direction. The directions are visible in the image above as the lines connecting the nodes. So, most nodes have <strong>6 neighbours</strong>, except those at the corners of the Icosahedron, which have 5 neighbours.</p><p>Next, we need a kernel function. But we are lazy and don’t want to reinvent the wheel. So, we’ll just use <strong>3 x 3 filters</strong> from standard 2D convolution. These 3 x 3 filters have a center point and 8 neighbours. That’s more than we need. So, let’s just ignore the top-right and bottom-left neighbour in the 3 x 3 grid by setting them to 0 and pretend it only ever had 6 neighbours.</p><p>All that’s left is to make this thing gauge equivariant. Well, let’s look at the structure group of our Icosahedron. We already noted that we can only go in 6 different directions. If we were to describe wind on this structure, we would only have 6 different frames of reference, each rotated by 60°. This can also be formulated as having <strong>cyclic group of order 6</strong>, or <strong>C6</strong>, as its structure group.</p><p>Finally, I mentioned that our maps are overlapping. So, if we want to shift our convolutional filter over a region with overlap, we are basically using values from a different map. And what do we do with these values? We gauge transform them into the correct frame before we use them. And voila, we are doing convolution on a icosahedron.</p><h3>Conclusion</h3><p>In my opinion, this paper provides a fundamental result for the field of geometric deep learning. Understanding the overall idea and importance of gauge equivariance while doing convolution is the main take-away here.</p><p>I hope my non-math explanation was helpful in understanding the ideas presented in the paper. If you find this sort of thing interesting and want the hardcore math, definitely check out Nakahara’s “Geometry, Topology and Physics”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9366fb600b70" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/an-easy-guide-to-gauge-equivariant-convolutional-networks-9366fb600b70">An Easy Guide to Gauge Equivariant Convolutional Networks</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[Writing down the weights and biases of a universal Neural Network without training it]]></title>
            <link>https://medium.com/@kayzaks/writing-down-the-weights-and-biases-of-a-universal-neural-network-without-training-it-5d184bab128?source=rss-612a91cef229------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d184bab128</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Michael Kissner]]></dc:creator>
            <pubDate>Wed, 20 Feb 2019 20:26:29 GMT</pubDate>
            <atom:updated>2019-02-20T20:26:29.210Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, well a day ago, Lee et al. uploaded <a href="https://arxiv.org/abs/1902.06720">a paper</a> that talks about the learning dynamics of wide Neural Networks (NN), which sparked a lively discussion on Reddit and among some of my friends. The paper itself is very interesting and I do suggest taking a look at it, our discussion however drifted off into the Universal Approximation Theorem (UAT) and its meaning. What I want to present here is a very simple way to actually construct a wide NN that is a universal approximator. I’ll even show you how to write down all the weights and all the biases using simple formulas, without ever doing backpropagation. Of course this isn’t practical, just think of this as an alternative example to the typical XOR-Problem.</p><p>Let’s review the UAT. The UAT basically states that a NN of finite width with one or more hidden layers (depending on the activation function) can approximate any function on a compact domain. Cool.</p><p>Say we have some 1-dimensional function<em> </em><strong><em>f(x)</em></strong> that we wish to approximate. Classically we would choose appropriate basis functions and simply interpolate. So let’s try that by using many little hat functions <strong><em>h(x)</em></strong>. We can approximate <strong><em>f(x)</em></strong> using</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*85-bYWZUEqB0J9KbHfzbyw.png" /></figure><p>or if you are like me and like visualizations</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*a2FRD3GH_akNQHympW7hyQ.png" /><figcaption>An arbitrary function (blue) approximated by a linear combination of hat functions (red)</figcaption></figure><p>Nothing too fancy and standard knowledge from numerical analysis. This is just a linear interpolation of some function, where the support points are directly under the peak of each hat. The more hat functions you have, the more accurate your approximation.</p><p>Notice that I forgot to show you what the equation for such a weird hat function looks like. Well, here it is</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*MEJIYpV7sXXgyd0jxZDuiw.png" /></figure><p>Cool, a bit of linear stuff, a few max functions here and … Wait a minute, doesn’t ReLU use <strong><em>max </em></strong>as an activation function? Indeed it does. So, could we possibly replace each hat function by 3 neurons? Indeed we can:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/1*o9nssdl6S60DotQ5IHYRWQ.png" /><figcaption>Hat functions replaced by Neurons</figcaption></figure><p>Note that we apply the function value to each hat function in the output Neuron, which of course must have linear activation instead of ReLU or otherwise we lose all negative values. Now we can simply read off the weights and biases from the formula for hat functions. Done.</p><p>At least for 1-dimensional inputs and 1-dimensional outputs we are indeed done. What about the n-dimensional case?</p><p>Let’s take a look at how to do n-dimensional outputs. Here<strong> <em>f(x)</em></strong> describes a vector. We use the previous analysis to output the first component. But we can also reuse those hat functions and just apply the second component for the second output! The network would now look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/443/1*MDSp0KqjMYetexU1cWen6g.png" /><figcaption>The original hat function (red) reused for the second output (blue)</figcaption></figure><p>Repeat this for all other n outputs and we are done.</p><p>What about n-dimensional input? Easy, we just define n-dimensional hat functions! As an example, here is the 2-dimensional case:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*9mgrRaIrtUL2WbSnYU5QhA.png" /><figcaption>A 2-dimensional hat function</figcaption></figure><p>Where in the 1-dimensional case we had to choose how far apart each peak of the hat functions were, here we have to do the same by selecting a good 2-dimensional triangulation. Now, what does the function for the above look like?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j59IT40_AZdcGNA4mV-5Iw.png" /></figure><p>Again, we see a lot of <strong><em>max </em></strong>functions. And again, we can replace these by Neurons with ReLU activation function as we did earlier. I’ll spare you the image, as it just gets wider and wider…</p><p>For n-dimensions we create n-dimensional hat functions which live on some n-dimensional triangulation of space. A very tedious task to write down, but rest assured that all these hat functions are nothing more than a linear combination of <strong><em>max </em></strong>functions.</p><p>Finally, we combine both these techniques to define a NN that has any number of inputs and outputs and is able to interpolate any function linearily. And if we use infinitely many hat functions, we can infinitely increase its accuracy.</p><p>Now we can write down the exact weights, biases and NN architecture for a known function. A universal approximater in the sense of the UAT so to speak. We can even do this to some extend for data points / training data, if we perform segmented regression first. But the real question is, should we?</p><p>Of course not. It’s far too tedious to do by hand. Furthermore, we need an extremely wide NN to even approximate simple functions. The whole point of deep learning is to let backpropagation find the best way to do this even if constrained by width.</p><p>But I do hope that this was interesting. It will remain my go-to example when someone asks me if I can write down a NN for a function without backpropagation. Perhaps you will use it too.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d184bab128" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>