Please excuse that the following will be a somewhat soft question.


Let $(M,d)$ be a metric space and $X(\omega)$ a random variable on $M$ with distribution $\mu$.


Assume now that $M = \overline{B\_1^n(0)}$ the $n$-dimensional closed ball of radius $1$ around $0$ and that $\mu$ has a density funciton $f\_\mu$. Assume further that $f\_\mu >> 1$ near $\partial M$ and that $f\_\mu<<1$ near $0$.


Can we formally make sense of the idea that $X$ "most likely sees" $\partial M$ as a nonzero homology class, but that $X$ might also "see" this homology class might also be $0$ (because there are chains $\partial M$ is the boundary of, but all of them cover a region of very small probability)? Can we define a homology or homotopy groups for $(M,d,\mu)$?



Is there a homotopy/homology-theory for probability spaces?
One possible approach is via persistent homology. It is outlined in the paper "[Persistent homology for metric measure spaces, and robust statistics for hypothesis testing and confidence intervals](https://web.ma.utexas.edu/users/blumberg/metricmeasure1.pdf)" by Blumberg, Gal, Mandell and Pancia


In a nutshell, the idea is the following. Choose a finite sample $S$ of points in $M$, with probabilities determined by the density function $f\_\mu$. You get a finite metric subspace of $M$, whose points cluster in areas of high probability. To this ``cloud of points'' $S$ you can associate a diagram of simplicial complexes, indexed by a parameter $\epsilon$. Roughly speaking, you form the complex by connecting the points in $S$ that are close enough to each other, and also filling in the simplices that are small enough. Where "close enough" and "small enough" depends on the parameter $\epsilon$. The persistent homology of this diagram records the features of the homology that persist over a large range of values for $\epsilon$. Persistent homology provides a possible answer to your question.


