# Density PDF
Evaluation of univariate density functions defined in the `density` package.
## Install
pip install densitypdf
## Usage
from densitypdf import density_pdf
# Example mixture with one scipy normal and one builtin normal
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)
The `builtin` options are replacements for scipy.stats distributions should you wish to use them.
## Specifying densities or mixtures of the same
One is limited to a finite set of continuous distributions, and mixtures of the same.
See [examples](https://github.com/microprediction/density/tree/main/examples) of specifying densities.
See the [Scipy manifest](https://github.com/microprediction/density/blob/main/density/schemachecker/scipydensitymanifest.py) for a list of densities.
Raw data
{
"_id": null,
"home_page": "https://github.com/microprediction/density",
"name": "densitypdf",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "microprediction",
"author_email": "peter.cotton@microprediction.com",
"download_url": "https://files.pythonhosted.org/packages/d3/6e/f5263108b29d9f871f2134d7efc6ff7c047b75608efdcd1c35719fd50f49/densitypdf-0.1.2.tar.gz",
"platform": null,
"description": "\n# Density PDF \nEvaluation of univariate density functions defined in the `density` package.\n\n\n## Install\n\n pip install densitypdf \n\n\n## Usage \n\n from densitypdf import density_pdf\n\n # Example mixture with one scipy normal and one builtin normal\n\n mixture_spec = {\n \"type\": \"mixture\",\n \"components\": [\n {\n \"density\": {\n \"type\": \"scipy\",\n \"name\": \"norm\",\n \"params\": {\"loc\": 0, \"scale\": 1}\n },\n \"weight\": 0.6\n },\n {\n \"density\": {\n \"type\": \"builtin\",\n \"name\": \"norm\",\n \"params\": {\"loc\": 2.0, \"scale\": 1.0}\n },\n \"weight\": 0.4\n }\n ]\n }\n\n val = density_pdf(mixture_spec, x=0.0)\n\nThe `builtin` options are replacements for scipy.stats distributions should you wish to use them. \n\n## Specifying densities or mixtures of the same\nOne is limited to a finite set of continuous distributions, and mixtures of the same. \n\nSee [examples](https://github.com/microprediction/density/tree/main/examples) of specifying densities. \n\nSee the [Scipy manifest](https://github.com/microprediction/density/blob/main/density/schemachecker/scipydensitymanifest.py) for a list of densities. \n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Evaluation of probability density functions",
"version": "0.1.2",
"project_urls": {
"Homepage": "https://github.com/microprediction/density"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a2b59d66e3a1d70a53ab8d79f2b38a82c155980bef9a5463f2cd4f7995caf18d",
"md5": "7ba66a2894ca2162235f08df8a9c0db3",
"sha256": "7cfbdda444c85afc28a9c48fd4a79fbb924d2b45fcceb713209649fddc2dc083"
},
"downloads": -1,
"filename": "densitypdf-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7ba66a2894ca2162235f08df8a9c0db3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8502,
"upload_time": "2025-01-09T22:44:05",
"upload_time_iso_8601": "2025-01-09T22:44:05.980871Z",
"url": "https://files.pythonhosted.org/packages/a2/b5/9d66e3a1d70a53ab8d79f2b38a82c155980bef9a5463f2cd4f7995caf18d/densitypdf-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d36ef5263108b29d9f871f2134d7efc6ff7c047b75608efdcd1c35719fd50f49",
"md5": "1d2d25dd8360d8511ac9d7a486300dfe",
"sha256": "05b080d3d9d6e62de26715c0021086d1dbdf04668827144df0e52be80f39d9a9"
},
"downloads": -1,
"filename": "densitypdf-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "1d2d25dd8360d8511ac9d7a486300dfe",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 12097,
"upload_time": "2025-01-09T22:44:07",
"upload_time_iso_8601": "2025-01-09T22:44:07.472486Z",
"url": "https://files.pythonhosted.org/packages/d3/6e/f5263108b29d9f871f2134d7efc6ff7c047b75608efdcd1c35719fd50f49/densitypdf-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-09 22:44:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "microprediction",
"github_project": "density",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "pydantic",
"specs": [
[
">=",
"2.10.5"
]
]
}
],
"lcname": "densitypdf"
}