Discovering Symbolic Models from Deep Learning with Inductive Biases (Paper Explained)
deep learning machine learning arxiv explained neural networks ai artificial intelligence paper graph networks graph neural networks gnn physics newtonian hamiltonian dynamics cosmology dark matter symbolic regression edge vertex regularization
Neural networks are very good at predicting systems' numerical outputs, but not very good at deriving the discrete symbolic equations that govern many physical systems. This paper combines Graph Networks with symbolic regression and shows that the strong inductive biases of these models can be used to derive accurate symbolic equations from observation data.

OUTLINE:
0:00 - Intro & Outline
1:10 - Problem Statement
4:25 - Symbolic Regression
6:40 - Graph Neural Networks
12:05 - Inductive Biases for Physics
15:15 - How Graph Networks compute outputs
23:10 - Loss Backpropagation
24:30 - Graph Network Recap
26:10 - Analogies of GN to Newtonian Mechanics
28:40 - From Graph Network to Equation
33:50 - L1 Regularization of Edge Messages
40:10 - Newtonian Dynamics Example
43:10 - Cosmology Example
44:45 - Conclusions & Appendix

Paper: https://arxiv.org/abs/2006.11287
Code: https://github.com/MilesCranmer/symbolic_deep_learning

Abstract:
We develop a general approach to distill symbolic representations of a learned deep model by introducing strong inductive biases. We focus on Graph Neural Networks (GNNs). The technique works as follows: we first encourage sparse latent representations when we train a GNN in a supervised setting, then we apply symbolic regression to components of the learned model to extract explicit physical relations. We find the correct known equations, including force laws and Hamiltonians, can be extracted from the neural network. We then apply our method to a non-trivial cosmology example-a detailed dark matter simulation-and discover a new analytic formula which can predict the concentration of dark matter from the mass distribution of nearby cosmic structures. The symbolic expressions extracted from the GNN using our technique also generalized to out-of-distribution data better than the GNN itself. Our approach offers alternative directions for interpreting neural networks and discovering novel physical principles from the representations they learn.

Authors: Miles Cranmer, Alvaro Sanchez-Gonzalez, Peter Battaglia, Rui Xu, Kyle Cranmer, David Spergel, Shirley Ho

