Sklearn's documentation refers to "flat" or "non-flat" geometry of clusters to describe the use-cases of their implemented clustering algorithms. Those terms are not directly defined. However, the following quote states:

Non-flat geometry clustering is useful when the clusters have a specific shape, i.e. a non-flat manifold, and the standard euclidean distance is not the right metric.

So far, I do understand that a manifold type of shape is poorly represented by a cluster centroïd and that clustering such dataset should rather rely on local density, nearest neighbors, or connectivity constraint. However, I do not understand how it relates to the concept of flatness according to Wikipedia's definition:

In geometry, a flat is a subset of a Euclidean space that is congruent to a Euclidean space of lower dimension.

It seems contradictory to me. For instance, a hypersphere is not geometrically flat but would be flat using sklearn's terminology.

My questions are then:

  • Are flat and non-flat geometry a legit terminology in machine learning and statistics?
  • If yes, what is the mathematical definition?
  • If no, what is the most appropriate alternative? (e.g. manifold vs convex ???)

1 Answer 1


Are flat and non-flat geometry a legit terminology in machine learning and statistics?

These are terminologies from Mathematics, they are valid in any field.

What is the mathematical definition?

(Non) flat manifold

In mathematics, a (Riemannian) manifold is said to be flat if its curvature is everywhere zero; otherwise non-flat. This is very different than the definition of flat object in geometry. According to that definition, only points, lines, and hyper-planes are flat (not for example hyperspheres or segments).

For example, set $\left\{(t,t):t\in(-1,1)\right\}$ is a 1D flat manifold in ${\Bbb R}^2$, set $\left\{(t,t^2):t\in(-1,1)\right\}$ is a 1D non-flat (positively curved) manifold in ${\Bbb R}^2$, and a hypersphere is an $n$D non-flat (positively curved) manifold in ${\Bbb R}^{n+1}$.

Accordingly, a cluster with a (non) flat shape corresponds to a (non) flat manifold.

Here are some examples from the document.

enter image description here

Points are concentrated around (A) two 1D non-flat manifolds (circles) which are non-convex, (B) two 1D non-flat manifolds (arcs) which are non-convex, (C) three 1D flat manifolds (segments) which are convex, (D) three 0D flat manifolds (centers as points) which are convex.

(Non) flat geometry vs a Flat

By "flat geometry" the document means "Euclidean geometry" not "a flat object defined in geometry". If we measure distances (consequently lengths, areas, volumes, etc.) via Euclidean distance we are obeying the Euclidean geometry, otherwise, we are obeying a non-Euclidean geometry. For example, if we measure a distance between two points by following a non-flat manifold (a geodesic), we are obeying a non-Euclidean geometry. As an illustration,

enter image description here

In (A), the red line measures a distance obeying a flat geometry, the blue line measures the distance obeying a non-flat geometry (by moving along the non-flat manifold). If an appropriate map of manifold to a lower dimension is possible (B), obeying a flat geometry would be equivalent to obeying the non-flat geometry before mapping.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.