yet another vine copula library for PyTorch.
Project description
TorchVineCopuLib
Yet another vine copula package, using PyTorch.
- Vectorized tensor computation with GPU (
device='cuda'
) support - Shorter runtimes for higher dimension simulations
- Decoupled dataclasses and factory methods
- Pure
Python
library, tested against pyvinecopulib on Windows, Linux, MacOS - IO and visualization support
Dependencies
# inside the `./pyproject.toml` file
python = "^3.10"
scipy = "*"
torch = "^2"
For PyTorch with cuda
support on Windows:
pip install torch --index-url https://download.pytorch.org/whl/cu121 --force-reinstall
[!TIP] macOS users should set
device='cpu'
at this stage, for usingdevice='mps'
won't supportdtype=torch.float64
.
Installation
By pip
from PyPI
:
pip install torchvinecopulib
with full drawing and bivariate dependency metric support:
pip install torchvinecopulib matplotlib pot scikit-learn
By pip
from ./dist/*.whl
or ./dist/*.tar.gz
in this repo.
Need to use proper file name.
# inside project root folder
pip install ./dist/torchvinecopulib-2024.3.3-py3-none-any.whl
# or
pip install ./dist/torchvinecopulib-2024.3.3.tar.gz
Examples
Visit the ./examples/
folder for .ipynb
Jupyter notebooks.
Documentation
-
Visit GitHub Pages website
-
Or visit the
./docs/_build/html
subfolder for statichtml
made withSphinx
-
Or build by yourself (need
Sphinx
, themefuro
and the GNUmake
)
# inside project root folder
sphinx-apidoc -o ./docs ./torchvinecopulib && cd ./docs && make html && cd ..
Tests
[!TIP] the
./tests/test_vinecop.py
may take longer without'cuda'
# inside project root folder
python -m pytest ./tests
Contributing
We welcome contributions, whether it's a bug report, feature suggestion, code contribution, or documentation improvement.
- If you encounter any issues with the project or have ideas for new features, please open an issue on GitHub or privately email us. Make sure to include detailed information about the problem or feature request, including steps to reproduce for bugs.
Code Contributions
- Fork the repository and create a new branch from the
main
branch. - Make your changes and ensure they adhere to the project's coding style and conventions.
- Write tests for any new functionality and ensure existing tests pass.
- Commit your changes with clear and descriptive commit messages.
- Push your changes to your fork and submit a pull request to the
main
branch of the original repository.
Pull Request Guidelines
- Keep pull requests focused on addressing a single issue or feature.
- Include a clear and descriptive title and description for your pull request.
- Make sure all tests pass before submitting the pull request.
- If your pull request addresses an open issue, reference the issue number in the description using the syntax
#issue_number
. - in-place ops can be slower
- torch.jit.script can be slower
TODO
- more
bicop
class intorch
- potentially deprecating
'mle'
frommtd_fit
- bivariate dependence funcs in
util.ENUM_FUNC_BIDEP
, resolve non-torch
pkg dependencies (scikit-learn
,pot
)
License
Copyright (C) 2024 Tuoyuan Cheng, Xiaosheng You, Kan Chen
This file is part of torchvinecopulib. torchvinecopulib is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
torchvinecopulib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with torchvinecopulib. If not, see http://www.gnu.org/licenses/.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for torchvinecopulib-2024.3.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f808faea46b329f8edef8f2f906682ccf622a5dbd9d7375891ead46337895912 |
|
MD5 | 9faf46dba8fdeaa5b82cd68be8340b59 |
|
BLAKE2b-256 | e9708b73eef92d421f647fe05ec308981bcd4e943a7628ae1c3eeda5f2d38df2 |
Hashes for torchvinecopulib-2024.3.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 54a0d91c77301c3b0521024a2d8c63b2e0764592920d021055600feb95117f40 |
|
MD5 | 72cbc060d3d6aa5a6503b4695d50652c |
|
BLAKE2b-256 | 8f647d7a2fa13f58374538482cee6b6cd623d826f4592160534214843a0e4a47 |