From bad59b245785e2ae21653990dcaa933cf5e697fe Mon Sep 17 00:00:00 2001 From: Alexander Nikitin <1243786+AlexanderVNikitin@users.noreply.github.com> Date: Mon, 23 Oct 2023 12:56:28 +0300 Subject: [PATCH] update docs --- CONTRIBUTING.md | 10 +++++----- docs/index.rst | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ee117ef..5d9fa78 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,24 +17,24 @@ The easiest way to make a pull request is to fork the repo, see [GitHub document ## Development To install TSGM in development mode, first install prerequisites: -``` +```bash pip install -r requirements/requirements.txt pip install -r requirements/tests_requirements.txt pip install -r requirements/docs_requirements.txt ``` and then, install TSGM in development mode: -``` +```bash python setup.py develop ``` To run tests, use pytest, for example: -``` +```bash pytest tests/test_cgan.py::test_temporal_cgan ``` To run linters, use: -``` +```bash flake8 tsgm/ ``` @@ -42,7 +42,7 @@ flake8 tsgm/ We aim to produce high-quality documentation to help our users to use the library. In your contribution, please edit corresponding documentation pages in [./docs](https://github.com/AlexanderVNikitin/tsgm/tree/main/docs). To build the documentation, use: -``` +```bash cd docs make html ``` diff --git a/docs/index.rst b/docs/index.rst index 272a6f7..baa6c54 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,7 +6,45 @@ Time Series Simulator (TSGM) Official Documentation Time Series Generative Modeling (TSGM) is a Python framework for time series data generation. It include data-driven and model-based approaches to synthetic time-series generation. It uses both generative -The package is built on top of `Tensorflow `_ that allows training the models on CPUs, or GPUs. +The package is built on top of `Tensorflow `_ that allows training the models on CPUs, GPUs, or TPUs. + +Quick start: + +.. code-block:: bash + + pip install tsgm + + +.. code-block:: python + + import tsgm + + # ... Define hyperparameters ... + # dataset is a tensor of shape n_samples x seq_len x feature_dim + + # Zoo contains several prebuilt architectures: we choose a conditional GAN architecture + architecture = tsgm.models.architectures.zoo["cgan_base_c4_l1"]( + seq_len=seq_len, feat_dim=feature_dim, + latent_dim=latent_dim, output_dim=0) + discriminator, generator = architecture.discriminator, architecture.generator + + # Initialize GAN object with selected discriminator and generator + gan = tsgm.models.cgan.GAN( + discriminator=discriminator, generator=generator, latent_dim=latent_dim + ) + gan.compile( + d_optimizer=keras.optimizers.Adam(learning_rate=0.0003), + g_optimizer=keras.optimizers.Adam(learning_rate=0.0003), + loss_fn=keras.losses.BinaryCrossentropy(from_logits=True), + ) + gan.fit(dataset, epochs=1) + + # Generate 10 synthetic samples + result = gan.generate(10) + +For more examples, see `our tutorials `_. + +If you find this repo useful, please consider citing our paper: .. code-block:: latex