Skip to main content

TRIDENT, TRIadic DEtectioN via staTistical validation

Project description

TRIDENT

TRIDENT (TRIplets DEtectioN via staTistical validation) is a Python package for the statistical validation of pairwise and triadic interactions in binary bipartite data.

TRIDENT implements a maximum-entropy validation pipeline:

  • BiCM (Bipartite Configuration Model) for validating pairs,
  • BiPLOM (Bipartite Partial Local Overlap Model) for validating triplets,
  • Poisson-binomial p-values (exact or approximated), with multiple-testing correction (Bonferroni or FDR, with FDR recommended) to produce validated networks and hypergraphs.

The methodology is described in the companion preprint Signatures of higher-order cooperation/coordination in the human brain.

Installation

pip install trident-validator

For development:

git clone <repo-url>
cd TRIDENT
pip install -e ".[dev]"
pytest -q

Quick start

Validate pairs (BiCM)

import numpy as np

from trident import bicm_solver, probability_matrix_from_bicm
from trident import TwoStarValidator

A = ...  # binary biadjacency matrix (N x M)

res = bicm_solver(A)
P   = probability_matrix_from_bicm(res)

val = TwoStarValidator(A, P, n_jobs=1)
pvals = val.compute_pvals(method="normal")
df_pairs, thr = val.validate(pvals, alpha=0.05, method="fdr")

Validate triplets (BiPLOM)

from trident import biplom_solver, probability_matrix_from_biplom
from trident import TripletValidator

res = biplom_solver(A)
P   = probability_matrix_from_biplom(res)

val = TripletValidator(A, P, n_jobs=1)
pvals = val.compute_pvals(method="normal")
df_triplets, thr = val.validate(pvals, alpha=0.05, method="fdr")

Documentation

See the docs/ folder:

  • docs/api_quick_reference.md
  • docs/math.md
  • docs/usage.md

Acknowledgements and citations

TRIDENT builds on and extends maximum-entropy methods for bipartite networks and statistically validated projections.

If you use TRIDENT, please also consider citing the reference BiCM implementation and the following foundational works:

  • Reference implementation (BiCM module): https://github.com/mat701/BiCM
  • N. Vallarano, M. Bruno, E. Marchese, G. Trapani, F. Saracco, T. Squartini, G. Cimini, M. Zanon, "Fast and scalable likelihood maximization for Exponential Random Graph Models with local constraints", Scientific Reports (2021).
  • F. Saracco, R. Di Clemente, A. Gabrielli, T. Squartini, "Randomizing bipartite networks: the case of the World Trade Web", Scientific Reports 5, 10595 (2015).
  • F. Saracco, M. J. Straka, R. Di Clemente, A. Gabrielli, G. Caldarelli, T. Squartini, "Inferring monopartite projections of bipartite networks: an entropy-based approach", New Journal of Physics 19, 053022 (2017).

License

MIT (see LICENSE).

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

trident_validator-0.1.0.tar.gz (34.2 kB view details)

Uploaded Source

Built Distribution

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

trident_validator-0.1.0-py3-none-any.whl (38.4 kB view details)

Uploaded Python 3

File details

Details for the file trident_validator-0.1.0.tar.gz.

File metadata

  • Download URL: trident_validator-0.1.0.tar.gz
  • Upload date:
  • Size: 34.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.13

File hashes

Hashes for trident_validator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aa3c25411d981275afc7caf665c0a61afc0cac28ca900a73aa243022846aaa62
MD5 20b5362c3e1f5482c7e93d154ddb32bd
BLAKE2b-256 93c3c1c4460424e24364f889d4bf03e89f9650dad1c9987d66fc53b4fda03b44

See more details on using hashes here.

File details

Details for the file trident_validator-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for trident_validator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51add3c0049725aea85f25de0f49dbc26404a9194368b9022c176265ccf31f74
MD5 5663363b24fda7909ff9c63a2bf6f7b5
BLAKE2b-256 9cb9594f755c2ee83792999c576cb63ec92ee73075bf22d5bc619763ac4e4fc7

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