Skip to main content

Specifications of parametric density functions

Project description

Density tests_312

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

density-1.0.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

density-1.0.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

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

Hashes for density-1.0.1.tar.gz
Algorithm Hash digest
SHA256 8af7e704cb3c156804c3f305d06e4b971665e4d1b5605185bdcf2b34f3afe440
MD5 7cd513572174bcf6cbcec3024ec0767d
BLAKE2b-256 502e22eb0d99d2990a1071f9365e766983fb59041e46282318530ec506c20e63

See more details on using hashes here.

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

Hashes for density-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 efea218aca97a011595aa4647cd947f9cfae27916a8b28ba3c3f67b0053967e2
MD5 5354bd44991088ba9af1b75ec3567e6e
BLAKE2b-256 c0299377573c3593a021e595a7a382390fa4ead16eccb611fef0f9e10b0bbfa6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page