## 4 Results
### Detection Using Synthetic Samples  
If unsupervised models based on RBM are well trained, they can correctly represent the distribution of the input units. This is an advantage if we use the RBM as a synthetic sample-generating model. In this case, we can predict the values of the visible units for a  
Figure 9: Instability probability (blue color) and bubble probability (dark red color) together with the S&P500 index (grey color) on the same graph. Graphs (**a**,**c**,**e**) cover dates from 1995 to the end of 2012, while graphs (**b**,**d**,**f**) cover dates from the beginning of 2013 to June 2024. The first row shows the results using the detectors trained only with the 1987 Black Monday crisis samples, while the others are trained with the 1987, 2000, and 2008 crisis samples. The second row of graphs shows the same as the third row, but the latter uses the ANN and BRF trained with 90 days backward-looking (longer warning time). The dotted line represents the probability line \(p=0.5\). The transparent yellow stripes represent times of instability, marked from the critical point \(t_{c}\) to the lowest recorded index value. The dot-com crisis, Subprime crisis, COVID-19 outbreak, and the stock market decline in 2022 are marked. desired target with predetermined fixed visible units. We will utilize this resource by using the trained GGRBM to analyze under which conditions the GGRBM-BRF bubble detector model gives us higher or lower bubble probabilities. In this way, we can use the trained unsupervised model as a generative sensitivity analysis. Inspired by using RBMs as collaborative filters [79], we have a vector \(\mathbf{v}\) with \(m\) units. Of these units, some we will leave fixed in advance, and others will be left free to adopt whatever the RBM determines. Given the vector \(\mathbf{v}\), we want to find the probability distribution of the free units after a Gibbs sampling iteration. For this, we see the vector of the hidden layer \(\mathbf{h}^{\prime}=p(\mathbf{h}|\mathbf{v})\) with Equation (7), and then recover the vector of visible units \(\mathbf{v}^{\prime}=p(\mathbf{h}|\mathbf{h}^{\prime})\). We replace the values of the visible units in \(\mathbf{v}^{\prime}\) that we determined as clamped with the original values of \(\mathbf{v}^{\prime}\). In this way, we generate a synthetic sample. We can repeat this process several times to achieve a set of synthetic samples so that, for a subset of visible units that remain fixed (determined by the user), we obtain a distribution of the possible values of the free visible units. Finally, we can treat these synthetic samples as real samples for the bubble detector to give us a bubble probability. Therefore, we must again submit these synthetic samples to the GGRBM to obtain the values of the hidden layer, which in turn submits them to the BRF. This exercise is interesting because it allows us to analyze under which conditions a higher bubble probability exists. To describe the usefulness of this exercise, we will use a GGRBM trained with \(k=8\) slices of volatility and returns, slopes, and cumulative returns for \(\delta=\{375,500,1250\}\) days using data from 30 April 1987 to 25 June 2024, covering three major crises (1987, 2000, and 2008). We have created three base cases of analysis from which we generate synthetic samples. In all cases, we leave the volatility and return values of the \(k=8\) lags fixed, while the features of slopes and cumulative returns are presented on six possible variants from A to F. On these variants, each slope feature and cumulative return can take the following condition: free to run or fixed to the case. For more details, refer to Table A1 of Appendix E.  
Case 1 consists of high volatility and low return values resembling instability periods; the slopes and cumulative returns remain low. Case 2 consists of low and high volatility and return values, respectively; the slopes and cumulative returns remain high, resembling bubble periods.