it is the holy grail of neuroscience to understand how the information is being represented inside the brain encoded in patterns of activity of nerve cells on this quest we make use of tools offered by biology physics chemistry computer science and of course math today i'm super excited to tell you about the concept that i think is just unbelievably beautiful we'll discuss neural manifolds and how abstract mathematics of high dimensional spaces can be used to unravel the secrets behind the neural circuits the video is structured in the following way first we'll refresh some very basic neuroscience
concepts and see how we can extract data from the working brain from patterns of neurons activating to points scattered in high dimensional space then we'll talk about shapes in these high dimensional spaces and discuss what important characteristics they might have finally we'll bring everything together mathematically describing the clouds of points we obtain from the active brain and using the discovery that was published two years ago in nature as an example we'll see what insights could be generated about the data representation inside the neural circuit and how it can help us on a path to understanding
our own brains if you're ready buckle up [Music] the brain is made up of billions of neurons which are electrically excitable cells that means a neuron can generate an electrical impulse in response to the incoming stimulus the impulse then spreads along the neuron and gets transmitted onto other neurons when this happens we say that a neuron has generated an action potential or a spike spikes are fundamental units of communication in the brain all the information it receives be it a beautiful sunset the smell of freshly baked croissants of the notion of pythagorean theorem you learned
back in primary school are all thought to be encoded in the collective behavior the dynamics of a particular population of neurons which exactly neurons are firing in what temporal relationship with each other these spikes occur and with what frequency what's known as the firing rate all determines the content of information encoded in this seemingly chaotic activity but how exactly is information represented inside the neural circuit what what variables does the brain use and how they relate to the external world to begin answering questions like these we first need to somehow parameterize the activity of the
circuit for decades scientists were able to eavesdrop on a single neuron by sticking a very thin electrode inside and measuring how the neuron's voltage varies with time and detecting when it spikes but with that technique we are able to record only from a handful of neurons at a time which is not enough if we want to unravel the secrets of their collective dynamics only with the recent advent of multi-electrode arrays we can now get information about up to a few hundred neurons in a single recording session knowing when each neuron produces a spike we obtain
what's known as the spike trade each vertical bar here represents the firing of the corresponding neuron so we can read out the activity of the entire network we want to calculate the firing rate that is the number of spikes per unit time to do so we partition the time into short pins of fixed length and for each bin we count how many times has a neuron spiked during that time frame as a technical note we easily smooth the data to get a nice continuous variation instead of discrete jumps thus if we have n neurons in
our recording then at each point in time the activity of this population is characterized by n numbers each one representing the instantaneous firing rate of the corresponding neuron those n numbers form an n-dimensional vector which corresponds to a point in n-dimensional space as the time passes and the animal is foraging or performing some other task the pattern of activity changes some neurons increase their firing rates while others fire more sparsely therefore with time this point characterizing the instantaneous activity of the network will move to a new position in this empirical neural activity space tracing some
trajectory the question is are all of these points achievable of course since this is a biological system there are some physiological constraints for example no neuron can fire with arbitrarily large frequency the rate of more than 500 spikes per second is impossible due to the properties of the cell membrane but other than that could the trajectory pass through any point in this high dimensional space neurons we record with multi-electrode arrays are part of the same network they are intertwined and directly influence each other so their firing rates cannot be independent and the trajectory will be
confined to only a subspace of this n-dimensional activity space how this subspace looks like as well as the exact trajectory would of course depend on the connectivity of the network the strengths of the connections between the neurons and the task itself it has been first hypothesized and then shown many times experimentally that although the ambient space is very high dimensional the actual trajectory is confined to a very low dimensional structure the main assumption is that certain properties of this shape that the trajectory is confined to can give us insights into the mechanisms behind this particular
circuit and the nature of variables be encoded there but before we see exactly what this means and how it could be done let's talk about the shapes in these high dimensional spaces and discuss what properties will be important to us later on [Music] for further investigation we turn our attention to a very beautiful piece of mathematics algebraic topology it is often referred to as the geometry on a rubber sheet where you are free to twist bend and stretch things that's why to it apologist a circle and a square is practically the same thing because one
can be smoothly or continuously deformed into another in this case we say that they are homeomorphic you might ask a very reasonable question what's the point of such piece of math then wouldn't we be saying that all the shapes in the world are equivalent to this flexible piece of clay which we can deform into pretty much anything deformation and topology have their limits we can't punch holes tear things apart and glue them together that's why a sphere is not homeomorphic to a torus turning one into another requires poking a hole or stitching parts together but
we are getting a little bit ahead of ourselves so let's back up the central object will be the notion of a topological space if that sounds complicated don't panic i'm sure you're more familiar with them than you might think in fact you even live within one our universe is what's known as r3 the three-dimensional eclidean space euclidean just refers to the way we measure distances r3 means that your position is uniquely characterized by three real numbers you can infinitely go in any direction and nothing interesting will happen the sister space r2 is an infinite plane
where your position is given by two numbers x and y likewise the space r is the one you're familiar with it's just a real number line but what about r4 r5 and even rn well since we are three-dimensional creatures we can't directly visualize higher dimensional spaces but mathematically it's directly analogous it's just a space where your position is given by four or five or n real numbers like a fourth axis sticking out somewhere beyond our world you may have noticed that the unconstrained version of neural activity space we obtained back in part one is actually
an example of rn where n is the number of neurons we record but if that was the whole story about topological spaces things wouldn't be really interesting let's see what other topological spaces exist other than the obvious family of our ends one very intuitive example is the surface of the sphere which the surface of the earth we live on can be approximated with notice that if you live on the surface of the sphere and you keep moving forward in any direction eventually you will reach the point where you started which is not the case in
r2 at all other examples include distorted spheres planes tauri mobius strips and even some more strangely looking things all of these are what we're going to call manifolds the technical definition of a manifold is a bit more abstract but for our purposes and to develop an intuitive understanding it's really useful to think of a manifold as some shape in an euclidean space which locally resembles an euclidean space of a lower dimension let's try to see what it means technically we'll live on the surface of the sphere right a shape in three dimensions but in our
day-to-day lives a surface of the earth feels an awful lot like a flat plain that's because we are very tiny compared to the earth itself indeed if you zoom in close enough it will be indistinguishable from the plane you may remember from calculus how if a function is smooth or differentiable at a point around that point it could be approximated with a straight line and it's the same idea in fact the graph of a function can be thought of as a manifold living on the plane in r2 which locally resembles a straight line or just
r likewise a torus is also a manifold because it everywhere looks like a flat plane as well and just to give you one counter example if we pinch the torus collapsing one of the circles in its cross section into a single point it would no longer be a manifold do you see why because around that very point where we pinched it it no longer looks like a flat plane no matter how close you zoom in things are kind of funky here manifolds often arise when we solve differential equations or as we'll see analyze experimental data
consequently we need some meaningful ways to parameterize the resulting manifolds and to analyze their properties if we continuously deform a sphere in some funny way we'll still get a manifold that is topologically equivalent or homeomorphic to the sphere and sure it's lost all its roundness and outside symmetry but there are some properties that stay constant or invariant under such continuous deformations i would like to make an emphasis on two of such invariant properties of manifolds that will be important later on that is the dimension and the genus let's start with the first one [Music] we
have all heard the word dimension so we are quite familiar with it if i ask you what's the dimension of this manifold what would you say well it's sitting inside the three-dimensional space we can clearly see the three axes right but at the same time it's some sort of a convoluted line which we know is one-dimensional what's the catch here manifold is characterized by intrinsic and embedding dimensions an embedding dimension is the dimension of the surrounding equilibrium space that the manifold is sitting inside of for our squiggly line here the embedding dimension is three or
if it were drawn on a plane the embedding dimension would be two intrinsic dimension however refers to the manifold itself it can be thought of as the number of degrees of freedom or the number of continuous variables you would need to specify your location if you lived on this manifold for example the sphere is embedded in three-dimensional space but it is intrinsically two dimensional because you only need two variables latitude and longitude to uniquely determine your position similarly if you lived in a taurus or a surface of a donut you would still need two variables
one for the angle along the big circle and one for the other angle along the smaller circle for our line here we can associate each point with a color of a different hue then position along the line is uniquely given by hue value or the angle along the color wheel this is what i meant by saying the trajectory will be confined to a lower dimensional structure even though the ambient dural activity space is very high dimensional the neural manifold where the activity of the network lives at every point in time is intrinsically of a much
lower dimension before we move forward let's see why characterizing the dimension of such a manifold could be useful you can think of a particular neural circuit as part of a computer program executing a code snippet it receives inputs carries out computations and produces an output which then either propagates further into the brain or gets executed in the form of border commands for example to perform computations relevant to behavior the brain would need some way to encode parameters about the external world declare variables if you will about animals position velocity head direction the intensity and irritation
of the incoming stimulus of course we don't know exactly how this happens and what's being encoded but we can infer the number of independent variables being used suppose we record population activity from part of the cortex which is responsible for movement and we discover that the activity of the network is confined to a two-dimensional manifold we can postulate that this circuit cannot encode two positional variables x and y and two velocity parameters in an independent way because then the dynamics would need to be at least four dimensional dimension is nice but it would be cool
to have some other information about the resultant manifold which would relate to external variables in some meaningful way [Music] when people talk about topology they are required by the sacred oath to give an example of cups and donuts and how they are the same thing since one can be deformed into another look they say they both have a hole what had always puzzled me is why people are so obsessed about well holes oh yes mathematically speaking deformations that preserve the number of holes are by definition continuous and continuity is kind of a big deal in
math because it opens up a lot of possibilities but that explanation isn't very enlightening either i would like to show you how holes reflect something so fundamental and so intrinsic about the manifold itself that is actually kind of creepy imagine you lived on a torus just like the sphere locally it looks like a flat plane everywhere and in the same way as with a sphere if you walk forward in any direction you would eventually end up in the point where you started is it possible for you to distinguish whether you live on a taurus or
on a sphere without flying into space and taking a picture pause and ponder about that for a minute i'll give you a hint you have an infinitely long perfectly slippery string here's the thing if you take this string and ask your friend to hold one end then you go around the world reaching your starting point but this string has now been wrapped around the planet you take one end from your friend while another one is in your hands and you try to tie a knot let's see what happens in the case of a sphere since
the string is slippery the loop can easily slide along the surface and eventually you'll end up with a free string with a knot on it if you lived on a torus however and you happen to go through the hole then no matter how hard you pull you won't be able to tie a knot do you see why because this string can't slide along the surface but it can't go through it will be wrapped around the torus forever once you go through the hole there is no way out other than to cut the string notice we
were able to distinguish between two non-homeomorphic manifolds without leaving their surfaces in fact we couldn't see the exact shape it could have been a sphere or some sort of distorted thing-a-magic it would have the same local properties from the point of view of someone who lives on the surface this is indistinguishable from that we could however determine whether it has a hole in it but what is a hole anyway it turns out holes have different dimensions as well the intuition for one dimensional hole is like a handle if you can't put your manifold on a
necklace it has a one-dimensional hole two-dimensional hole is something we would think of as a cavity take the sphere for example it has no one-dimensional holes but it has empty space inside which we can fill if you can fill it up with toothpaste it has a two-dimensional hole unfortunately this is where the intuitive analogy ends but there is a mathematical definition which generalizes the notion of a whole to n dimensions i won't go into that in this video just mention that it uses the same trick of continuously shrinking things down into a point like we
did with the toroidal planet example the hole is something that prevents such a shrinkage by now you have probably guessed that we'll be interested in the number of holes the neural manifold has so without further ado let's see a real life example [Music] the brain has a dedicated system to keep track of the head orientation which consists of special head direction cells they seem to be representing the angle where relative to the environment you are facing and play a vital role in spatial navigation these neurons have a preferred direction and signal you whether you face
in this direction or not by increasing the firing rate head direction system is a well-studied circuit but it provides a very promising ground to apply the methods of analyzing the collective dynamics of a large number of neurons to uncover the true nature of latent variables being encoded remember our assumptions the information representation unfolds at the scale of the population of neurons so only by examining the activity of a large number of cells simultaneously we can uncover something useful if the collective dynamics of the circuit encodes a variable of a certain dimension and certain topology then
the activity of this network would be localized to a subspace or a manifold of the matching dimension and topology and so we record activity from part of the thalamus where head direction cells are located as time goes on we make measurements about firing of neurons obtaining a cloud of points in high dimensional space then we reconstruct the shape of this point cloud how exactly they align in space under the hypothesis that the neurons we are studying represent the head direction what would you expect the resulting manifold to look like well if the circuit truly encodes
only the direction the animal's facing root we would first of all expect the manifold to be one-dimensional because it's one variable we'd also expect to see a hole in the middle because the variable is measuring the angle so basically something like a loop which is homeomorphic to a circle and this is exactly what we find the activity of a real group of neurons inside the real mouse just running around is localized to a one-dimensional ring though granted quite a convoluted one and the state of the network described by the point on this ring at every
instance of time directly corresponds to the animal's head direction that is just by looking at the experimental data we record from the brain and not seeing the mouse at all we can definitely say which direction it is facing isn't that fascinating interestingly equal distances along the ring correspond to equal differences in the facing angle so there is a beautiful one-to-one mapping between the two to me this is just a brilliant example of how intrinsic dimension and topology of the neural activity manifold inform us about the structure of data being encoded inside the circuit topological data
analysis and computational neuroscience are both very young fields and they are only beginning to intertwine with each other but this interaction is very very promising on our quest to understand how information is embedded into high dimensional representations allowing the brain to perform complex tasks by analyzing the geometry of neural population activity we can gain insights into the internal workings of various brain regions for example how the structure called hippocampus encodes your position in space how water cortex prepares and executes movement and even how the brain creates abstractions and generalizations and all of that is just
the very beginning of this exciting journey ahead of us so hopefully next time you plan to impress girls by talking about topology you won't be limited to coffee mugs and donuts [Music] [Music] you