Variation calculus is a great lens through which to look at many physics and CS problems. It is IMO under-taught and under-utilized, especially in the machine learning discipline.
The framework is basically minimization in functional space (as opposed to R^n or a subset thereof, the more common case).
The (to me) surprising thing is that finding an extremum in functional space (i.e. infinite-dimensional space) can be reduced to solving a differential equation, via Euler–Lagrange.
The first problem feels intractable, while the second is "just" numerical integration.
It's funny how different backgrounds bring you to having different ideas of what is easy and hard. As a mathematician, to me the easy problem is finding the minimum of the functional (where "easy" means "we can at least try", certainly not "trivial"; some minimum problems are actually relatively easy, some others are very difficult and open), while proving existence of PDEs is exactly why calculus of variations (and many other theories) were invented in the first place.
I didn't mean to imply that PDE's were an easy problem.
They clearly aren't, especially when it comes to proving some sort of formal property about them (which is something a mathematician would worry about, but which is rarely an engineer's first concern: they'd only worry about that type of thing when numerical integration starts producing "crazy" results).
However, there is a very intuitive way to compute an approximate solution to a system of PDE's, namely increase time in very tiny steps and solve the resulting system of equations each time, rinse and repeat.
Now, when you deal with arbitrary functions, there are so many ways to "represent" them: as various kind of series, as algebraic composition of elementary functions, as solutions to implicit equations, as solutions to PDE's, as polynomial approximations, as neural networks, etc ...
These representations are usually dense in "regular" functional spaces and you do get a lot of mileage out of them.
Whichever way you chose to represent functions in your functional space, the problem of finding an extrema over that representation is very much not obvious in the calculus of variation setting (or even that the extremum will be itself be representable, for that matter), whereas the conversion to a system of PDE gives you a clear path to victory - as long as the representation can be differentiated.
That's exactly why I say that different viewpoints give different concept of easiness. To me there are a lot of way to find minima (or, at least, critical points) of a functional: the direct method in CV, mountain pass theorems, etc. Most of them just need to know very general information about your space and functional and are actually even simple to visualize.
I remember a physics problem where teacher explained that a ball on different paths, even if the height differences would sum to zero would arrive at different times. I often think about this when planning car drives because I believe you could make better use of gravity and use less fuel.
> I remember a physics problem where teacher explained that a ball on different paths, even if the height differences would sum to zero would arrive at different times.
A good way to think about problems such as these are to look at the extreme cases. In this case, consider a flat plane: the ball takes infinite time, since it never rolls at all. And the fastest path would be a valley (though, as far as being v-shaped as possible), with the ball accelerating part of the way and decelerating at the end, spending the majority of the time at a high speed.
I studied computer vision in grad school when these were some of the state of the art methods, like the Mumford-Shah segmentation model and various inpainting models that set up the problem basically as a calculus of variations problem over the appropriate Sobolev space of image intensity functions and/or discontinuity-permitting boundary functions.
I’ve worked as a practitioner in computer vision as well and I think I disagree with your “under taught” comment.
In practice, the variational methods are not competitive at all with deep learning models, and even very naive transfer learning can apply better inpainting or segmentation than the older variational methods.
It is already merely a footnote in the history of computer vision. In 10 years it won’t even merit being part of literature reviews.
So for many applied domains of ML, I think spending roughly zero time on these variational methods in schooling is a good idea. You can always come back to them later, but you probably won’t need to.
A different application domain, variational Bayesian inference, might be a case where there is more reason to care. Although, things like ADVI are more about one very fixed approach to the problem (minimizing KL divergence to find a best approximating distribution from a class with known differentiability properties), and only in novel research would knowledge of general variational techniques give much value.
>In practice, the variational methods are not competitive at all with deep learning models
I really don't see why these two things need be pitted against each others.
What you're describing (Euler-lagrange applied to computer vision problems) is a direct application of the calculus of variation to the image itself.
It's rather naive because it uses an extremely weak representation of the content of the image (i.e. a bunch of pixels which essentially means working with a piecewise-constant basis of the functional space), and as you noted, it is easily beaten by modern techniques.
However: Deep neural nets are nothing but another, much more powerful "basis" of functional space (I put "basis" in quote because they're not linear. OTOH, they're generative).
A deep net is a finite set of real numbers that maps to a point in functional space, and any arbitrary continuous maps from R^n to R^p can be approximated by deep nets given enough weights and neurons.
So, if deep nets are dense in functional space, and "training" a deep net is nothing but solving a minimization problem in functional space, then I don't see why the "calculus of variation" ==> "PDE" via Euler-Lagrange route can't bee applied to training deep nets instead of backprop-based minimizers.
Now, if you're claiming that backprop works better than solving the PDE induced by Euler-Lagrange on the functional minimization problem of training a deep-net, I'm very happy to believe you, but I've yet to see literature demonstrating this.
The variational representations used in image processing are much more complicated than you suggest. In many cases, they are developed with semantic models that inform grammars of what the image can be composed of, and directly model things like occlusion, cusps, edges, blur, etc., when postulating a joint functional space that can describe the “energy” of an image, which then minimizing gives not only pixel values but also parametric curves for boundaries and sometimes also labels.
It’s essentially a way to encode semantics as prior distributions over possible images, then variational methods “optimize” for the posterior parameters given some data.
I’m trying to say that that whole exercise listed above, conceptually, is basically a failed idea compared with solving the same problems using deep learning to automatically discover what that manifold looks like in parameter space and transform it directly to the output space of practical interest (segmentation boundaries, etc.).
>The variational representations used in image processing are much more complicated than you suggest
Fair enough, but my main point stands: has anyone tried to apply Euler-Lagrange and a PDE solver to the problem of training a deep net or is it obvious that backprop-based methods will work better?
“When I was in high school, my physics teacher—whose name was Mr. Bader—called me down one day after physics class and said, ‘You look bored; I want to tell you something interesting.’ Then he told me something which I found absolutely fascinating, and have, since then, always found fascinating. Every time the subject comes up, I work on it. In fact, when I began to prepare this lecture I found myself making more analyses on the thing. Instead of worrying about the lecture, I got involved in a new problem. The subject is this—the principle of least action."
If physics is your thing, and it certainly was Feynman's, it'd be hard not to be fascinated by the calculus of variations, it shows up all over the place:
- principle of least action (lagrangians)
- adiabatic cycles in thermodynamics
- quantum mechanics
- etc..
and I'm probably missing another 100.
Looks like it's a fairly fundamental thing in the world.
Adam Savage builds a brachistochrone curve, which is the same curve as an Isochronous, just with potentially different starting/ending points, with Vsauce's Michael Stevens. It's a pretty bizarre phenomenon: https://youtu.be/skvnj67YGmw
They should build tautochronous pendulums. Or just add a spring bouncer on the end of the tracks so to enjoy multiple simultaneous bounces of different heights.
>To make its period isochronous, Huygens mounted cycloidal-shaped metal 'chops' next to the pivots in his clocks, that constrained the suspension cord and forced the pendulum to follow a cycloid arc.[53] This solution didn't prove as practical as simply limiting the pendulum's swing to small angles of a few degrees.
Is this off the back of a video of a 1970s Open University style presenter showing the properties of isochromus curves - i loved watching it and realised that these are national treasures of programs - and also was quite stunned by the assumption one would have a round empty tobacco tin lying around to do the experiment with - times do chnage :-)
I think we three are in the same Google Bubble as I've just finished watching that glorious Open University video. If the algorithm wills it, I think it means we have to be best friends!
Seriously though, I would be weirdly fascinated to see what else you guys subscribe to and if there are any correlations to my subscriptions. I find this channelling people into little boxes fascinating, and those curves are also very cool.
I can't remember another particular instance, but there have been several times where something interesting linked on HN will have another piece of interesting content related to it which will then also be posted here.
It is kind of uncanny that we all have seen this particular video in our recommendations recently. It makes me want to try and create a graph of the connections between all the links.
It strikes me that, as YouTube puts its hand into the bag to pull out a marble, there are probably just a lot less marbles than we think, and certainly less marbles worth watching than we think, and far far less worth watching that have been made in the past week?
Additionally, if youtube was forced to only play videos where copyright was proven to belong to the owner of the channel, would it collapse completely.
Is that perhaps what is shrinking the bag of marbles ?
Which interestingly suggests that if we force youtube to actually respect IP, it would reward new creators of quality work more proportionately
Suggested for me also. Compare with yesterday's discussion on HN about YouTube's algorithms: "YouTube's tendency to push everyday users toward politically extreme content" https://news.ycombinator.com/item?id=17938181
This is a toy application of the calculus of variations, which is the mathematical theory behind the equilibrium of continuous structures and many other things. How can you build the strongest bridge with a given amount of material? A similar computation to that of isochronous curves gives you the answer.
The same term has been adopted in transportation planning, for the curves of equal commute time to a job location, etc. Google has an incredible amount of data about this, but I don't know that it has been made available in any usable form.
This comment is pretty interesting, it's almost indistinguishable from the "I work from home and make $10k a week!!" facebook posts plaguing comment sections... but it might make legitimate sense in context!
Aren't half the comments on HackerNews basically "I work on a similar project, check out my project"? Although extra suspicious when it's a green user.
Which to be fair, I'm entirely fine with as long as the projects are legitimate. In the world of programming, there are so many cool and useful libraries, services and tools out there that you have little hope to find out about them otherwise.
64 comments
[ 4.5 ms ] story [ 2166 ms ] threadThe framework is basically minimization in functional space (as opposed to R^n or a subset thereof, the more common case).
The (to me) surprising thing is that finding an extremum in functional space (i.e. infinite-dimensional space) can be reduced to solving a differential equation, via Euler–Lagrange.
The first problem feels intractable, while the second is "just" numerical integration.
They clearly aren't, especially when it comes to proving some sort of formal property about them (which is something a mathematician would worry about, but which is rarely an engineer's first concern: they'd only worry about that type of thing when numerical integration starts producing "crazy" results).
However, there is a very intuitive way to compute an approximate solution to a system of PDE's, namely increase time in very tiny steps and solve the resulting system of equations each time, rinse and repeat.
Now, when you deal with arbitrary functions, there are so many ways to "represent" them: as various kind of series, as algebraic composition of elementary functions, as solutions to implicit equations, as solutions to PDE's, as polynomial approximations, as neural networks, etc ...
These representations are usually dense in "regular" functional spaces and you do get a lot of mileage out of them.
Whichever way you chose to represent functions in your functional space, the problem of finding an extrema over that representation is very much not obvious in the calculus of variation setting (or even that the extremum will be itself be representable, for that matter), whereas the conversion to a system of PDE gives you a clear path to victory - as long as the representation can be differentiated.
A good way to think about problems such as these are to look at the extreme cases. In this case, consider a flat plane: the ball takes infinite time, since it never rolls at all. And the fastest path would be a valley (though, as far as being v-shaped as possible), with the ball accelerating part of the way and decelerating at the end, spending the majority of the time at a high speed.
I’ve worked as a practitioner in computer vision as well and I think I disagree with your “under taught” comment.
In practice, the variational methods are not competitive at all with deep learning models, and even very naive transfer learning can apply better inpainting or segmentation than the older variational methods.
It is already merely a footnote in the history of computer vision. In 10 years it won’t even merit being part of literature reviews.
So for many applied domains of ML, I think spending roughly zero time on these variational methods in schooling is a good idea. You can always come back to them later, but you probably won’t need to.
A different application domain, variational Bayesian inference, might be a case where there is more reason to care. Although, things like ADVI are more about one very fixed approach to the problem (minimizing KL divergence to find a best approximating distribution from a class with known differentiability properties), and only in novel research would knowledge of general variational techniques give much value.
I really don't see why these two things need be pitted against each others.
What you're describing (Euler-lagrange applied to computer vision problems) is a direct application of the calculus of variation to the image itself.
It's rather naive because it uses an extremely weak representation of the content of the image (i.e. a bunch of pixels which essentially means working with a piecewise-constant basis of the functional space), and as you noted, it is easily beaten by modern techniques.
However: Deep neural nets are nothing but another, much more powerful "basis" of functional space (I put "basis" in quote because they're not linear. OTOH, they're generative).
A deep net is a finite set of real numbers that maps to a point in functional space, and any arbitrary continuous maps from R^n to R^p can be approximated by deep nets given enough weights and neurons.
So, if deep nets are dense in functional space, and "training" a deep net is nothing but solving a minimization problem in functional space, then I don't see why the "calculus of variation" ==> "PDE" via Euler-Lagrange route can't bee applied to training deep nets instead of backprop-based minimizers.
Now, if you're claiming that backprop works better than solving the PDE induced by Euler-Lagrange on the functional minimization problem of training a deep-net, I'm very happy to believe you, but I've yet to see literature demonstrating this.
It’s essentially a way to encode semantics as prior distributions over possible images, then variational methods “optimize” for the posterior parameters given some data.
I’m trying to say that that whole exercise listed above, conceptually, is basically a failed idea compared with solving the same problems using deep learning to automatically discover what that manifold looks like in parameter space and transform it directly to the output space of practical interest (segmentation boundaries, etc.).
Fair enough, but my main point stands: has anyone tried to apply Euler-Lagrange and a PDE solver to the problem of training a deep net or is it obvious that backprop-based methods will work better?
https://arxiv.org/abs/1804.04272
“When I was in high school, my physics teacher—whose name was Mr. Bader—called me down one day after physics class and said, ‘You look bored; I want to tell you something interesting.’ Then he told me something which I found absolutely fascinating, and have, since then, always found fascinating. Every time the subject comes up, I work on it. In fact, when I began to prepare this lecture I found myself making more analyses on the thing. Instead of worrying about the lecture, I got involved in a new problem. The subject is this—the principle of least action."
The rest at: http://www.feynmanlectures.caltech.edu/II_19.html
Looks like it's a fairly fundamental thing in the world.
>To make its period isochronous, Huygens mounted cycloidal-shaped metal 'chops' next to the pivots in his clocks, that constrained the suspension cord and forced the pendulum to follow a cycloid arc.[53] This solution didn't prove as practical as simply limiting the pendulum's swing to small angles of a few degrees.
https://youtu.be/eBc827pwKf0
Seriously though, I would be weirdly fascinated to see what else you guys subscribe to and if there are any correlations to my subscriptions. I find this channelling people into little boxes fascinating, and those curves are also very cool.
It would be interesting to me to know how many stories in HN trend simply because a group of people were all recommended the same content.
It is kind of uncanny that we all have seen this particular video in our recommendations recently. It makes me want to try and create a graph of the connections between all the links.
Additionally, if youtube was forced to only play videos where copyright was proven to belong to the owner of the channel, would it collapse completely.
Is that perhaps what is shrinking the bag of marbles ?
Which interestingly suggests that if we force youtube to actually respect IP, it would reward new creators of quality work more proportionately
Freedom is Slavery
Ignorance of our algorithms is necessary
But I am a little surprised by the amount of people that get that from the recommender system too.
Feynman's Lost Lecture (ft. 3Blue1Brown) [video] https://news.ycombinator.com/item?id=17927217
The only way to find out is to click the link.
edit: And it's legit!
Which to be fair, I'm entirely fine with as long as the projects are legitimate. In the world of programming, there are so many cool and useful libraries, services and tools out there that you have little hope to find out about them otherwise.
( Shameless plug - an open source implementation of it: https://github.com/graphhopper/graphhopper#for-analysis )