Skip to main content

Implementations of the CRPS using PyTorch

Project description

binned-cdf

License: MIT python Docs CI CD Coverage Tests mkdocs-material mypy pre-commit pytest Ruff uv

A PyTorch-based distribution parametrized by the logits of CDF bins

Background

The Cumulative Distribution Function (CDF) is a fundamental concept in probability theory and statistics that describes the probability that a random variable $X$ takes on a value less than or equal to a given threshold $x$. Formally, the CDF is defined as $F(x) = P(X \leq x)$, where $F(x)$ ranges from 0 to 1 as $x$ varies from negative to positive infinity. The CDF provides a complete characterization of the probability distribution of a random variable: for continuous distributions, it is the integral of the probability density function (PDF), while for discrete distributions, it is the sum of probabilities up to and including $x$. Key properties of any CDF are the monotonicity and the boundary conditions $\lim_{x \to -\infty} F(x) = 0$ and $\lim_{x \to \infty} F(x) = 1$. CDFs are particularly useful for computing probabilities of intervals, quantiles, and for statistical inference.

Application to Machine Learning

This repository uses the CDF to model and learn flexible probability distributions in machine learning tasks. By parameterizing the CDF with binned logits, it enables differentiable training and efficient sampling, making it suitable for uncertainty estimation, probabilistic prediction, and distributional modeling in neural networks.

Implementation

The BinnedLogitCDF class inherits directly from torch.distributions.Distribution, implementing all necessary methods plus some convenience functions. It supports multi-dimensional batch shapes and CUDA devices. The bins can be initialized linearly or log-spaced.

torch>=2.7 it the only non-dev dependency of this repo.

:point_right: Please have a look at the documentation to get started.

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

binned_cdf-0.1.3.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

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

binned_cdf-0.1.3-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file binned_cdf-0.1.3.tar.gz.

File metadata

  • Download URL: binned_cdf-0.1.3.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for binned_cdf-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d97ccb1c5510735c2c9526fa077cc3fcd277024dd1163bab72f26e30aa3f60d5
MD5 0a220a306e7e44edb49b1fd7e01e7ed5
BLAKE2b-256 daca762e58781db9670f0b66dc55a8e859c3f14544a6ee7a25fc3c66a0e12eb3

See more details on using hashes here.

Provenance

The following attestation bundles were made for binned_cdf-0.1.3.tar.gz:

Publisher: cd.yaml on famura/binned-cdf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file binned_cdf-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: binned_cdf-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for binned_cdf-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4e9abc27e46a6884800a9bb86405988d3ebfa13ce4fd30ffb5a34b2588489be5
MD5 d4850f5588940304e3e4e3cc93994ef8
BLAKE2b-256 de6d3c594c93868f81306d2bbd1dce445c5638e48a6d8972c45e21215dd40691

See more details on using hashes here.

Provenance

The following attestation bundles were made for binned_cdf-0.1.3-py3-none-any.whl:

Publisher: cd.yaml on famura/binned-cdf

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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