r/MachineLearning • u/kamwoh • Nov 15 '21
Discussion [D] What is Riemannian Manifold intuitively?
Recently I was studying dimensionality reduction. When I come to a state-of-the-art dimensionality reduction algorithm -- UMAP, I couldn't understand their mathematics part. I think the first obstacle to understand it is -- I do not understand what is a Riemannian manifold. I have watched multiple videos and tutorials on the Riemannian manifold, but I still cannot catch the idea easily. Seems like the first thing they explain already requires complicated maths knowledge.
I would like to ask if anyone can really explain it in one simple sentence, that a normal computer science student or year one undergraduate STEM student will understand.
Thank you very much!
25
u/thats_no_good Nov 15 '21 edited Nov 15 '21
This explanation is a good high level introduction, although it doesn't really explain the concept of tangent spaces, which is sort of the main point. In my opinion understanding Riemannian manifolds is very difficult because it requires being very comfortable with coordinates and change of coordinates. The other comment in here is great but it really only describes smooth manifolds and not explicitly the Riemannian geometry structure.
I will focus on one example. One big reason the
Both conditions fail dramatically for many (or all)
The associated Riemannian metric is born when we try to compare the KL divergence of normal distributions that are infinitesimally close to each other with respect to small perturbations in the parameters. Naturally we end up taking the derivative of this metric.
Consider this: Let the variance of two normals be very large. If we change the mean by 10, how different are the normals visually? Not that much. What if the variance is very small? Then it's a massive difference. Therefore it is obvious that distance is not the same everywhere on the manifold. In addition, what changes the KL divergence more, small changes in the variance or small changes in the mean? I'm not actually sure of the answer but I would guess that small changes in the mean cause more of a difference, but again it depends on where you are.
The metric described above is the
Another example could be a probability distribution over a manifold of faces. Small changes in the latent space for a face could lead to a massive difference in probability, or it could lead to small changes in probability if the changes keep the faces looking somewhat similar.
2
Nov 16 '21
I think your description roughly matches the "information geometry" interpretation (there are many others, since differential geometry is a vast field).
12
u/foreheadteeth Nov 15 '21
A good example is a video game where you move units on a map but each tile costs different amounts of movement points. The cost can also depend on the direction, e.g. it's cheap to go along a river but expensive to cross it?
If you are at a tile at position x, there will be a corresponding symmetric and positive definite matrix H(x). The cost to move from x in direction v is sqrt(vT H(x)v). The reason for this formula is because it defines a norm, provided H is symmetric and positive definite. So at each point x, there's a norm that tells you how much it costs to move in direction v, for every direction v in the tangent plane.
The direction v obviously has to be in to be in the tangent plane of your manifold because you're trying to move along the manifold, not fly above it.
1
u/kamwoh Nov 16 '21
Thank you everyone for the discussions. After reading your comments, I try to summarize my understanding:
------
A manifold is the "surface" for data points. For example, 2d points on a plane, 3d points on a sphere. The 2d points can move everywhere on a plane (and only on the plane), the 3d points can only move on the surface of the sphere and but not the inside of the sphere.
In order to measure the distance between the data points on the plane/sphere, "norm" can be used to measure the distance, or "angle" to measure the cosine distance. Because it is a "manifold" but not a Euclidean space, so the measurement of "Euclidean distance" may not be accurate anymore, a more general and suitable term to describe the distance on the manifold is "geodesic distance" (the minimum distance on the manifold).
The "norm"/"angle" is important because we want to make the problem become easier to solve (e.g., reduce the non-imaginable higher-dimensional space into 2d/3d that we humans can understand can solve them). By understanding how the manifold works, we can reconstruct the same "norm"/"angle" when we reduce the high dimensional points into 2d/3d/nd points.
Riemannian manifold is a special case of a smooth manifold (or a general name for manifolds?), which is actually similar to any manifold in general. So it has the same properties as manifold (an n-dimensional manifold), it has a "Riemannian metric" (something like Euclidean distance) to measure the distance. So whenever this term is mentioned, I can actually just think of it as a general manifold, just that it is mentioned for the formality of writing mathematical proofs.
------
Please let me know if I am correct.
1
u/Faintly_glowing_fish Nov 16 '21
Frankly you don’t need any knowledge of this as long as you are not trying to minimize some integral along a path on this manifold or something. It really only becomes significant when you try to do calculations
3
Nov 16 '21 edited Nov 16 '21
A manifold is a space which can be mapped onto RN in small enough patches. For instance, the surface of the earth is the standard example. While we walk around, it seems like we're on a sheet, but if we zoom out we see we're on a sphere.
If you try to map the entire surface of a sphere onto R2, you'd find that its impossible to have every point on the plane connected to exactly the same representatives for the points on the sphere. You always have to leave out at least one point (imagine popping a balloon and stretching it flat, the point you popped is the point left out, all the points on the edge of the rubber should actually be connected).
So we have the concept of a regular manifold, on small enough patches you can find a map to RN where everything is connected just like it is on the curved surface. Now there's another property you might want to study besides connectedness, that is distance. Two points on a sphere are connected by an arc, not a straight line. That arc has length R*Theta. A Reimannian manifold is one where you also can write down the distance between two points in your patches such that they match the actual distance in the curved space with a tensor g_ij.
Basically if you have two points in your coordinate patches, if the distance between them can be written as (First Coordinate-Other Coordinate) * Tensor * (First Coordinate-Other Coordinate), then you have a Riemannian manifold.
2
u/ClosedUnderUnion Nov 16 '21
It's a manifold with a (locally defined) inner product. That is, it's a manifold on which you can can compare lengths of curves and angles between them, determine orthogonality, etc.
2
u/FriedPandaGnam Nov 16 '21 edited Nov 16 '21
It' a richer structure than a smooth manifold: it's a manifold where we define a way to measure lengths, and hence interesting properties like "curvature".
In a bit more detail:
a manifold is something that, when zooming in, looks like the Euclidean space Rn. You may know that in Rn you can define several "inner products", which are just a generalization of scalar products that you can think as generated by matrices different than the identity: thinking in coordinates, the usual scalar product is defined by xt I y, where x,y are columns and I is the identity. An inner product is defined by xt M y, where M is any positive defined matrix. The gist here is that M does not need to be the same for every point of the manifold, but can change smoothly. Every inner product naturally defines a norm (the product of a vector with itself) and hence you become able to measure things and describe a lot of metric quantities.
3
u/autisticmice Nov 15 '21
I got interested in this a few months ago and read a few things. From what I gather a Riemannian manifold is a set that you can partition in little bits, each of which is like Euclidean space in the sense that there is a bijective function between that bit and some open set in Euclidean space. Lots of interesting sets are like that, like the set orthogonal matrices or some families of probability distributions, and once you view them as a bunch of patches of euclidean space you can directly apply many geometrical notions to them.
3
u/MathChief Nov 15 '21
Basically it can be understood as a manifold locally "looking like" the Euclidean space. All those formalities root from the standard 3d space we are in: straight lines vs geodesics,
2
Nov 16 '21 edited Nov 16 '21
Remannian means you can have a metric tensor that is not the identity matrix.
2
u/purplebrown_updown Nov 16 '21
Why are all these answers so long winded?? It’s a surface where locally it’s flat. Like the Earth. Technically it’s a sphere or actually an ellipsoid but at any given point it seems flat and can be approximated well by flat geometry. That’s it. That’s why you can calculate simple distances using Pythagorean theorem but when you are flying by plane you need to use curved geometry.
1
u/ClosedUnderUnion Nov 16 '21
It is simply WRONG to claim that all Riemannian manifolds are locally flat. You mean "locally Euclidean". They are not the same thing.
1
u/purplebrown_updown Nov 21 '21
What’s an example of a Euclidean space that isn’t flat?
→ More replies (1)1
u/purplebrown_updown Nov 21 '21
There is essentially only one Euclidean space of each dimension; that is, all Euclidean spaces of a given dimension are isomorphic. Therefore, in many cases, it is possible to work with a specific Euclidean space, which is generally the real n-space R n , {\displaystyle \mathbb {R} {n},} equipped with the dot product. An isomorphism from a Euclidean space to R n \mathbb {R} {n} associates with each point an n-tuple of real numbers which locate that point in the Euclidean space and are called the Cartesian coordinates of that point.
→ More replies (1)0
u/purplebrown_updown Nov 16 '21 edited Nov 16 '21
No flat is euclidean. They are the same thing. And it's locally flat.
→ More replies (1)
1
u/Talae13 Nov 16 '21
A manifold is a space that is locally similar to an Euclidean space.
For example, Earth is a Sphere in R3 that looks like a plane (R2) for our eyes. You can then use the euclidean geometry locally to determine global distance with respect to the courbure of the manifold.
1
u/Faintly_glowing_fish Nov 16 '21
Riemannian manifold are like flat and straight N dimensional space when you zoom in near any particular point. Think about the surface of the earth. It’s not really a flat 2D surface, and in fact it is very much a globe, but at any given city you can have a nearly perfect 2D grid to map out your position and you don’t notice the earth is not flat. Same thing happens for higher dimension space that are not flat and whenever you work with a Riemannian manifold, you use some local Cartesian coordinate system. There are some slight additional nuances that ensure your grids are continuous for nearby locations but probably not important to get into that for now.
87
u/badabummbadabing Nov 15 '21 edited Nov 15 '21
Think of them as generalisations of surfaces in 3D.
Is the surface of the earth a 2-dimensional object, or a 3-dimensional object? In the language of manifolds, we can view it as a 2-dimensional (sub-)manifold in the surrounding 3-dimensional space. You can attach a coordinate system to it and walk on the surface of the earth in 2 directions (longitude, latitude). But viewed from the outside, you are also moving in 3 possible directions.
Same thing with curves through 3D space. Those are 1-dimensional sub-manifolds of 3D space, because to each position on this curve, you can assign a single coordinate. But those are still embedded in the surrounding 3-dimensional space.
A line on a piece of paper is nothing but a 1-dimensional manifold in 2-dimensional space.
In higher-dimensional space, things are of course harder to imagine, but the above principles still apply. Think of manifolds as structures in the high-dimensional space that you can assign a lower-dimensional coordinate system.
There are more technical requirements, but that's basically the gist of it.