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
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
Hashes for mv_laplace-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41289d48f14cf19aba9c69b4e702cc196e53cf37fe001063de037bfb58399105 |
|
MD5 | 982490a8d10185888b246a41943f969c |
|
BLAKE2b-256 | fd2adb85b148258d96352e0c7cf0b2ca393ea8f3fec46e31579f502a7e9e3333 |