Travelling Salesman Path - Python wrapper
Project description
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.
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
File details
Details for the file pycosep-0.1.1.tar.gz
.
File metadata
- Download URL: pycosep-0.1.1.tar.gz
- Upload date:
- Size: 23.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9b267e9b1a6d4c991d636e4dc8c71c5f5636603610c2accc3e788cbdd6c88cd |
|
MD5 | 5f5fd7a5e482fe4e085a7918605afd2a |
|
BLAKE2b-256 | bc4f812bdaefab1238654ee211f901641208937acea2f4e2bc8ad967a30bd652 |
Provenance
The following attestation bundles were made for pycosep-0.1.1.tar.gz
:
Publisher:
publish.yaml
on aacevedot/pycosep
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pycosep-0.1.1.tar.gz
- Subject digest:
f9b267e9b1a6d4c991d636e4dc8c71c5f5636603610c2accc3e788cbdd6c88cd
- Sigstore transparency entry: 147948393
- Sigstore integration time:
- Predicate type:
File details
Details for the file pycosep-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pycosep-0.1.1-py3-none-any.whl
- Upload date:
- Size: 19.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0e4d61a8fdbbd9a16abc1c7f1027027bc7844218c258e594fbe09c9dec74756 |
|
MD5 | 21b22a9960b0bd7e89360467d1042961 |
|
BLAKE2b-256 | eb3fbd6e6115e830775e16ed8830fbbdf49abd26ded477ed7f32510077e76ad5 |
Provenance
The following attestation bundles were made for pycosep-0.1.1-py3-none-any.whl
:
Publisher:
publish.yaml
on aacevedot/pycosep
-
Statement type:
https://in-toto.io/Statement/v1
- Predicate type:
https://docs.pypi.org/attestations/publish/v1
- Subject name:
pycosep-0.1.1-py3-none-any.whl
- Subject digest:
d0e4d61a8fdbbd9a16abc1c7f1027027bc7844218c258e594fbe09c9dec74756
- Sigstore transparency entry: 147948394
- Sigstore integration time:
- Predicate type: