residual2vec: debiasing graph embedding with random graphs
Project description
Python package for residual2vec graph embedding algorithm
residual2vec is an algorithm to embed networks to a vector space while controlling for various structural properties such as degree. If you use this package, please cite:
-
S. Kojaku, J. Yoon, I. Constantino, and Y.-Y. Ahn, Residual2Vec: Debiasing graph embedding using random graphs. NerurIPS (2021). [link will be added when available]
-
Preprint (arXiv): [link to arXiv]
-
BibTex entry:
@inproceedings{kojaku2021neurips,
title={Residual2Vec: Debiasing graph embedding using random graphs},
author={Sadamori Kojaku and Jisung Yoon and Isabel Constantino and Yong-Yeol Ahn},
booktitle = {Advances in Neural Information Processing Systems},
editor = {},
pages = {},
publisher = {Curran Associates, Inc.},
volume = {},
year = {2021}
}
Install
pip install residual2vec
Requirements
This code is tested in Python 3.7 and 3.8, and has dependencies with the following packages:
- numpy==1.20.3
- scipy==1.7.1
- scikit-learn==1.0
- faiss-cpu==1.7.0
Example
import residual2vec as rv
model = rv.residual2vec(window_length = 10, group_membership = None)
model.fit(G)
emb = model.transform(dim = 64)
# or equivalently emb = model.fit(G).transform(dim = 64)
G
: adjacency matrix of the input graph. numpy.array or scipy.sparse.csr_matrix can be accepted.window_length
: the length of context window.group_membership
: an array of node labels. Used to debias the structural bias correlated with the node labels.dim
: Dimension of the embeddingemb
: 2D numpy array of shape (N
,dim
), whereN
is the number of nodes. Thei
th row in the array (i.e.,emb[i, :]
) represents the embedding vector of thei
th node in the given adjacency matrixG
.
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 residual2vec-0.0.2.tar.gz
.
File metadata
- Download URL: residual2vec-0.0.2.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f72b71f60b0fcb0d2adc5dbca1c8f8083063c4fcaf541533e8396a39ee626f26 |
|
MD5 | 433c9be52cd5921046e760b35ca43777 |
|
BLAKE2b-256 | 10761754f64ebb8b00a6308ee304896a03981a1508b27977479859602f4f03c2 |
File details
Details for the file residual2vec-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: residual2vec-0.0.2-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03f0068283f73b9f905fe19af75e51efa522636447fd72e549d707042daff0c7 |
|
MD5 | 3bb7a93e7c23fa6cb98349f97f943afd |
|
BLAKE2b-256 | 73f831728eb875018ae9435f0e150693095e85de891cd9b4160bf31e72213446 |