Specifications of parametric density functions
Project description
Density 
A simple dict specification of an algebra of continuous univariate density function mixtures using pydantic.
Install
pip install density
Specifying densities or mixtures of the same
See examples of specifying densities.
See the Scipy manifest for a list of densities.
Evaluating densities
The current use case involves evaluation of a single data point at a time. For this we recommend using the builtin option rather than scipy, and using https://github.com/microprediction/densitypdf package.
from densitypdf import density_pdf
mixture_spec = {
"type": "mixture",
"components": [
{
"density": {
"type": "scipy",
"name": "norm",
"params": {"loc": 0, "scale": 1}
},
"weight": 0.6
},
{
"density": {
"type": "builtin",
"name": "norm",
"params": {"loc": 2.0, "scale": 1.0}
},
"weight": 0.4
}
]
}
val = density_pdf(mixture_spec, x=0.0)
You can also evaluate manually of course, per examples here.
Project details
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file density-1.0.1.tar.gz.
File metadata
- Download URL: density-1.0.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8af7e704cb3c156804c3f305d06e4b971665e4d1b5605185bdcf2b34f3afe440
|
|
| MD5 |
7cd513572174bcf6cbcec3024ec0767d
|
|
| BLAKE2b-256 |
502e22eb0d99d2990a1071f9365e766983fb59041e46282318530ec506c20e63
|
File details
Details for the file density-1.0.1-py3-none-any.whl.
File metadata
- Download URL: density-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efea218aca97a011595aa4647cd947f9cfae27916a8b28ba3c3f67b0053967e2
|
|
| MD5 |
5354bd44991088ba9af1b75ec3567e6e
|
|
| BLAKE2b-256 |
c0299377573c3593a021e595a7a382390fa4ead16eccb611fef0f9e10b0bbfa6
|