I am using timeGAN from ydata-synthetic repo.

Given a trained model synth, we generate synthetic data by:

synth_data = synth.sample(2000)

This will generate 2000 sequences randomly.

My question is, what if the original data has trend, and we wish to generate synthetic data which indicates the trend (similar size as original data)?

For example, suppose original data looks like below

enter image description here

and somehow we wish to generate synthetic data which also indicates the trend. Is it possible to do it? What I can think of is to increase seq_len to properly cover the trend.

Please help. Thanks.


1 Answer 1


To the best of my knowledge, all generally used synthetic data generation methods scale their data to reside in $[0, 1]$ or $[-1, 1]$. This is also done in TimeGAN & RCGAN.

  1. If your data has a significant but regular downward trend, you probably want to reduce the trend in a data preprocessing step.
  2. If your data has significant and highly varying trends (one going upwards, the other going downwards), then you simply stumbled across a limitation in the architecture. These models work best on somewhat normally distributed data. If your time-series goes all over the place, the model will have a hard time converging. More research still has to be done into time-series generative networks to be able to predict such trends.
  • $\begingroup$ Robin, I don't quite understand your first explanation. Can you elaborate more detail? What do you mean "reduce trend in a data preprocessing step"? $\endgroup$
    – TripleH
    Commented May 24, 2023 at 16:56
  • $\begingroup$ If all your samples have a downward trend, you probably want to correct the downward trend in preprocessing, such that the general trend is removed, and you can more easily generate all samples. After generation, you can reintroduce the trend using the inverse of your preprocessing step. $\endgroup$ Commented May 24, 2023 at 18:29
  • $\begingroup$ If sample has globally downward trend, then after globally normalizing by Max and Min, the trend won't change. When we used synth.sample(100), it randomly generated 100 sequences with size=24 (assume seq_len=24). If we just naively concatenate the sequences to a time-series, we cannot show downward trend, even introducing inverse of preprocessing. However, if we make Max and Min for EACH sequence in preprocessing step and record it, after generating 100 sequences, and introduce inverse max-min in each sequence, I believe globally it can show the downward trend. $\endgroup$
    – TripleH
    Commented May 24, 2023 at 20:43
  • $\begingroup$ You dont remove trends using scaling, but with trend removal transformations. These can be linear or non-linear trend removal techniques. For example, you could use differencing, a common technique in time-series generation, to remove global trend in preprocessing, and reintroduce it after generation again. Here is a blog post that includes differencing. $\endgroup$ Commented May 25, 2023 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.