https://github.com/jonathancrabbe/fourierdiffusion
This repository implements time series diffusion in the frequency domain.
Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
✓Academic publication links
Links to: arxiv.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (15.1%) to scientific vocabulary
Keywords
Repository
This repository implements time series diffusion in the frequency domain.
Basic Info
Statistics
- Stars: 49
- Watchers: 2
- Forks: 8
- Open Issues: 0
- Releases: 0
Topics
Metadata Files
README.md
Time Series Diffusion in the Frequency Domain
This repository implements time series diffusion in the frequency domain. For more details, please read our paper: Time Series Diffusion in the Frequency Domain.
1. Install
From repository:
1. Clone the repository.
2. Create and activate a new environment with conda (with Python 3.10 or newer).
shell
conda create -n fdiff python=3.10
conda activate fdiff
3. Install the requirement.
shell
pip install freqdiff
- If you intend to train models, make sure that wandb is correctly configured on your machine by following this guide.
- Some of the datasets are automatically downloaded by our scripts via kaggle API. Make sure to create a kaggle token as explained here.
When the packages are installed, you are ready to train diffusion models!
2. Use
2.1 Train
In order to train models, you can simply run the following command:
shell
python cmd/train.py
By default, this command will train a score model in the time domain with the ecg dataset. In order to modify this behaviour, you can use hydra override syntax. The following hyperparameters can be modified to retrain all the models appearing in the paper:
| Hyperparameter | Description | Values | |----------------|-------------|---------------| |fouriertransform | Whether or not to train a diffusion model in the frequency domain. | true, false | | datamodule | Name of the dataset to use. | ecg, mimiciii, nasa, nasdaq, usdroughts| | datamodule.subdataset | For the NASA dataset only. Selects between the charge and discharge subsets. | charge, discharge | | datamodule.smootherwidth | For the ECG dataset only. Width of the Gaussian kernel smoother applied in the frequency domain. | $\mathbb{R}^+$ | score_model | The backbone to use for the score model. | default, lstm |
At the end of training, your model is stored in the lightning_logs directory, in a folder named after the current run_id. You can find the run_id in the logs of the training and in the wandb dashboard if you have correctly configured wandb.
2.2 Sample
In order to sample from a trained model, you can simply run the following command:
shell
python cmd/sample.py model_id=XYZ
where XYZ is the run_id of the model you want to sample from. At the end of sampling, the samples are stored in the lightning_logs directory, in a folder named after the current run_id.
One can then reproduce the plots in the paper by including the run_id to the run_list list appearing in this notebook and running all cells.
3. Contribute
If you wish to contribute, please make sure that your code is compliant with our tests and coding conventions. To do so, you should install the required testing packages with:
shell
pip install freqdiff[test]
Then, you can run the tests with:
shell
pytest
Before any commit, please make sure that your staged code is compliant with our coding conventions by running:
shell
pre-commit
4. Cite us
If you use this code, please acknowledge our work by citing
@misc{crabbé2024time,
title={Time Series Diffusion in the Frequency Domain},
author={Jonathan Crabbé and Nicolas Huynh and Jan Stanczuk and Mihaela van der Schaar},
year={2024},
eprint={2402.05933},
archivePrefix={arXiv},
primaryClass={cs.LG}
}
Owner
- Name: Jonathan Crabbé
- Login: JonathanCrabbe
- Kind: user
- Location: London, United Kingdom
- Company: University of Cambridge
- Website: https://jonathancrabbe.github.io/
- Twitter: JonathanICrabbe
- Repositories: 17
- Profile: https://github.com/JonathanCrabbe
🎓PhD in ML Interpretability @ Cambridge ⚙️ Ex-Research Scientist Intern @ Apple & @ MSFTResearch 💡 Interested in Interpretability, Robust ML & GenAI
GitHub Events
Total
- Watch event: 22
- Push event: 1
- Pull request review event: 1
- Pull request event: 2
- Fork event: 4
- Create event: 1
Last Year
- Watch event: 22
- Push event: 1
- Pull request review event: 1
- Pull request event: 2
- Fork event: 4
- Create event: 1
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 1
- Total pull requests: 9
- Average time to close issues: 11 days
- Average time to close pull requests: 7 days
- Total issue authors: 1
- Total pull request authors: 2
- Average comments per issue: 1.0
- Average comments per pull request: 0.0
- Merged pull requests: 9
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 1
- Average time to close issues: N/A
- Average time to close pull requests: 3 minutes
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- fangger4396 (1)
Pull Request Authors
- JonathanCrabbe (6)
- nicolashuynh (4)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 23 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 1
- Total maintainers: 1
pypi.org: freqdiff
Time series diffusion in the frequency domain.
- Homepage: https://github.com/JonathanCrabbe/FourierDiffusion/
- Documentation: https://freqdiff.readthedocs.io/
- License: MIT License Copyright (c) 2023 JonathanCrabbe Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
Latest release: 0.1.0
published about 2 years ago
Rankings
Maintainers (1)
Dependencies
- actions/checkout v3 composite
- actions/setup-python v3 composite
- POT *
- SciencePlots *
- diffusers [torch]
- einops *
- hydra-core *
- ipython *
- kaggle *
- lightning *
- pandas *
- seaborn *
- tables *
- torch *
- torchaudio *
- torchvision *
- transformers *
- wandb *