timescale / timescaledb-toolkit

Extension for more hyperfunctions, fully compatible with TimescaleDB and PostgreSQL 📈
https://www.timescale.com
Other
362 stars 46 forks source link

Gen_random_timeseries #180

Open davidkohn88 opened 3 years ago

davidkohn88 commented 3 years ago

Generating test data with various distributions is really a PITA, it'd be really nice to be able to generate random timeseries with different distributions, ie a normal, bimodal, random walk, uniform, exponential etc.

I think we'd probably also want something to describe the spacing of the time points, so either regular or irregular with some parameters

Then I could insert that into a table and see if the analysis I've been trying to do actually catches what I'm trying to understand and what distributions it works for and what it doesn't.

The api could look something like: gen_random_timeseries(seed, DistributionParams, SeriesParams)

Where distribution params might be something like: normal(avg, stddev) And the series might look something like: regular(start, end, step) irregular(start, end, num_points)

I think the early stuff would just do regular timeseries and perhaps just expose the different distributions here: https://rust-random.github.io/rand/rand_distr/index.html

davidkohn88 commented 3 years ago

Related to #121

JLockerman commented 3 years ago

I'd recomend the parameters just be a something a JSON like '{normal: {avg:10.0, stddev: 5.0 }}', or whatever PostgresTypes generates. That'll make it a lot easier to add things, and less work to start out.