Multivariate Laplace Distribution Sampler
Project description
Multivariate Laplace Distribution
A sampler package from a Multivariate Laplace distrbrution.
Background
I've been exploring Quantitative Finance for awhile now, and one frustrating point is the lack of a good sampler for a Multivariate Laplace distribution. As such I re-purposed a multivariate normal, normal, and Laplace distribution to fill the role of a multivariate Laplace. This isn't a fully implemented scipy-like class, similar to my PertDist package, but just enough for me to spin up a custom MCMC routine and do some proper financial modeling.
Installation
This package is on PyPi, and can be installed using pip install mv-laplace
Usage
Unlike the scipy implementations this is based on, this distribution class provides sampling abilities only and no distributional parameters. The package is pretty straightforward to use:
from mv_laplace import MvLaplaceSampler
sampler = MvLaplaceSampler(loc, cov)
samples = sampler.sample(sample_size)
The input should be a pair of arrays, the first of which containing the location values (the means) in a vector of length M, and the second containing the covariance matrix in a MxM matrix. The return will be a NxM matrix, with N being the sample_size
input on the sampler. I used Wikipedia for basic reference on terminology.
Disclaimer
I provide no guarentees that this package fits proper statistical robustness of how a multivariate Laplace is supposed to work, just that it seems to work for the use case I have identified. Use at your own risk.
Roadmap
- Figure out how to calculate summary information, and refactor API to a scipi-like interface
- Add a Multivariate Asymmetric Laplace distribution class
Version History
License
This project uses the GNU General Public License.
Short version: Have fun and use it for whatever, just make sure to attribute me for it (-:
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
File details
Details for the file mv-laplace-0.1.1.tar.gz
.
File metadata
- Download URL: mv-laplace-0.1.1.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e1349db510d1e49ce668b8ca416b206d4eb4ccf03f49faf919e884a897dfe1e |
|
MD5 | f1498cd3e964c2d162bb71c6ad48a134 |
|
BLAKE2b-256 | 6e4e82245d29c15805ddb2ddf5a4f47716d259917ebd6d970733e777c07ca6b3 |
File details
Details for the file mv_laplace-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: mv_laplace-0.1.1-py3-none-any.whl
- Upload date:
- Size: 15.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2ab7bf94ac759ad3c56b22b11350d5a64238d2fa0ffff44c98e134fa7023b98 |
|
MD5 | 3d10ad1c7bb93fb61107cefbbf5d123b |
|
BLAKE2b-256 | ecc810444edda05e031126544e9e172d377148bf30e5240f77d2d8bc8b7c7a81 |