cepy
Implementation of the connectome embedding (CE) framework.
Embedding of brain graph or connectome embedding (CE) involves finding a compact vectorized representation of nodes that captures their higher-order topological attributes. CE are obtained using the node2vec algorithm fitted on random walk on a brain graph. The current framework includes a novel approach to align separately learned embeddings to the same latent space. Cepy is tested on Python 3.6, 3.7 and 3.8.
- Documentation: https://cepy.readthedocs.io/en/latest/
Installation
pip install cepy
Usage
import cepy as ce
import numpy as np
# Load an adjacency matrix (structural connectivity matrix)
sc_group = ce.get_example('sc_group_matrix')
# Initiate and fit the connectome embedding model
ce_group = ce.CE(permutations = 1, seed=1)
ce_group.fit(sc_group)
# Extract the cosine similarity matrix among all pairwise nodes
cosine_sim = ce_group.similarity()
# Save and load the model
ce_group.save_model('group_ce.json')
ce_loaded = ce.load_model('group_ce.json') # load it
# Load two existing CE models
ce_subject1 = ce.get_example('ce_subject1')
ce_subject2 = ce.get_example('ce_subject2')
# Align the two to the space of the [ce_group]:
ce_subject1_aligned = ce.align(ce_group, ce_subject1)
ce_subject2_aligned = ce.align(ce_group, ce_subject2)
# Extract the node vectorized representations (normalized) for subsequent use - prediction, for example
w_sbject1 = ce_subject1_aligned.weights.get_w_mean(norm = True)
w_sbject2 = ce_subject2_aligned.weights.get_w_mean(norm = True)
A set of example interactive Jupyter notebooks are also available here.
Citing
If you find cepy useful for your research, please consider citing the following paper:
Levakov, G., Faskowitz, J., Avidan, G. & Sporns, O. (2021). Mapping structure to function
and behavior with individual-level connectome embedding. bioRxiv. doi: https://doi.org/10.1101/2021.01.13.426513
Contributing
Cepy is an open-source software project, and we welcome contributions from anyone. We suggest raising an issue prior to working on a new feature.
Reference
- The node2vec implementation is modeified from the node2vec package by Elior Cohen and the connectome_embedding code by Gideon Rosenthal.
- Rosenthal, G., Váša, F., Griffa, A., Hagmann, P., Amico, E., Goñi, J., ... & Sporns, O. (2018). Mapping higher-order relations between brain structure and function with embedded vector representations of connectomes. Nature communications, 9(1), 1-12. ;
Metadata
Release files for cepy 1.0.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 |
|---|---|---|---|---|
| cepy-1.0.0.tar.gz | 2.7 MB | Without provenance | Details for cepy-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cepy-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for cepy-1.0.0-py3-none-any.whl |
Total release size: 5.5 MB
Release files / cepy-1.0.0.tar.gz
| Download URL | cepy-1.0.0.tar.gz |
|---|---|
| Size | 2.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c600659ea341551792d3fcc3c5d1217b3575b87b2a7f218ef861559286262891
|
|
BLAKE2b-256 checksum How to use checksums |
52f87d9d63163c079ef805a7d116b9419c02f47c80774de30f1a81aad8931f8c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.7.7
|
Release files / cepy-1.0.0-py3-none-any.whl
| Download URL | cepy-1.0.0-py3-none-any.whl |
|---|---|
| Size | 2.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c6ac41ad94cf48e6a8758d63a7e46ba5ccec1344e1f26ef15802828eaa9183f
|
|
BLAKE2b-256 checksum How to use checksums |
090b8612a620ead532d703109146ed68a3c57fd6ff81b35f9ae0a1ec6ffd547e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.0.post20200714 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.7.7
|
Security for cepy 1.0.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.