## 4 The Model
### Proposed Model  
The principal objective of this study is to propose an innovative method for generating synthetic sequential data, which synergistically combines two well-established approaches: the VAE and MCMC simulation. This integration seeks to address the limitations of traditional methods, offering an advanced alternative for modelling complex phenomena and reproducing the dynamics of real data. The VAE is a generative model comprising two principal neural networks, the encoder and the decoder. Their optimisation is achieved through the minimisation of a reconstruction loss function, which measures the discrepancy between the real and synthetic data generated. On the other hand, the MCMC simulation method employs probability sampling techniques to obtain samples from complex probabilistic distributions, such as those characterising time series. This approach is distinguished by its capacity to generate samples from sequences of dependent observations, in contrast to the traditional Monte Carlo sampling approach, where observations are treated as independent. MCMC is based on the concept of Markov chains, which represent a fundamental framework for modelling stochastic processes with temporal dependencies. A Markov chain is defined as a sequence of random variables that evolve per the Markov property. This property asserts that the probability distribution of future values in the chain is exclusively contingent on the current value \(X_{t}\), regardless of the chain's past history. The distinctive aspect of this model is the utilisation of the latent space distribution, which is learned from the VAE encoder and employed as a posteriori distribution from which the MCMC generates samples, subsequently provided as input to the VAE decoder. This approach aims to allow a more flexible modelling of the underlying phenomena, enabling the model to more accurately represent the latent structure of the data and to generate synthetic observations that preserve statistical properties and time series dependencies. The model architecture was developed in three principal phases, with a progressive increase in complexity and to enhance the capacity to model the complex characteristics associated with financial time series. However, particular attention was given to maintaining a balance between model complexity and practicality, to ensure an architecture that is efficient to train and that does not require significant costs in terms of computational resources and time. VAE with Convolutional Layers  
The initial configuration of the model is based on a VAE, in which the encoder and decoder consist of 1D convolutional layers:  
* Encoder: The encoder consists of a series of convolutional layers that compress time sequences from the feature dimension into a low-dimensional latent representation. In this case, the convolutional layers apply filters of increasing size with a Rectified Linear Unit (ReLU) activation function. The result is then flattened using a Flatten() layer, which converts the output to a one-dimensional vector (the latent representation) from which the mean and logarithmic variance are extracted. In addition to these two, the encoder also provides a sample from the latent vector, generated using the reparameterization method, which adds random variability to the latent representation by combining the mean and the variance with a noise component. * Decoder: The decoder reconstructs the original time sequences from the latent vector produced by the encoder. It begins with a dense layer that reshapes the latent vector to match the dimensionality of the encoder's final dense layer. This is followed by a reshape layer, which restores the sequence to a three-dimensional structure. Subsequently, a series of Conv1 DTranspose layers are employed, implementing deconvolution operations to restore the original temporal dimension of the data. The filters are applied in reverse order to those of the encoder, thereby establishing a decoder structure that is symmetrical to the encoder.