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.
Metadata
Release files for density 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| density-1.0.1.tar.gz | 6.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| density-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.0 kB
Release files / density-1.0.1.tar.gz
| Download URL | density-1.0.1.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8af7e704cb3c156804c3f305d06e4b971665e4d1b5605185bdcf2b34f3afe440
|
|
BLAKE2b-256 checksum How to use checksums |
502e22eb0d99d2990a1071f9365e766983fb59041e46282318530ec506c20e63
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|
Release files / density-1.0.1-py3-none-any.whl
| Download URL | density-1.0.1-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
efea218aca97a011595aa4647cd947f9cfae27916a8b28ba3c3f67b0053967e2
|
|
BLAKE2b-256 checksum How to use checksums |
c0299377573c3593a021e595a7a382390fa4ead16eccb611fef0f9e10b0bbfa6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.8
|