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
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3cef3938d2cfedded79933b552a25291e1c23479169b06146a0f59aa604fc68
|
|
| MD5 |
8c591c83a46e1b7f4a4c792004291582
|
|
| BLAKE2b-256 |
870c0afa8850a45d070dca13079f7d9a009b10bf8f82a9d7f56e5c2c5925121a
|
Provenance
The following attestation bundles were made for pted-0.0.1.tar.gz:
Publisher:
cd.yml on ConnorStoneAstro/pted
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pted-0.0.1.tar.gz -
Subject digest:
a3cef3938d2cfedded79933b552a25291e1c23479169b06146a0f59aa604fc68 - Sigstore transparency entry: 197550477
- Sigstore integration time:
-
Permalink:
ConnorStoneAstro/pted@a5d86661671b83315f05da8e398f419bb37ae9b0 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/ConnorStoneAstro
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@a5d86661671b83315f05da8e398f419bb37ae9b0 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a37548d02e791464bc9074750b458202047f1b4c07166cdb4b8b9707c8cb4d5d
|
|
| MD5 |
204b084481c48aa0cce60642c273cb1d
|
|
| BLAKE2b-256 |
6cc9490900fbedfc14074bfd8f66082913d0678fd1464fe0f79470e3276ebdcc
|
Provenance
The following attestation bundles were made for pted-0.0.1-py3-none-any.whl:
Publisher:
cd.yml on ConnorStoneAstro/pted
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pted-0.0.1-py3-none-any.whl -
Subject digest:
a37548d02e791464bc9074750b458202047f1b4c07166cdb4b8b9707c8cb4d5d - Sigstore transparency entry: 197550482
- Sigstore integration time:
-
Permalink:
ConnorStoneAstro/pted@a5d86661671b83315f05da8e398f419bb37ae9b0 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/ConnorStoneAstro
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@a5d86661671b83315f05da8e398f419bb37ae9b0 -
Trigger Event:
release
-
Statement type: