Library for signal detection theory analysis.
Project description
Kriterion
Kriterion is a Python library for analysing data using signal detection theory.
Key features:
- Compute sensitivity and bias measures: d', c and more
- Fit detection models to ROC data
- Assess model fits
Installation
It is recommend to use a virtual environment when installing python packages (see here). Then:
python -m pip install kriterion
Dependencies
- NumPy
- SciPy
Usage
Check the docs for more details.
Example 1: Basic signal detection theory measures
With a single true positive and false positive rate, return all common detection measures:
from kriterion.measures import compute_performance
result = compute_performance(tpr=0.75, fpr=0.21)
print(result)
Performance(
tpr=0.75,
fpr=0.21,
d_prime=1.480910997214322,
a_prime=0.850886075949367,
c_bias=0.06596574841107933,
beta=1.1026202605581668,
a_z=None
)
Example 2: Receiver operating characteristic (ROC) modelling
Given a set of rating-scale responses to signal and noise trials:
from kriterion.data import ROCData
from kriterion.fit import fit
from kriterion.models import UnequalSignalDetection
data = ROCData(
# Strongest "signal" <---> Strongest "noise"
# All responses to signal-present trials
signal=[505, 248, 226, 172, 144, 93],
# All responses to signal-absent (i.e. noise) trials
noise=[115, 185, 304, 523, 551, 397],
)
uvsdt = UnequalSignalDetection(data)
result = fit(uvsdt)
print(uvsdt.parameters)
{
'd': 1.1830254066861041,
'signal_sd': 1.337287925732202,
'c0': 1.0405303717702958,
'c1': 0.46634923592441596,
'c2': -0.06932116955166004,
'c3': -0.6973808897916125,
'c4': -1.4561271120010804
}
print(result)
ModelSummary(
dof=3,
chi2=9.183606301259807,
chi2_p=0.02694676677704899,
g2=9.305614752213955,
g2_p=0.02549179488508846,
log_likelihood=-5761.067476662813,
aic=11536.134953325625,
bic=11579.184187136441,
sse=0.0004422615018773785
)
License
This project is licensed under the terms of the GPL-3.0 license.
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 kriterion-0.1.1.tar.gz.
File metadata
- Download URL: kriterion-0.1.1.tar.gz
- Upload date:
- Size: 24.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2e88b96b7ac8e5a157f26392a273fd6876a487c4c7a5afdee1a4ab04e51a414
|
|
| MD5 |
a93ed23138966d94c7a8c912cc2389f2
|
|
| BLAKE2b-256 |
f5b7a4df4055273f4a8b01722529b7c04898bb96cfe77983a547d00578f8279c
|
Provenance
The following attestation bundles were made for kriterion-0.1.1.tar.gz:
Publisher:
publish.yaml on lcdunne/kriterion
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kriterion-0.1.1.tar.gz -
Subject digest:
a2e88b96b7ac8e5a157f26392a273fd6876a487c4c7a5afdee1a4ab04e51a414 - Sigstore transparency entry: 1671592217
- Sigstore integration time:
-
Permalink:
lcdunne/kriterion@e655f7ece965bfda66df1c5bb9e479e290bada74 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/lcdunne
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@e655f7ece965bfda66df1c5bb9e479e290bada74 -
Trigger Event:
release
-
Statement type:
File details
Details for the file kriterion-0.1.1-py3-none-any.whl.
File metadata
- Download URL: kriterion-0.1.1-py3-none-any.whl
- Upload date:
- Size: 25.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0a0f00d988157169c9b846a2129b80f048cf35f87343395a65acdd079298d3a
|
|
| MD5 |
83fb405add47f7d8f1d4a2cc4120d770
|
|
| BLAKE2b-256 |
9f0a583f1787b3138c96a005c7f30d640c438f90ba3efee3f38e30c115bf544b
|
Provenance
The following attestation bundles were made for kriterion-0.1.1-py3-none-any.whl:
Publisher:
publish.yaml on lcdunne/kriterion
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kriterion-0.1.1-py3-none-any.whl -
Subject digest:
e0a0f00d988157169c9b846a2129b80f048cf35f87343395a65acdd079298d3a - Sigstore transparency entry: 1671592265
- Sigstore integration time:
-
Permalink:
lcdunne/kriterion@e655f7ece965bfda66df1c5bb9e479e290bada74 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/lcdunne
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@e655f7ece965bfda66df1c5bb9e479e290bada74 -
Trigger Event:
release
-
Statement type: