gldpy-gpu
Fork of gldpy (Aleksandra Alekseeva, MIT) that adds a PyTorch/CUDA backend, gldpy.gpu.
The import name is gldpy_gpu, so it can be installed next to upstream gldpy.
Install
pip install gldpy-gpu # or: uv add gldpy-gpu
PyTorch is a plain dependency (torch>=2.0): pip/uv picks the wheel for your machine, and
modern GPUs work with the default build. Only Pascal GPUs (GTX 10xx, compute capability 6.1) need an
older CUDA 12.6 build, because newer wheels dropped those kernels. If the installed torch can't run
on your GPU, gldpy_gpu.gpu.GLD warns and falls back to CPU. Fix with:
pip install torch --index-url https://download.pytorch.org/whl/cu126
GPU usage
import torch
from gldpy_gpu import gpu
gld = gpu.GLD("FMKL") # uses CUDA when available, else CPU
p = torch.tensor([0.0, 1.0, 0.2, 0.3], device=gld.device)
x = gld.rand(p, size=10_000_000) # sampling on the GPU
params = gld.fit_LMM(x[:100_000]) # also fit_PM, fit_ML
The original NumPy/SciPy API is unchanged: from gldpy_gpu import GLD.
Benchmarks: uv run python benchmarks/bench_gpu.py.
Speed (GTX 1070, torch 2.14.1+cu126, FMKL, best of runs)
| Operation | N | CPU (NumPy) | GPU (float32) | Speedup |
|---|---|---|---|---|
Q |
10 000 | 0.7 ms | 1.1 ms | 0.7x (launch overhead) |
Q |
1 000 000 | 116 ms | 1.5 ms | 77x |
Q |
10 000 000 | 1.63 s | 7.6 ms | 215x |
CDF_num |
10 000 | 5.6 s | 32 ms | 177x |
CDF_num |
100 000 | 49 s | 32 ms | ~1500x |
fit_LMM (100k samples) |
VSL / RS / FMKL | 1.6 s / 1.3 s / 3.2 s | 6 ms / 311 ms / 386 ms | 271x / 4x / 8x |
Small batches (below ~50k points) are faster on the CPU. float64 is 4-5x slower than float32 on this card.
gldpy
gldpy is Python package that implements tools for using Generalized Lambda Distribution (GLD) of three different parameterization types.
GLD is flexible family of continuous probability distributions with wide variety of density shapes under one functional form. It specified by four parameters which determine location, scale and shape (skewness and kurtosis) of the distribution.
GLD is easily described in terms of quantile function which makes it easy to use in simulation studies.
It can approximate a lot of well-known distributions such as normal, uniform, exponential, Student's, gamma, some of beta distributions and many others.
GLD shapes can be symmetric or asymmetric and have different combination of finite and infinite tails, they include unimodal, U-shaped, J-shaped and monotone density functions. So it is particularly useful tool for data fitting applications.
For more information, see the documentation.
Usage examples
https://github.com/alexsandi/using_gldpy
References
-
Chalabi, Y., Scott, D.J., & Wuertz, D. 2012. Flexible distribution modeling with the generalized lambda distribution.
-
Cheng, R.C.H., & Amin, N.A.K. 1983. Estimating parameters in continuous univariate distributions with a shifted origin. Journal of the Royal Statistical Society: Series B (Methodological), 45(3), 394–403.
-
Freimer, M., Kollia, G., Mudholkar, G.S., & Lin, C.T. 1988. A study of the generalized Tukey lambda family. Communications in Statistics-Theory and Methods, 17, 3547–3567.
-
Karian, Z.A., Dudewicz, E.J. 2000. Fitting statistical distributions: the generalized lambda distribution and generalized bootstrap methods. Chapman and Hall/CRC.
-
Karvanen, J. and Nuutinen, A. 2008. Characterizing the generalized lambda distribution by L-moments. Computational Statistics & Data Analysis, 52(4):1971–1983.
-
King, R. A. R., and MacGillivray, H. L. 1999. "A Starship Estimation Method for the Generalized Lambda Distributions," Australian and New Zealand Journal of Statistics, 41, 353–374.
-
Ramberg, J.S., & Schmeiser, B.W. 1974. An approximate method for generating asymmetric random variables. Communications of the ACM, 17(2), 78–82
-
Ranneby, B. 1984. The maximum spacing method. an estimation method related to the maximum likelihood method. Scandinavian Journal of Statistics, 93–112.
-
Su, S. 2007. Numerical maximum log likelihood estimation for generalized lambda distributions. Computational Statistics & Data Analysis, 51(8), 3983–3998.
-
Van Staden, Paul J., & M.T. Loots. 2009. Method of L-moment estimation for generalized lambda distribution. Third Annual ASEARC Conference. Newcastle, Australia.
Metadata
Release files for gldpy-gpu 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gldpy_gpu-0.3.0.tar.gz | 28.0 kB | Without provenance | Details for gldpy_gpu-0.3.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gldpy_gpu-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for gldpy_gpu-0.3.0-py3-none-any.whl |
Total release size: 52.1 kB
Release files / gldpy_gpu-0.3.0.tar.gz
| Download URL | gldpy_gpu-0.3.0.tar.gz |
|---|---|
| Size | 28.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e0086cd3b2d1877a0dd11449cee0b7861c66e1dbbe4fc292ee9058d366fe688
|
|
BLAKE2b-256 checksum How to use checksums |
93d3a9a72e543c59144a195bc3a392c495fc5e62b32b1626e7e20838afc507ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / gldpy_gpu-0.3.0-py3-none-any.whl
| Download URL | gldpy_gpu-0.3.0-py3-none-any.whl |
|---|---|
| Size | 24.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3cf19ca936cbdf15a3abda6291374be3844ca02140e5e3820fb65438449b2b5
|
|
BLAKE2b-256 checksum How to use checksums |
5e0a8c32bd20015a81f828cfaad365b4bedb6d05e08fbcdb221149dd5c130f3b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for gldpy-gpu 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.