# Topic Detection Based on Sentence Embeddings and Agglomerative Clustering with Markov Moment
## Methods
### Cluster Analysis as a Random Process and the Markov Moment of Its Stopping  
Now, we will formally determine the moment of stopping the clustering process using the theory of random processes and the theory of sequential statistical analysis. Here, the approximation-estimation test is used as the decisive statistical criterion. Let \(T=\overline{1,m-1}\) be a bounded subset of the natural series, containing natural numbers: \(1,2,\ldots,m-1\). Subsequently, the family \(\xi=\{\xi_{t},t\in T\}\) of random variables \(\xi_{t}=\xi_{t}(\omega)\) defined for \(\forall\ t\in T\) on the same probability space \((\Omega,\mathcal{F},\mathbb{P})\) is called a discrete random process. Each random variable \(\xi_{t}\) generates a \(\sigma\)-algebra, which we denote as \(\mathcal{F}_{\xi_{t}}\). Subsequently, the \(\sigma\)-algebra generated by the random process \(\xi=\{\xi_{t},t\in T\}\) is called the minimal \(\sigma\)-algebra containing all \(\mathcal{F}_{\xi_{t}}\) i.e.,  
\[\sigma(\xi)=\sigma\left(\bigcup_{t=1}^{m-1}\mathcal{F}_{\xi_{t}}\right). \tag{17}\]The discrete random process \(\xi=\{\xi_{t},t\in T\}\) can be considered as a function of two variables \(\xi=\xi(t,\omega)\), where \(t\) is the natural argument, \(\omega\) is a random event. If we fix \(t\), then, as indicated above, we obtain a random variable \(\xi_{t}\); if we fix a random event \(\omega_{0}\), we obtain a function of the natural argument \(t\), which is called the trajectory of the random process \(\xi\) and is a random sequence of \(\xi_{t}(\omega_{0})\). We consider the clustering of a finite set \(X\) from the Euclidean space \(\mathbb{R}^{n}\) as a discrete random process \(\xi=\xi(t,\omega)\). A random event of \(\omega\in\Omega\) will be the extraction of a sample of \(X\) from \(\mathbb{R}^{n}\). Theoretically, any point \(\overline{x}\in\mathbb{R}^{n}\) can belong to the sample set \(X\), therefore the \(\sigma\)-algebra from the probability space \((\Omega,\mathcal{F},\mathrm{P})\) contains all \(\mathbb{R}^{n}\), any finite set \(X\) from the space \(\mathbb{R}^{n}\), all possible countable unions of such sets, and additions to it. We denote this set system as \(\mathcal{S}\left(\mathbb{R}^{n}\right)\) and call it selective \(\sigma\)-algebra, \(\mathcal{F}=\mathcal{S}\left(\mathbb{R}^{n}\right).\) The same reasoning holds for any \(\sigma\)-algebra \(\mathcal{F}_{\xi_{t}}\). Therefore, \(\sigma(\xi)=\mathcal{S}\left(\mathbb{R}^{n}\right).\)  
Consider the binary problem of testing the statistical hypotheses \(H_{0}\) and \(H_{1}\). Where the null hypothesis \(H_{0}\), or the random sequence of \(\xi_{t}(\omega_{0})\), increases linearly, and the alternative hypothesis \(H_{1}\), or the random sequence \(\xi_{t}(\omega_{0})\), increases non-linearly (parabolically). It is necessary to construct the criterion as a strict mathematical rule that tests the statistical hypothesis. In the Euclidean space, \(\mathbb{R}^{n}\) during agglomerative clustering of sample data, one of the main characteristics of the process will be a set of minimum distances. It is natural to consider its values as a random variable \(\xi_{t}\colon\Omega\longrightarrow\mathbb{R}\), assuming that \(t\) is the iteration number of the agglomerative clustering algorithm \(\mathcal{A}\). For any fixed random event \(\omega_{0}\in\Omega\), the corresponding trajectory \(\xi_{t}(\omega_{0})=F_{t}\) is a monotonically increasing random sequence. On the probability space \((\Omega,\mathcal{F},\mathrm{P})\) the family of \(\sigma\)-algebras \(\mathfrak{F}=\{\mathcal{F}_{t},\,t\in T\}\) is called a filtration, if for \(\forall\ i,j\in T\,|\,i<j:\,\mathcal{F}_{i}\subset\mathcal{F}_{j}\subset \mathcal{F}\). Moreover, if for \(\forall\ t\in T:\,\mathcal{F}_{t}=\sigma(\xi_{i},\,i<t)\), then the filtration is called natural.