Our Approach to Time Series Prediction

At Quantico, we adopted TimeGAN, a cutting-edge generative adversarial network (GAN) tailored for time-series data, as the foundation for our first predictive modeling effort. This framework allowed us to leverage the temporal structure of financial data while utilizing the powerful adversarial training dynamics of GANs. Our goal was to use TimeGAN to forecast stock market trends over a 24-day horizon, providing accurate and actionable insights.

Italian Trulli

Developing the TimeGAN Framework

TimeGAN combines the core principles of GANs—adversarial training between a generator and a discriminator—with additional components specifically designed for time-series data. Here’s how we implemented the framework:

Generator

The generator in TimeGAN is trained to learn the patterns within historical stock data. Its role is to create synthetic time-series sequences that closely mimic real market behaviors. By iterating on its outputs, the generator improves its ability to produce data that appears indistinguishable from real stock trends.

Discriminator

To evaluate the generator's outputs, we used a Long Short-Term Memory (LSTM) network as the discriminator. LSTM is well-suited for time-series data because it captures long-term dependencies and sequential relationships. The discriminator’s job was to distinguish between real historical data and the synthetic data generated by the generator. The feedback loop between the generator and discriminator is what drives the model’s improvement.

Enhancing the Model: Embedding and Recovery Functions

TimeGAN introduces two additional functions—embedding and recovery—to handle the unique challenges posed by high-dimensional time-series data:

Embedding

We used an embedding function to compress large volumes of time-series data into a lower-dimensional latent space. This step was essential for making the data manageable while preserving its key temporal and structural characteristics. The latent space served as the training ground where the generator and discriminator learned to refine their outputs.

Recovery

Once the adversarial training process was complete, the recovery function reconstructed the data from the latent space back into its original form. This ensured that the generated predictions were not only realistic but also aligned with the structure and dimensions of the input data.

Training Process

The training phase involved a continuous feedback loop between the generator and discriminator. The generator learned to create increasingly convincing synthetic time-series data, while the discriminator refined its ability to identify synthetic data. Over time, both components improved in tandem until they reached a balanced state, completing the GAN training.

What sets TimeGAN apart—and what we found especially valuable—is its hybrid learning objective. This approach combines unsupervised learning with supervised elements, allowing the generator to explicitly learn temporal dependencies in the data. This dual focus ensured that our model’s outputs were not only statistically coherent but also temporally accurate.

Making Predictions

Once training was complete, we deployed the generator to predict stock market trends for the next 24 days. By leveraging the temporal dependencies learned during training, the model was able to produce forecasts that reflected realistic market behaviors. This step demonstrated TimeGAN’s potential to provide insights into future trends, even in a highly dynamic and complex environment like the stock market.

Reflections

Using TimeGAN for our first model at Quantico was both a challenging and rewarding experience. The framework’s ability to embed, learn, and recover temporal patterns made it an ideal choice for our financial modeling needs. We’re excited by the insights it enabled and look forward to building on this foundation to refine our predictive capabilities further.

Italian Trulli