Skip to main content

Implementation of a Permutation Test using the Energy Distance for two sample tests and posterior coverage tests

Project description

PTED: Permutation Test using the Energy Distance

PyPI - Version CI Code style: black PyPI - Downloads codecov

Think of it like a multi-dimensional KS-test! It is used for two sample testing and posterior coverage tests.

Install

To install PTED, run the following:

pip install pted

Usage

PTED (pronounced "ted") takes in x and y two datasets and determines if they come from the same underlying distribution.

Example: Two-Sample-Test

from pted import pted
import numpy as np

p = np.random.normal(size = (500, 10)) # (n_samples_x, n_dimensions)
q = np.random.normal(size = (400, 10)) # (n_samples_y, n_dimensions)

p_value = pted(p, q, permutations = 1000)
print(f"p-value: {p_value:.3f}") # expect uniform random from 0-1

Example: Coverage Test

from pted import pted_coverage_test
import numpy as np

g = np.random.normal(size = (100, 10)) # ground truth (n_simulations, n_dimensions)
s = np.random.normal(size = (200, 100, 10)) # posterior samples (n_samples, n_simulations, n_dimensions)

p_value = pted_coverage_test(g, s, permutations = 100)
print(f"p-value: {p_value:.3f}") # expect uniform random from 0-1

GPU Compatibility

PTED works on both CPU and GPU. All that is needed is to pass the x and y as PyTorch Tensors on the appropriate device.

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

pted-0.0.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

pted-0.0.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file pted-0.0.1.tar.gz.

File metadata

  • Download URL: pted-0.0.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pted-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a3cef3938d2cfedded79933b552a25291e1c23479169b06146a0f59aa604fc68
MD5 8c591c83a46e1b7f4a4c792004291582
BLAKE2b-256 870c0afa8850a45d070dca13079f7d9a009b10bf8f82a9d7f56e5c2c5925121a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pted-0.0.1.tar.gz:

Publisher: cd.yml on ConnorStoneAstro/pted

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

File details

Details for the file pted-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pted-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for pted-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a37548d02e791464bc9074750b458202047f1b4c07166cdb4b8b9707c8cb4d5d
MD5 204b084481c48aa0cce60642c273cb1d
BLAKE2b-256 6cc9490900fbedfc14074bfd8f66082913d0678fd1464fe0f79470e3276ebdcc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pted-0.0.1-py3-none-any.whl:

Publisher: cd.yml on ConnorStoneAstro/pted

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