Links:
YouTube: https://www.youtube.com/c/yannickilcher
Twitter: https://twitter.com/ykilcher
Discord: https://discord.gg/4H8xxDF
BitChute: https://www.bitchute.com/channel/yannic-kilcher
Minds: https://www.minds.com/ykilcher
 Hi there, today we're looking at discovering symbolic models from deep learning with inductive biases by Miles Cranmer, Alvaro Sanchez-Gonzalez, Peter Pitalia, Rui Xu, Kyle Cranmer, David Spurgill and Shirley Ho. So this paper on a high level, it uses graph neural networks to fit a dataset of observations of a physical system. And then it uses symbolic regression in order to parse out equations, symbolic equations from the graph neural network. And the symbolic equations that will are found such they describe the physical system. And they do find, they do recover some known equations and they do find a new one in the field of cosmology. So we'll go through how they do it, what these two steps are and why this might work better than previous approaches. So yeah, join me. If you like content like this, as always, feel free to share it, subscribe if you haven't, if you want more content like this, and tell me what you think in the comments. All right, so they claim we develop a general approach to distill symbolic representation of a learned deep model by introducing strong inductive biases. And this, it doesn't really say a whole lot, but I think the abstract doesn't say a whole lot. So let me give you an example. If you have three different, let's say planets or stars, right? This is a, this three body problem is a unsolved problem, I think still. So if you have these three stars, and you just let the simulation run, they have gravity, they attract each other, right? So they are going to move around somehow. So this one's going to move here, this one's going to move like this, this one's going to move like this, and then it turns around and this one turns around and so on. So there is a fairly complex motions in already three different things that are somehow in a physical system together. This is a bigger problem than just stars. So you have these systems, for example, when these are atoms and there is like an electromagnetic force between them or the strong force. There can be, these can be things where springs are attached to them and so on. So our goal is to derive equations that govern this behavior, right? In the case of gravity, we know that these objects sort of pull on each other with the force proportional to something like the mass of the first times the mass of the second divided by the radius that they are a part squared. Something like this times like this gravitational constant. We know the equation that governs these interactions. We don't know the symbolic solution to the whole problem, but we know the equation that governs the interaction, right? Now imagine if we didn't know the equation, what do we have to do? Well, what did Newton do? Ultimately, he sat down and just came up with an equation that seemed okay to him and then found out that the equation actually does predict very accurately how the things move. So we're going to try to replicate that process in an AI system, the process of coming up with an equation that governs this behavior. So what we have is a data set. As I said, we let this stuff run. So we let it run for one time step and then this is here, maybe this is here and this is here, okay? And then we let it run for the next time step. This goes here, this goes here, this goes here and so on. So that will give us, basically it will give us frame by frame how this system evolves. Frame by frame. And that will give us a data set. So this right here, if we let it run and maybe we restarted a couple of times with different initializations, we let it run, we get a data set. So now we have a data set, right? So our goal is to be to take that data set and come up with an equation like m1, m2 divided by r squared that governs this behavior. Now previous approaches have resorted to symbolic regression, I think they call this. And that is basically, it's pretty simple. Namely, what you do is you simply provide the system with a bunch of options. You tell it, I have a list and the list can include the mass of the first, it can include the mass of the second, it can include the x and the y position of the things, it can include the delta x and delta y, which basically means the speed of the objects. It can include any constant a and b that you want. It can include the symbols plus, minus, division, multiplication, square, maybe exponential function and so on. So you give it a bunch of options of what it could potentially use in an equation. And then you simply let it make equations and you see how well these equations describe the data set. And the way you do that is you can do it naively by just searching and trying out, or you can be a little bit smarter about it and use evolutionary methods. So you start with some equations like this, okay, I'm going to x plus delta x minus a squared. You see how that describes the data set, you'll find not very well. And then you go on and you say, okay, maybe I'll make a small mutation, I'll mutate this to a minus and so on. And if you do this with an entire population, as is common in these evolutionary methods, you'll end up with something better at the end. Now this works until a point. So whenever the space of things to explore, like this one here, gets larger, and it doesn't have to be super large to already exhaust the capabilities of these methods. So these methods are very limited in the space they can search and have proven not really effective so far for this type of problem. This paper right here goes a different route. It uses graph neural networks in order to describe the data set. So in between this step of collecting a data set and making the equation, it fits another step. So it says in between here, we fit another step and that other step is going to be we have a graph neural network and you don't know yet, you don't have to know yet what that exactly is. But it's technique. It's like a type of neural network. And we're going to have that neural network learn the data set. Now as you know from neural networks, they can't do symbolic regression, they can't give you an equation, they can simply predict numbers. So what the network will do is it will simply predict like the motions or the accelerations, whatever you're interested in, it will predict those things as numbers, not as equations as just you can plug in this situation right here, and it will tell you how the things will move. Neural networks are pretty good at that. And once you have a graph neural network that can describe the system in a numeric fashion, then you parse out the equations from this graph neural network. And we're going to go over why that is going to be much, much easier than parsing out the equations directly from the physical system. It's going to be because you engineer the graph neural network in a way that makes it very congruent with physical reality that makes it very adapt to parse out equations like this that makes the job of this evolutionary method much easier. All right, so that's basically the two-step process here. First step is to numerically regress a neural network to describe the system, and then second step is going to be from that neural network parse out the equations. So we have to talk about graph neural networks. So here you see the entire process as they describe it. So they have this data set right here of observations of these physical systems. This is like, it's like any data set that you have in machine learning. They predict the dynamics, which means in a numeric fashion with a graph neural network, and then from the graph neural network, they extract the symbolic equation, as you can see right here. And this here is going to be the equation that they figure out that was previously unknown. They even say unknown dark matter over density equation. Cool. So we have to talk about graph neural networks. We haven't really done this on this channel so far. And I'm not like a big expert on graph neural networks. But they come in all shapes and forms. In this particular paper, they use what they call a type of interaction network that's called a graph network. So graph network is something different than graph neural network. I think graph network is a type of graph neural network. And specifically here, they use a network that... So a graph neural network has these things called vertices, and then it has edges, and edges connect vertices, like in a graph. Now we're going to build this graph neural network such that the number of vertices is exactly equal to the number of particles in our system. So in this paper, they consider systems with, I believe, four or eight particles. That's already a lot for if you want to derive equations and things. But of course, the physical world is made of many more particles. In any case, they consider four, let's say four particles right here. So what they're going to do, they're going to build a graph neural network that has four vertices, one for each of the particles. And in a graph neural network, every vertex can have properties. So the properties of each vertex here are going to be the properties of that particle. That means the x coordinate, for example, the y coordinate, and we're going to, let's say we're in two dimensions, right? It's a two dimensional problem. The x coordinate, the y coordinate, the delta x, the delta y, the mass, the, I don't know what else can we put here. There's a lot of stuff that we can put here, the charge, right? So all of these things are properties of the vertex. Then the other component of a graph are, of course, the edges. So the edges connect each two of all of the, so each edge connects two vertices like this. And in this particular type of graph network, we're going to consider graphs where all the particles are connected to all the other particles like this. So it's not like a sparse, it's not a sparse graph, except I think in the cosmology example here you can see that always there is a node that's connected to all its neighbors. But in the Newtonian dynamics graph networks, you can see right here, everything is connected to everything, like this. And why does that represent a physical system really well? So the reason is going to be the following. What we're going to try to do is we're going to try to say that in physical systems, if I want to, for example, consider this node up here, and consider how it is pulled by gravity by the other nodes, it's going to be pulled in this direction a little bit because of this particle right here, it's going to be pulled in this direction a little bit because of that one, and in this direction because of that one. Now note that these three things are independent. So if I want to describe the total force of gravity, I can do so as a sum over i equals 1, 2, 1, 2, 3 of the force that the particle i pulls. So if this is j right here, how i pulls on j, right? This is an independent sum across all of the neighbors of that particle. Now you might say, wait a minute, it's not independent, because it's being, you know, it's not being strictly pulled in this direction, it's also pulled in this direction. Yes, but with independent, we mean that the force, this force right here, is only dependent on this particle, and the force diagonally is only dependent on that particle. There is no part of the particle up here that modulates this force right here. So you can calculate the total force as an independent sum across the individual forces. And that's the simplification here. And that's a part, they claim, why current approaches that directly try to go about finding an equation using evolutionary methods from the data set itself don't really work, because the space is just too high of equations. But this right here, this is a massive constraint. And it's lucky, first of all, that physical systems, they say, most physical systems actually obey that constraint. Most physical systems can be described as an independent sum over contributions of interactions between just two things, right? So we simply can sum over interactions between two things. And that's way simpler than considering everything at once. And second of all, it's lucky because these graph networks describe exactly this. So each edge in the graph network is coincidentally connecting two things, right? And not more. So the edges, they don't know about each other. No edge knows about the other edge. They only consider whatever particles are at their respective ends. And that is exactly the same as this physical constraint on the physical system. And that's why the graph networks are so adapted or are so useful in describing these systems. So how does a graph network like this do anything, basically? So for that, you have to consider the task. If we want to describe a system like this, a task in that, if you frame it in a machine learning way, could be, I'm going to give you these particles right here. OK, here it's five particles. I'm going to give you, for each one, I'm going to give you all its features, like the x, the y, the speed currently, and the mass. And you're going to tell me what the acceleration is in the next frame. OK? So like this, like this, like this. OK, considering all the interactions between the particles, just tell me, where does it go in the very next time frame? That sounds like a machine learning problem, right? And the graph neural network can be made to predict this. So what we want is, for each vertex here, an output of a number or a vector, the acceleration. So we want to compute an output for each vertex. How do we do this? In a graph neural network, there are three, or in this particular type, there are three steps. We said each vertex, and we're just going to do it for one vertex, let's say the one on the bottom right. Let's say each vertex has these properties, like this x, y, and so on. So first, what we do is we go over the edges. So for each edge, in parallel and independent from each other, let's consider this edge right here. What we'll do is we take the nodes that are attached to it, and we combine their features. And we combine them, so x, y, this also has x, y. So we want to combine these two. We want to compute the edge right here. Now, in a physical system, what does the edge represent? The edge represents the force between the two particles, right? And that's a fairly complex equation. It's not like we can just add the features or something like this. So the edge here already needs to compute some sort of nonlinear, complicated function. And we know how to compute nonlinear, complicated functions with neural networks. We're in deep learning right here. So the edge here is going to compute what's called this edge function. And this edge function takes in two vertices, v1 and v2 right here. Maybe this is v2, this is v1. It takes in the features, these features of the two vertices, and it will compute a so-called edge message. I think they call this ek for the edge k. It will compute an edge message. And this is supposed to represent the force that pulls between these two particles. And we're going to approximate this function right here using a neural network. Since we don't know the equation yet, right? We assume we don't know the gravitational equation, but we can learn it, right? Because we have data. So we take this and we simply make it into a neural network. So the features go in here, both. We can concatenate them. And then out comes this edge message. Now, this edge message here is simply going to be a vector, a numerical vector describing some intermediate hidden state, right? That is going to describe the force, but for now it's just describing intermediate hidden state. OK, so we do this for each edge. So each edge is going to be, maybe this is e1, this is e2, e3, e4. Each edge in parallel is going to aggregate information of its endpoints into that edge. And then that's step one. So step one, compute the edge messages. Step two is going to be to compute the vertex messages or the vertex outputs. So we said we're not actually interested in the edges. We're interested that each vertex ends up with an acceleration, with an output. So how are we going to do this? So consider again our graph. If we want to compute the output for this node right here, what we'll do is we'll simply aggregate all of the edges, all of the edge messages that connect to that vertex. So we've computed previously the edge messages by integrating the information from all of the attached endpoints. Now we're going to go backwards and distribute the information from the edges back to the vertices that are attached. And you can see already by this two-step process, it's kind of a message passing process if you've ever studied graphical models. This means that in the two-step process, this vertex here aggregates information from the other vertices, via these edges. So in this case, this vertex here is going to take in all the edge messages right here, and it is going to aggregate all these edge messages in a function that computes the acceleration. So our estimate of the acceleration is going to be a function, let's call that nu, of the edges that are attached to it. So e1, e2, and e3. And here is where we're going to make our next physical assumption, namely the one we said before, that the way that these edges, the way that they influence the vertex, is going to be in a form of an independent sum. So this simplification means that this function should somehow be not of the edges, but of the sum of the edges, right? Sum of ei. Okay, so this sum here, this is the simplification that we make to make it in accordance with the physical system. With this graph network, we could do any sort of complicated thing right here. We could put a transformer on these things and compute 12 layers of interaction effects between these edges. We're not going to do that. We're simply going to sum them up and then come up and then run those through a function. So we'll sum them up. And of course, this function right here is still going to be a complex function because just because you sum up the forces, you don't have the acceleration yet. So as you know that force is mass times acceleration, that means acceleration is equal to force divided by mass. So this here is going to be this sum over the edges, I guess. Yes. So you still need to divide it by force. And technically, you still can do much more complicated things right here. We only say that the edges should only come in in form of a sum. So of course, we're going to say that this function right here, since it can be any complicated function of its input, it should also be a neural network. So we're going to take that sum of the edge messages and we're going to put that into a second neural network, and then out comes our estimate of the acceleration. And now that we can use together from the data set, we know the true acceleration, right? Since we have a data set, we have the observations and the labels. The labels are the true accelerations of that system that we observed. And we can compute a loss function right here. If you followed so far, everything we've done so far is differentiable. So from this loss function that compares the output of the neural network for that vertex to the true acceleration that we observed in the data set, we can back propagate through this neural network that computes the vertex function. We can back prop through the sum here to the edge messages, and we can back prop through the edge messages to that neural network that computed the edge messages from those features. So everything is differentiable. By having that loss at the end, we can train this neural network end to end to, from the observation right here, predict the numerical acceleration of the system right here. It was a fairly lengthy way, but it's important that you kind of understand what's happening. So you build the graph network according to the physical system. In the graph network, there are two kinds of things. First there are deterministic things, like we're always going to aggregate in a sum. And then there are things that you learn. Namely, there are two neural networks. The first one computes the edge messages from the features of the vertices. And the second one computes the output of each vertex according to the sum of the edge messages that are attached to that vertex. Now you can say, wait a minute, there are more than just two neural networks. Like each edge here has a neural network, technically, right? This edge has a neural network, this edge has a neural network, and each vertex has a neural network. But in this case, these neural networks are shared. So the neural network that computes the edge message for that edge is the same as the neural network that computes the edge message for any of the edges. You can think of it like weight sharing, or you can think that it is actually the same neural network, it's equivalent. And the same for the vertices. There's only one neural network that in the same fashion computes the output for each vertex. Of course, the incoming edge messages are going to be different, and that's why you have different outputs. But the neural network itself is the same. Okay, so we have a system that can describe this data set of physical observations really well. It's this graph neural network. So we train this end to end. And here is a little bit of an analogy where they say, this is how you can analogize the neural network with a physical system. So what are the analogies here? The nodes in the graph network correspond to the particles in Newtonian mechanics. Pairs of nodes correspond to two interacting particles. The edge model is the force between two particles. Then the pooling operation, which is the summing up of the edge messages, right, that we found so important as a simplification. This is the sum into the net force that is really given in the physical system. So independent sum of, sorry, sum of independent forces without interaction effects. Then concatenate with node, I guess this I left this out. But whenever you compute, whenever you compute the vertex properties, right here, I guess, what you want to do is not only input the edge messages, but you know, each vertex has these features that we said, and these could also be fairly important. It's like you technically have that information in the edge messages because it started out from these. But you can also just input that again into this neural network together with the edge properties. And that will just make its job a bit easier since, for example, right here, we have to divide by the mass in this function. And it's just easier if you provide that mass as a as the property. So that's a little detail I left out before. So that you concatenate the edge mess, the aggregated edge messages with the node, then you compute the node model, which in this case is the computation is simply the you take this sum right here, and you divide it by the mass. And then optionally, you can update the nodes, which is compute the next time step, which we don't do right here, because we simply want to output the acceleration. I guess I mean, it should be equivalent to output the next time step and then compare with the data set what the next time step was. In any case, you have to have some kind of loss function. And here you can see all the black squares right here are going to be neural networks. So now we have learned a graph network that can describe a system. How do we make this into an equation? And again, here, our our physical reality comes in that these of the like the independence assumptions of these realities comes in. Because in physics, you know, the the acceleration here is going to be a function of the sum and so on. So what we need to do is we don't need to develop an equation for the entire system, right? What we need to do is simply we need to develop an equation for each vertex. So each vertex, we need to have an equation acceleration equals something. And that something should include some of the edges and then the edges again should be something right. So we technically as we had two neural networks, we technically need two symbolic equations, one that represents that first neural network that computes the edge functions and one that represents that second neural network that aggregates the sum of the edge functions or that computes the output from the sum of the edge functions. And that you know, it's an exact correspondence. So what we need to do is we need to take that first neural network up here and do symbolic regression on that and the second neural network do symbolic regression on that. So what does it mean to do symbolic regression? It basically means that we want to find the symbolic equation that describes the neural network the best. And we do that in the exact same fashion as we started right here. So we give it a bunch of these options and then we let the system describe the neural network as best as possible. The way we do that again is we try out equations and if they get a low error, right, so we let the neural network run on the data set and we let this run on the data set. If it outputs the same thing, it describes the neural network well. And we can iterate that until we find a good equation. So the difference here is that we don't need to find an equation that governs the whole system. We just need to find two equations, one governing the edge model and one governing the vertex model and that's way, way easier than the whole system. And by finding those two equations, we and our given our physical assumptions, we can now find the equation to the whole system by simply composing them. Alright, so that's the entire system. I believe I've told you the entire paper right here without actually going into the paper. Let's just skim the paper a bit to see that they actually tell us the same thing. So, yeah, so the graph networks, they say, are ideal candidate for our approach due to their inductive biases shared by many physics problems. A, they're equivalent under particle permutations. B, they are differentiable end to end and can be trained efficiently using gradient descent. And C, they make use of three separate and interpretable internal functions, the edge, the node and the global model. Now the global model here isn't really used in the cases we're going to look at. So it's just going to be two different neural networks. Which are targets for the symbolic regression? Graph networks can also be embedded with additional symmetries, as in 23, 24, but we don't implement these. Okay, and then they say symbolic regression. So they use this Eureka package to perform symbolic regressions and fit compact closed form analytical expressions to these neural networks. Eureka works by using a genetic algorithm to combine algebraic expressions stochastically. The technique is analogous to natural selection, where the fitness of each expression is defined in terms of simplicity and accuracy. The operations considered in the fitting process are plus, minus, times, if, as well as real constants. Alright, so if we look at the examples, they have three different examples. First of all, they have Newtonian dynamics, which is, for example, this gravitational force we looked at. They have Hamiltonian dynamics, which describes the same systems, but in a different way in terms of the Hamiltonian. And I don't want to go into this too much, because I think that the Newtonian dynamics already demonstrate really well what the system can do. And then they have dark matter halos for cosmology, which is a problem where you have universe simulators and you try to predict where the dark matter is, depending on where other dark matter is, and that's where they find a new unknown equation. Okay, here is the system in a nutshell. This is the path that you know. You have the data set, you learn a graph network, and then you get out an equation. But in between, you can put even more constraints to make the network really learn a physical equation. So, as I said, you're going to compute these edge functions right here. And the output of the edge functions is going to be this edge message, which is just going to be a vector of some sort. And that vector can be pretty large. You know, this is a hidden dimension that you can choose as an implementer. All you need to make sure is that the output of the vertex is the same dimension as, you know, what your output should be. Everything internal, you can choose. Now, we know that, for example, in a 2D system, the actual informational content of that edge message should be two dimensional, right? If this really describes the force in two dimensions, it should be two dimensional. There's really no reason why it should have a higher dimension since all the relevant information can be described in two dimensions. So one thing you can do is you can simply say, all right, I will choose the hidden dimension to be two. And therefore, I will force my neural network to just use two dimensions. This however, they noticed doesn't work super well. I think it works, but not that well. They call this the bottleneck model. And the reason why it doesn't work super well is that if you have like this constraint of neural networks, they don't tend to learn very well. And that's what they hypothesize in the paper as well. They don't tend to really come, you know, be good friends with the fact that they only have two floating point numbers to learn anything. And this is probably more a property of the optimization procedure than the problem itself. It's property of, you know, us training neural networks with SGD. So what they do instead is they put an L1 penalty on these edge messages. So they say we apply L1 regularization. And what that will do is that will induce sparsity in whatever you apply it to. So L1 regularization simply means that you constrain. So the edge message, if you take the absolute value in each entry and the sum of that, that should be small. So you can just add this to the loss function, and that will induce sparsity in these edge messages. And so now the network still has these whatever 100 latent dimensions, but it is encouraged to use as few as possible. That means it can use a lot during the beginning when it's really benefits from the lot of dimensions when it learns the system. But then as it gets better and better, it might shift a lot of the information into very, very few dimensions. Okay, so once we do, if we do that, we can then run a check, right? If it is really the case that this graph network has learned the physical dynamics of the system, then we can simply look at the top two dimensions, and we start by largest standard deviation. So whichever two dimensions are the least sparse, have the largest standard deviation, we can look at those two and we say, well, even though we didn't constrain the model, those two should describe our force pretty well. And since in Newtonian dynamics, we know what the force is, so this is we know what the force is, we can simply check whether or not that holds, we can check whether we can read out the force from these two components. And here it's made such that you can't guarantee that the force is, you know, this force right here is actually so there are many ways to state a physical equation, because there are many symmetries in physics, and we cannot really make the neural network describe the equation exactly as humans would, because there are infinite amount of equivalent formulations, but in this case, they're all covered by rotations of each other. And that means in these graphs, if you have these message elements right here, and the linear combination of forces right here, a linear relationship means basically that the information is there, whereas a nonlinear relationship would mean that these numbers don't really encode the force as is. And here you can pretty clearly see that the linear relationship is given. And that means that these first two dimensions right here really encode the force in the way that we know the equation is. So that's when we know the equation, right? When we know the equation, we can simply say, okay, does this fit? And when we don't know the equation, we can use this symbolic regression. And what turns out is exactly this thing right here. Now you might you might object that this isn't really that force right here. But as I said, there are many, many symmetries. So for example, this, this R hat right here, I believe, and this is I've I'm not a big physics person, this R hat, I think this is the vector of the delta x delta y, right? So delta x delta y is in this R hat. So we already see that delta x and delta y here, this already looks like some sort of this already looks okay. No, actually, if we go down, it gets even clearer. So here they have the outputs of that. Alright, so in this first case, this is the same example right here. So they say you in this spring example, so this is a system where the particles are connected by springs, and we do l one regularization, what we expect is this equation, this is we know that this equation holds in this spring system. And what the neural network combined with the symbolic regression gives us is this equation. So right here, you can see there's this delta vector, and it's a product, it's an inner product dot product with this a, which is a numerical constants. And you can see that there is this form of product with numerical constants. What you can also see, so for example, here, the delta y here is 1.36 and 1.37. That's, you know, the same number and here it's point 6.6. Okay, but here you see, for example, r minus one, and here it's something like this minus something divided by r doesn't seem the same. But again, due to the due to the symmetries, you can, if you take this and you simply divide everything by r, you'll end up with this vector right here, a times delta x, delta y, times one over r, no, times one minus one over r plus b. Right, and now you can see it already looks very much similar. And it's only off by like, it's only a transformation away from what you want. So that's why I said you can describe these equations in many different sort of equivalent ways. And ask the neural network to really figure out, you know, the exact one we want. As long as it figures out a one that is equivalent, we're happy. And we're, I guess we're pretty happy here. So also in this case right here, you can see that it correctly predicts this relationship that it should be divided by r to the third power. And there is a delta x, delta y, delta z, if you simply consider, so delta z here, I guess is, has simply a factor of zero. And it even has this discontinuous problem where the force breaks after a certain while, it can even parse out this if condition right here. So that's, that's fairly cool, right? But to me that is pretty, pretty cool result that you can actually parse out these equations with just these graph networks and then the symbolic regression. So they do the same thing for this cosmology example, where they have these simulators of the universe and they let them run and these kind of distribute this dark matter. And I guess your task is, if I give you a bunch of these points right here, tell me where the other dark matter is, something like that. I don't understand this, but in essence, it is the same kind of problem, right? You want to figure out the dark matter properties from the surrounding dark matter or properties of other things. And again, here you can see pretty well that this is the equation they get out. So the equation they get out is going to be a sum right here over, so here the output for node i is going to be a sum over all the other nodes j and then some function of that sum. So this right here is the equation that came out of our edge model, of our edge neural network. And this here that includes this one, it was the equation that came out of our vertex model. As you know, the same here in this spring law, this came out of our edge model, this came out of our vertex model. Again, this rests on the fact that physical systems can actually be described often as these sums of independent interactions. And that's why all of this works. So they do give very, very detailed instructions on how they did everything. I think the most unclear things in this paper are the physics things that are assumed sort of that you know. I don't, I didn't. Yeah, but other than that, it's pretty straightforward. Their appendix is also pretty detailed in how they do all the representations and so on. They have different formulations other than this L1 regularization. As I said, they have bottleneck, they have like a KL formulation. They really describe how the graph neural network works here and so on. So all in all, I enjoyed reading this paper. Here is a bunch of examples of these particle systems. And yeah, and here is a bunch of examples of where you'd have a linear relationship that where you can say, oh, look, this really describes that force or a nonlinear relationship where you can make the claim this doesn't really describe the force well, because it's not linear relationship indicates that what the network found is a rotation of what you really want. And that's good because it's equivalent nonlinear basically means that you can't really it doesn't really describe what you want really well. Yeah, and I'm going to leave you with that. I absolutely invite you to check out the code and the video they made about it and I'll see you next time. Bye bye.
 Hi there, today we're looking at discovering symbolic models from deep learning with inductive
 biases by Miles Cranmer, Alvaro Sanchez-Gonzalez, Peter Pitalia, Rui Xu, Kyle Cranmer, David
 Spurgill and Shirley Ho.
 So this paper on a high level, it uses graph neural networks to fit a dataset of observations
 of a physical system.
 And then it uses symbolic regression in order to parse out equations, symbolic equations
 from the graph neural network.
 And the symbolic equations that will are found such they describe the physical system.
 And they do find, they do recover some known equations and they do find a new one in the
 field of cosmology.
 So we'll go through how they do it, what these two steps are and why this might work better
 than previous approaches.
 So yeah, join me.
 If you like content like this, as always, feel free to share it, subscribe if you haven't,
 if you want more content like this, and tell me what you think in the comments.
 All right, so they claim we develop a general approach to distill symbolic representation
 of a learned deep model by introducing strong inductive biases.
 And this, it doesn't really say a whole lot, but I think the abstract doesn't say a whole
 lot.
 So let me give you an example.
 If you have three different, let's say planets or stars, right?
 This is a, this three body problem is a unsolved problem, I think still.
 So if you have these three stars, and you just let the simulation run, they have gravity,
 they attract each other, right?
 So they are going to move around somehow.
 So this one's going to move here, this one's going to move like this, this one's going
 to move like this, and then it turns around and this one turns around and so on.
 So there is a fairly complex motions in already three different things that are somehow in
 a physical system together.
 This is a bigger problem than just stars.
 So you have these systems, for example, when these are atoms and there is like an electromagnetic
 force between them or the strong force.
 There can be, these can be things where springs are attached to them and so on.
 So our goal is to derive equations that govern this behavior, right?
 In the case of gravity, we know that these objects sort of pull on each other with the
 force proportional to something like the mass of the first times the mass of the second
 divided by the radius that they are a part squared.
 Something like this times like this gravitational constant.
 We know the equation that governs these interactions.
 We don't know the symbolic solution to the whole problem, but we know the equation that
 governs the interaction, right?
 Now imagine if we didn't know the equation, what do we have to do?
 Well, what did Newton do?
 Ultimately, he sat down and just came up with an equation that seemed okay to him and then
 found out that the equation actually does predict very accurately how the things move.
 So we're going to try to replicate that process in an AI system, the process of coming up
 with an equation that governs this behavior.
 So what we have is a data set.
 As I said, we let this stuff run.
 So we let it run for one time step and then this is here, maybe this is here and this
 is here, okay?
 And then we let it run for the next time step.
 This goes here, this goes here, this goes here and so on.
 So that will give us, basically it will give us frame by frame how this system evolves.
 Frame by frame.
 And that will give us a data set.
 So this right here, if we let it run and maybe we restarted a couple of times with different
 initializations, we let it run, we get a data set.
 So now we have a data set, right?
 So our goal is to be to take that data set and come up with an equation like m1, m2 divided
 by r squared that governs this behavior.
 Now previous approaches have resorted to symbolic regression, I think they call this.
 And that is basically, it's pretty simple.
 Namely, what you do is you simply provide the system with a bunch of options.
 You tell it, I have a list and the list can include the mass of the first, it can include
 the mass of the second, it can include the x and the y position of the things, it can
 include the delta x and delta y, which basically means the speed of the objects.
 It can include any constant a and b that you want.
 It can include the symbols plus, minus, division, multiplication, square, maybe exponential
 function and so on.
 So you give it a bunch of options of what it could potentially use in an equation.
 And then you simply let it make equations and you see how well these equations describe
 the data set.
 And the way you do that is you can do it naively by just searching and trying out, or you can
 be a little bit smarter about it and use evolutionary methods.
 So you start with some equations like this, okay, I'm going to x plus delta x minus a
 squared.
 You see how that describes the data set, you'll find not very well.
 And then you go on and you say, okay, maybe I'll make a small mutation, I'll mutate this
 to a minus and so on.
 And if you do this with an entire population, as is common in these evolutionary methods,
 you'll end up with something better at the end.
 Now this works until a point.
 So whenever the space of things to explore, like this one here, gets larger, and it doesn't
 have to be super large to already exhaust the capabilities of these methods.
 So these methods are very limited in the space they can search and have proven not really
 effective so far for this type of problem.
 This paper right here goes a different route.
 It uses graph neural networks in order to describe the data set.
 So in between this step of collecting a data set and making the equation, it fits another
 step.
 So it says in between here, we fit another step and that other step is going to be we
 have a graph neural network and you don't know yet, you don't have to know yet what
 that exactly is.
 But it's technique.
 It's like a type of neural network.
 And we're going to have that neural network learn the data set.
 Now as you know from neural networks, they can't do symbolic regression, they can't give
 you an equation, they can simply predict numbers.
 So what the network will do is it will simply predict like the motions or the accelerations,
 whatever you're interested in, it will predict those things as numbers, not as equations
 as just you can plug in this situation right here, and it will tell you how the things
 will move.
 Neural networks are pretty good at that.
 And once you have a graph neural network that can describe the system in a numeric fashion,
 then you parse out the equations from this graph neural network.
 And we're going to go over why that is going to be much, much easier than parsing out the
 equations directly from the physical system.
 It's going to be because you engineer the graph neural network in a way that makes it
 very congruent with physical reality that makes it very adapt to parse out equations
 like this that makes the job of this evolutionary method much easier.
 All right, so that's basically the two-step process here.
 First step is to numerically regress a neural network to describe the system, and then second
 step is going to be from that neural network parse out the equations.
 So we have to talk about graph neural networks.
 So here you see the entire process as they describe it.
 So they have this data set right here of observations of these physical systems.
 This is like, it's like any data set that you have in machine learning.
 They predict the dynamics, which means in a numeric fashion with a graph neural network,
 and then from the graph neural network, they extract the symbolic equation, as you can
 see right here.
 And this here is going to be the equation that they figure out that was previously unknown.
 They even say unknown dark matter over density equation.
 Cool.
 So we have to talk about graph neural networks.
 We haven't really done this on this channel so far.
 And I'm not like a big expert on graph neural networks.
 But they come in all shapes and forms.
 In this particular paper, they use what they call a type of interaction network that's
 called a graph network.
 So graph network is something different than graph neural network.
 I think graph network is a type of graph neural network.
 And specifically here, they use a network that...
 So a graph neural network has these things called vertices, and then it has edges, and
 edges connect vertices, like in a graph.
 Now we're going to build this graph neural network such that the number of vertices is
 exactly equal to the number of particles in our system.
 So in this paper, they consider systems with, I believe, four or eight particles.
 That's already a lot for if you want to derive equations and things.
 But of course, the physical world is made of many more particles.
 In any case, they consider four, let's say four particles right here.
 So what they're going to do, they're going to build a graph neural network that has four
 vertices, one for each of the particles.
 And in a graph neural network, every vertex can have properties.
 So the properties of each vertex here are going to be the properties of that particle.
 That means the x coordinate, for example, the y coordinate, and we're going to, let's
 say we're in two dimensions, right?
 It's a two dimensional problem.
 The x coordinate, the y coordinate, the delta x, the delta y, the mass, the, I don't know
 what else can we put here.
 There's a lot of stuff that we can put here, the charge, right?
 So all of these things are properties of the vertex.
 Then the other component of a graph are, of course, the edges.
 So the edges connect each two of all of the, so each edge connects two vertices like this.
 And in this particular type of graph network, we're going to consider graphs where all the
 particles are connected to all the other particles like this.
 So it's not like a sparse, it's not a sparse graph, except I think in the cosmology example
 here you can see that always there is a node that's connected to all its neighbors.
 But in the Newtonian dynamics graph networks, you can see right here, everything is connected
 to everything, like this.
 And why does that represent a physical system really well?
 So the reason is going to be the following.
 What we're going to try to do is we're going to try to say that in physical systems, if
 I want to, for example, consider this node up here, and consider how it is pulled by
 gravity by the other nodes, it's going to be pulled in this direction a little bit because
 of this particle right here, it's going to be pulled in this direction a little bit because
 of that one, and in this direction because of that one.
 Now note that these three things are independent.
 So if I want to describe the total force of gravity, I can do so as a sum over i equals
 1, 2, 1, 2, 3 of the force that the particle i pulls.
 So if this is j right here, how i pulls on j, right?
 This is an independent sum across all of the neighbors of that particle.
 Now you might say, wait a minute, it's not independent, because it's being, you know,
 it's not being strictly pulled in this direction, it's also pulled in this direction.
 Yes, but with independent, we mean that the force, this force right here, is only dependent
 on this particle, and the force diagonally is only dependent on that particle.
 There is no part of the particle up here that modulates this force right here.
 So you can calculate the total force as an independent sum across the individual forces.
 And that's the simplification here.
 And that's a part, they claim, why current approaches that directly try to go about finding
 an equation using evolutionary methods from the data set itself don't really work, because
 the space is just too high of equations.
 But this right here, this is a massive constraint.
 And it's lucky, first of all, that physical systems, they say, most physical systems actually
 obey that constraint.
 Most physical systems can be described as an independent sum over contributions of interactions
 between just two things, right?
 So we simply can sum over interactions between two things.
 And that's way simpler than considering everything at once.
 And second of all, it's lucky because these graph networks describe exactly this.
 So each edge in the graph network is coincidentally connecting two things, right?
 And not more.
 So the edges, they don't know about each other.
 No edge knows about the other edge.
 They only consider whatever particles are at their respective ends.
 And that is exactly the same as this physical constraint on the physical system.
 And that's why the graph networks are so adapted or are so useful in describing these systems.
 So how does a graph network like this do anything, basically?
 So for that, you have to consider the task.
 If we want to describe a system like this, a task in that, if you frame it in a machine
 learning way, could be, I'm going to give you these particles right here.
 OK, here it's five particles.
 I'm going to give you, for each one, I'm going to give you all its features, like the x,
 the y, the speed currently, and the mass.
 And you're going to tell me what the acceleration is in the next frame.
 OK?
 So like this, like this, like this.
 OK, considering all the interactions between the particles, just tell me, where does it
 go in the very next time frame?
 That sounds like a machine learning problem, right?
 And the graph neural network can be made to predict this.
 So what we want is, for each vertex here, an output of a number or a vector, the acceleration.
 So we want to compute an output for each vertex.
 How do we do this?
 In a graph neural network, there are three, or in this particular type, there are three
 steps.
 We said each vertex, and we're just going to do it for one vertex, let's say the one
 on the bottom right.
 Let's say each vertex has these properties, like this x, y, and so on.
 So first, what we do is we go over the edges.
 So for each edge, in parallel and independent from each other, let's consider this edge
 right here.
 What we'll do is we take the nodes that are attached to it, and we combine their features.
 And we combine them, so x, y, this also has x, y.
 So we want to combine these two.
 We want to compute the edge right here.
 Now, in a physical system, what does the edge represent?
 The edge represents the force between the two particles, right?
 And that's a fairly complex equation.
 It's not like we can just add the features or something like this.
 So the edge here already needs to compute some sort of nonlinear, complicated function.
 And we know how to compute nonlinear, complicated functions with neural networks.
 We're in deep learning right here.
 So the edge here is going to compute what's called this edge function.
 And this edge function takes in two vertices, v1 and v2 right here.
 Maybe this is v2, this is v1.
 It takes in the features, these features of the two vertices, and it will compute a so-called
 edge message.
 I think they call this ek for the edge k.
 It will compute an edge message.
 And this is supposed to represent the force that pulls between these two particles.
 And we're going to approximate this function right here using a neural network.
 Since we don't know the equation yet, right?
 We assume we don't know the gravitational equation, but we can learn it, right?
 Because we have data.
 So we take this and we simply make it into a neural network.
 So the features go in here, both.
 We can concatenate them.
 And then out comes this edge message.
 Now, this edge message here is simply going to be a vector, a numerical vector describing
 some intermediate hidden state, right?
 That is going to describe the force, but for now it's just describing intermediate hidden
 state.
 OK, so we do this for each edge.
 So each edge is going to be, maybe this is e1, this is e2, e3, e4.
 Each edge in parallel is going to aggregate information of its endpoints into that edge.
 And then that's step one.
 So step one, compute the edge messages.
 Step two is going to be to compute the vertex messages or the vertex outputs.
 So we said we're not actually interested in the edges.
 We're interested that each vertex ends up with an acceleration, with an output.
 So how are we going to do this?
 So consider again our graph.
 If we want to compute the output for this node right here, what we'll do is we'll simply
 aggregate all of the edges, all of the edge messages that connect to that vertex.
 So we've computed previously the edge messages by integrating the information from all of
 the attached endpoints.
 Now we're going to go backwards and distribute the information from the edges back to the
 vertices that are attached.
 And you can see already by this two-step process, it's kind of a message passing process if
 you've ever studied graphical models.
 This means that in the two-step process, this vertex here aggregates information from the
 other vertices, via these edges.
 So in this case, this vertex here is going to take in all the edge messages right here,
 and it is going to aggregate all these edge messages in a function that computes the acceleration.
 So our estimate of the acceleration is going to be a function, let's call that nu, of the
 edges that are attached to it.
 So e1, e2, and e3.
 And here is where we're going to make our next physical assumption, namely the one we
 said before, that the way that these edges, the way that they influence the vertex, is
 going to be in a form of an independent sum.
 So this simplification means that this function should somehow be not of the edges, but of
 the sum of the edges, right?
 Sum of ei.
 Okay, so this sum here, this is the simplification that we make to make it in accordance with
 the physical system.
 With this graph network, we could do any sort of complicated thing right here.
 We could put a transformer on these things and compute 12 layers of interaction effects
 between these edges.
 We're not going to do that.
 We're simply going to sum them up and then come up and then run those through a function.
 So we'll sum them up.
 And of course, this function right here is still going to be a complex function because
 just because you sum up the forces, you don't have the acceleration yet.
 So as you know that force is mass times acceleration, that means acceleration is equal to force
 divided by mass.
 So this here is going to be this sum over the edges, I guess.
 Yes.
 So you still need to divide it by force.
 And technically, you still can do much more complicated things right here.
 We only say that the edges should only come in in form of a sum.
 So of course, we're going to say that this function right here, since it can be any complicated
 function of its input, it should also be a neural network.
 So we're going to take that sum of the edge messages and we're going to put that into
 a second neural network, and then out comes our estimate of the acceleration.
 And now that we can use together from the data set, we know the true acceleration, right?
 Since we have a data set, we have the observations and the labels.
 The labels are the true accelerations of that system that we observed.
 And we can compute a loss function right here.
 If you followed so far, everything we've done so far is differentiable.
 So from this loss function that compares the output of the neural network for that vertex
 to the true acceleration that we observed in the data set, we can back propagate through
 this neural network that computes the vertex function.
 We can back prop through the sum here to the edge messages, and we can back prop through
 the edge messages to that neural network that computed the edge messages from those features.
 So everything is differentiable.
 By having that loss at the end, we can train this neural network end to end to, from the
 observation right here, predict the numerical acceleration of the system right here.
 It was a fairly lengthy way, but it's important that you kind of understand what's happening.
 So you build the graph network according to the physical system.
 In the graph network, there are two kinds of things.
 First there are deterministic things, like we're always going to aggregate in a sum.
 And then there are things that you learn.
 Namely, there are two neural networks.
 The first one computes the edge messages from the features of the vertices.
 And the second one computes the output of each vertex according to the sum of the edge
 messages that are attached to that vertex.
 Now you can say, wait a minute, there are more than just two neural networks.
 Like each edge here has a neural network, technically, right?
 This edge has a neural network, this edge has a neural network, and each vertex has
 a neural network.
 But in this case, these neural networks are shared.
 So the neural network that computes the edge message for that edge is the same as the neural
 network that computes the edge message for any of the edges.
 You can think of it like weight sharing, or you can think that it is actually the same
 neural network, it's equivalent.
 And the same for the vertices.
 There's only one neural network that in the same fashion computes the output for each
 vertex.
 Of course, the incoming edge messages are going to be different, and that's why you
 have different outputs.
 But the neural network itself is the same.
 Okay, so we have a system that can describe this data set of physical observations really
 well.
 It's this graph neural network.
 So we train this end to end.
 And here is a little bit of an analogy where they say, this is how you can analogize the
 neural network with a physical system.
 So what are the analogies here?
 The nodes in the graph network correspond to the particles in Newtonian mechanics.
 Pairs of nodes correspond to two interacting particles.
 The edge model is the force between two particles.
 Then the pooling operation, which is the summing up of the edge messages, right, that we found
 so important as a simplification.
 This is the sum into the net force that is really given in the physical system.
 So independent sum of, sorry, sum of independent forces without interaction effects.
 Then concatenate with node, I guess this I left this out.
 But whenever you compute, whenever you compute the vertex properties, right here, I guess,
 what you want to do is not only input the edge messages, but you know, each vertex has
 these features that we said, and these could also be fairly important.
 It's like you technically have that information in the edge messages because it started out
 from these.
 But you can also just input that again into this neural network together with the edge
 properties.
 And that will just make its job a bit easier since, for example, right here, we have to
 divide by the mass in this function.
 And it's just easier if you provide that mass as a as the property.
 So that's a little detail I left out before.
 So that you concatenate the edge mess, the aggregated edge messages with the node, then
 you compute the node model, which in this case is the computation is simply the you
 take this sum right here, and you divide it by the mass.
 And then optionally, you can update the nodes, which is compute the next time step, which
 we don't do right here, because we simply want to output the acceleration.
 I guess I mean, it should be equivalent to output the next time step and then compare
 with the data set what the next time step was.
 In any case, you have to have some kind of loss function.
 And here you can see all the black squares right here are going to be neural networks.
 So now we have learned a graph network that can describe a system.
 How do we make this into an equation?
 And again, here, our our physical reality comes in that these of the like the independence
 assumptions of these realities comes in.
 Because in physics, you know, the the acceleration here is going to be a function of the sum
 and so on.
 So what we need to do is we don't need to develop an equation for the entire system,
 right?
 What we need to do is simply we need to develop an equation for each vertex.
 So each vertex, we need to have an equation acceleration equals something.
 And that something should include some of the edges and then the edges again should
 be something right.
 So we technically as we had two neural networks, we technically need two symbolic equations,
 one that represents that first neural network that computes the edge functions and one that
 represents that second neural network that aggregates the sum of the edge functions or
 that computes the output from the sum of the edge functions.
 And that you know, it's an exact correspondence.
 So what we need to do is we need to take that first neural network up here and do symbolic
 regression on that and the second neural network do symbolic regression on that.
 So what does it mean to do symbolic regression?
 It basically means that we want to find the symbolic equation that describes the neural
 network the best.
 And we do that in the exact same fashion as we started right here.
 So we give it a bunch of these options and then we let the system describe the neural
 network as best as possible.
 The way we do that again is we try out equations and if they get a low error, right, so we
 let the neural network run on the data set and we let this run on the data set.
 If it outputs the same thing, it describes the neural network well.
 And we can iterate that until we find a good equation.
 So the difference here is that we don't need to find an equation that governs the whole
 system.
 We just need to find two equations, one governing the edge model and one governing the vertex
 model and that's way, way easier than the whole system.
 And by finding those two equations, we and our given our physical assumptions, we can
 now find the equation to the whole system by simply composing them.
 Alright, so that's the entire system.
 I believe I've told you the entire paper right here without actually going into the paper.
 Let's just skim the paper a bit to see that they actually tell us the same thing.
 So, yeah, so the graph networks, they say, are ideal candidate for our approach due to
 their inductive biases shared by many physics problems.
 A, they're equivalent under particle permutations.
 B, they are differentiable end to end and can be trained efficiently using gradient
 descent.
 And C, they make use of three separate and interpretable internal functions, the edge,
 the node and the global model.
 Now the global model here isn't really used in the cases we're going to look at.
 So it's just going to be two different neural networks.
 Which are targets for the symbolic regression?
 Graph networks can also be embedded with additional symmetries, as in 23, 24, but we don't implement
 these.
 Okay, and then they say symbolic regression.
 So they use this Eureka package to perform symbolic regressions and fit compact closed
 form analytical expressions to these neural networks.
 Eureka works by using a genetic algorithm to combine algebraic expressions stochastically.
 The technique is analogous to natural selection, where the fitness of each expression is defined
 in terms of simplicity and accuracy.
 The operations considered in the fitting process are plus, minus, times, if, as well as real
 constants.
 Alright, so if we look at the examples, they have three different examples.
 First of all, they have Newtonian dynamics, which is, for example, this gravitational
 force we looked at.
 They have Hamiltonian dynamics, which describes the same systems, but in a different way in
 terms of the Hamiltonian.
 And I don't want to go into this too much, because I think that the Newtonian dynamics
 already demonstrate really well what the system can do.
 And then they have dark matter halos for cosmology, which is a problem where you have universe
 simulators and you try to predict where the dark matter is, depending on where other dark
 matter is, and that's where they find a new unknown equation.
 Okay, here is the system in a nutshell.
 This is the path that you know.
 You have the data set, you learn a graph network, and then you get out an equation.
 But in between, you can put even more constraints to make the network really learn a physical
 equation.
 So, as I said, you're going to compute these edge functions right here.
 And the output of the edge functions is going to be this edge message, which is just going
 to be a vector of some sort.
 And that vector can be pretty large.
 You know, this is a hidden dimension that you can choose as an implementer.
 All you need to make sure is that the output of the vertex is the same dimension as, you
 know, what your output should be.
 Everything internal, you can choose.
 Now, we know that, for example, in a 2D system, the actual informational content of that edge
 message should be two dimensional, right?
 If this really describes the force in two dimensions, it should be two dimensional.
 There's really no reason why it should have a higher dimension since all the relevant
 information can be described in two dimensions.
 So one thing you can do is you can simply say, all right, I will choose the hidden dimension
 to be two.
 And therefore, I will force my neural network to just use two dimensions.
 This however, they noticed doesn't work super well.
 I think it works, but not that well.
 They call this the bottleneck model.
 And the reason why it doesn't work super well is that if you have like this constraint of
 neural networks, they don't tend to learn very well.
 And that's what they hypothesize in the paper as well.
 They don't tend to really come, you know, be good friends with the fact that they only
 have two floating point numbers to learn anything.
 And this is probably more a property of the optimization procedure than the problem itself.
 It's property of, you know, us training neural networks with SGD.
 So what they do instead is they put an L1 penalty on these edge messages.
 So they say we apply L1 regularization.
 And what that will do is that will induce sparsity in whatever you apply it to.
 So L1 regularization simply means that you constrain.
 So the edge message, if you take the absolute value in each entry and the sum of that, that
 should be small.
 So you can just add this to the loss function, and that will induce sparsity in these edge
 messages.
 And so now the network still has these whatever 100 latent dimensions, but it is encouraged
 to use as few as possible.
 That means it can use a lot during the beginning when it's really benefits from the lot of
 dimensions when it learns the system.
 But then as it gets better and better, it might shift a lot of the information into
 very, very few dimensions.
 Okay, so once we do, if we do that, we can then run a check, right?
 If it is really the case that this graph network has learned the physical dynamics of the system,
 then we can simply look at the top two dimensions, and we start by largest standard deviation.
 So whichever two dimensions are the least sparse, have the largest standard deviation,
 we can look at those two and we say, well, even though we didn't constrain the model,
 those two should describe our force pretty well.
 And since in Newtonian dynamics, we know what the force is, so this is we know what the
 force is, we can simply check whether or not that holds, we can check whether we can read
 out the force from these two components.
 And here it's made such that you can't guarantee that the force is, you know, this force right
 here is actually so there are many ways to state a physical equation, because there are
 many symmetries in physics, and we cannot really make the neural network describe the
 equation exactly as humans would, because there are infinite amount of equivalent formulations,
 but in this case, they're all covered by rotations of each other.
 And that means in these graphs, if you have these message elements right here, and the
 linear combination of forces right here, a linear relationship means basically that the
 information is there, whereas a nonlinear relationship would mean that these numbers
 don't really encode the force as is.
 And here you can pretty clearly see that the linear relationship is given.
 And that means that these first two dimensions right here really encode the force in the
 way that we know the equation is.
 So that's when we know the equation, right?
 When we know the equation, we can simply say, okay, does this fit?
 And when we don't know the equation, we can use this symbolic regression.
 And what turns out is exactly this thing right here.
 Now you might you might object that this isn't really that force right here.
 But as I said, there are many, many symmetries.
 So for example, this, this R hat right here, I believe, and this is I've I'm not a big
 physics person, this R hat, I think this is the vector of the delta x delta y, right?
 So delta x delta y is in this R hat.
 So we already see that delta x and delta y here, this already looks like some sort of
 this already looks okay.
 No, actually, if we go down, it gets even clearer.
 So here they have the outputs of that.
 Alright, so in this first case, this is the same example right here.
 So they say you in this spring example, so this is a system where the particles are connected
 by springs, and we do l one regularization, what we expect is this equation, this is we
 know that this equation holds in this spring system.
 And what the neural network combined with the symbolic regression gives us is this equation.
 So right here, you can see there's this delta vector, and it's a product, it's an inner
 product dot product with this a, which is a numerical constants.
 And you can see that there is this form of product with numerical constants.
 What you can also see, so for example, here, the delta y here is 1.36 and 1.37.
 That's, you know, the same number and here it's point 6.6.
 Okay, but here you see, for example, r minus one, and here it's something like this minus
 something divided by r doesn't seem the same.
 But again, due to the due to the symmetries, you can, if you take this and you simply divide
 everything by r, you'll end up with this vector right here, a times delta x, delta y, times
 one over r, no, times one minus one over r plus b.
 Right, and now you can see it already looks very much similar.
 And it's only off by like, it's only a transformation away from what you want.
 So that's why I said you can describe these equations in many different sort of equivalent
 ways.
 And ask the neural network to really figure out, you know, the exact one we want.
 As long as it figures out a one that is equivalent, we're happy.
 And we're, I guess we're pretty happy here.
 So also in this case right here, you can see that it correctly predicts this relationship
 that it should be divided by r to the third power.
 And there is a delta x, delta y, delta z, if you simply consider, so delta z here, I
 guess is, has simply a factor of zero.
 And it even has this discontinuous problem where the force breaks after a certain while,
 it can even parse out this if condition right here.
 So that's, that's fairly cool, right?
 But to me that is pretty, pretty cool result that you can actually parse out these equations
 with just these graph networks and then the symbolic regression.
 So they do the same thing for this cosmology example, where they have these simulators
 of the universe and they let them run and these kind of distribute this dark matter.
 And I guess your task is, if I give you a bunch of these points right here, tell me
 where the other dark matter is, something like that.
 I don't understand this, but in essence, it is the same kind of problem, right?
 You want to figure out the dark matter properties from the surrounding dark matter or properties
 of other things.
 And again, here you can see pretty well that this is the equation they get out.
 So the equation they get out is going to be a sum right here over, so here the output
 for node i is going to be a sum over all the other nodes j and then some function of that
 sum.
 So this right here is the equation that came out of our edge model, of our edge neural
 network.
 And this here that includes this one, it was the equation that came out of our vertex model.
 As you know, the same here in this spring law, this came out of our edge model, this
 came out of our vertex model.
 Again, this rests on the fact that physical systems can actually be described often as
 these sums of independent interactions.
 And that's why all of this works.
 So they do give very, very detailed instructions on how they did everything.
 I think the most unclear things in this paper are the physics things that are assumed sort
 of that you know.
 I don't, I didn't.
 Yeah, but other than that, it's pretty straightforward.
 Their appendix is also pretty detailed in how they do all the representations and so
 on.
 They have different formulations other than this L1 regularization.
 As I said, they have bottleneck, they have like a KL formulation.
 They really describe how the graph neural network works here and so on.
 So all in all, I enjoyed reading this paper.
 Here is a bunch of examples of these particle systems.
 And yeah, and here is a bunch of examples of where you'd have a linear relationship
 that where you can say, oh, look, this really describes that force or a nonlinear relationship
 where you can make the claim this doesn't really describe the force well, because it's
 not linear relationship indicates that what the network found is a rotation of what you
 really want.
 And that's good because it's equivalent nonlinear basically means that you can't really it doesn't
 really describe what you want really well.
 Yeah, and I'm going to leave you with that.
 I absolutely invite you to check out the code and the video they made about it and I'll
 see you next time.
 Bye bye.