Travelling salesman path - Python wrapper
This Python package is based on the MATLAB implementation available at biomedical-cybernetics/travelling-salesman-path.
Article Source: Geometric separability of mesoscale patterns in embedding representation and visualization of multidimensional data and complex networks. Acevedo A, Wu Y, Traversa FL, Cannistraci CV (2024) Geometric separability of mesoscale patterns in embedding representation and visualization of multidimensional data and complex networks. PLOS Complex Systems 1(2): e0000012. https://doi.org/10.1371/journal.pcsy.0000012
Before starting
This package requires Concorde to execute calculations. Check the requirements and follow the instructions to install this dependency in your operating system.
Installation
Run the following to install:
pip install pycosep
Usage
Computing the community separability of a given embedding.
from sklearn.datasets import load_iris
from pycosep import community_separability
from pycosep.separability_variants import SeparabilityVariant
# Sample data. Details at https://scikit-learn.org/stable/datasets/toy_dataset.html
data = load_iris()
# Community separability variant
# CPS: centroid projection separability
# LDPS: linear discriminant projection separability
# TSPS: travelling salesman projection separability
variant = SeparabilityVariant.TSPS
indices, _ = community_separability.compute_separability(
embedding=data.data,
communities=data.target,
variant=variant)
print(f"AUC index: {indices['auc']}")
print(f"AUPR index: {indices['aupr']}")
print(f"MCC index: {indices['mcc']}")
Computing the community separability of a given embedding for 1000 permutations.
from sklearn.datasets import load_iris
from pycosep import community_separability
from pycosep.separability_variants import SeparabilityVariant
# Sample data. Details at https://scikit-learn.org/stable/datasets/toy_dataset.html
data = load_iris()
# Community separability variant
# CPS: centroid projection separability
# LDPS: linear discriminant projection separability
# TSPS: travelling salesman projection separability
variant = SeparabilityVariant.LDPS
# Number of iterations for the Null model
permutations = 1000
index_permutations, _ = community_separability.compute_separability(
embedding=data.data,
communities=data.target,
variant=variant,
permutations=permutations)
auc_results = index_permutations['auc']
print(f"AUC original value: {auc_results['original_value']}")
print(f"AUC p-value: {auc_results['p_value']}")
print(f"AUC mean: {auc_results['mean']}")
print(f"AUC max: {auc_results['max']}")
print(f"AUC min: {auc_results['min']}")
print(f"AUC standard_deviation: {auc_results['standard_deviation']}")
print(f"AUC standard_error: {auc_results['standard_error']}")
aupr_results = index_permutations['aupr']
print(f"AUPR original value: {aupr_results['original_value']}")
print(f"AUPR p-value: {aupr_results['p_value']}")
print(f"AUPR mean: {aupr_results['mean']}")
print(f"AUPR max: {aupr_results['max']}")
print(f"AUPR min: {aupr_results['min']}")
print(f"AUPR standard deviation: {aupr_results['standard_deviation']}")
print(f"AUPR standard error: {aupr_results['standard_error']}")
mcc_results = index_permutations['mcc']
print(f"MCC original value: {mcc_results['original_value']}")
print(f"MCC p-value: {mcc_results['p_value']}")
print(f"MCC mean: {mcc_results['mean']}")
print(f"MCC max: {mcc_results['max']}")
print(f"MCC min: {mcc_results['min']}")
print(f"MCC standard deviation: {mcc_results['standard_deviation']}")
print(f"MCC standard error: {mcc_results['standard_error']}")
Reporting an issue
For reporting problems, questions, and suggestions; please, use the Issues section.
Metadata
Release files for pycosep 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pycosep-0.2.0.tar.gz | 23.0 kB | With provenance | Details for pycosep-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pycosep-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pycosep-0.2.0-py3-none-any.whl |
Total release size: 41.8 kB
Release files / pycosep-0.2.0.tar.gz
| Download URL | pycosep-0.2.0.tar.gz |
|---|---|
| Size | 23.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cb628415df3e3a84c536aef17804ab56ed8de4ff62d95e17f76f236878fb5563
|
|
BLAKE2b-256 checksum How to use checksums |
d6c96fdb74e43e7fc95908783a9c91257ac0083d70a69df1387596314cb55fee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 15, 2024.
Transparency logRelease files / pycosep-0.2.0-py3-none-any.whl
| Download URL | pycosep-0.2.0-py3-none-any.whl |
|---|---|
| Size | 18.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c593a9ef9fe5ba133ac1b7a6050360ca781aa300362b0150fc16259a54c47ac8
|
|
BLAKE2b-256 checksum How to use checksums |
06d0528a59876d9849a26c0073d4a9eee33a134b77cad542ce0fbb59ff388294
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 15, 2024.
Transparency logSecurity for pycosep 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pycosep-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 15, 2024.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.