https://github.com/morteza/weighted-metapath2vec
Weighted Metapath2Vec Graph Embedding
https://github.com/morteza/weighted-metapath2vec
graph-embedding machine-learning random-walk
Last synced: 11 months ago
JSON representation
Weighted Metapath2Vec Graph Embedding
- Host: GitHub
- URL: https://github.com/morteza/weighted-metapath2vec
- Owner: morteza
- License: mit
- Created: 2022-05-01T10:03:26.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-08T21:07:19.000Z (over 3 years ago)
- Last Synced: 2025-04-03T18:07:39.325Z (about 1 year ago)
- Topics: graph-embedding, machine-learning, random-walk
- Language: Python
- Homepage:
- Size: 38.1 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Citation: CITATION.CFF
Awesome Lists containing this project
README
# Weighted-Metapath2Vec
**Weighted-Metapath2Vec** is a Python package for embedding heterogeneous graphs.
It uses a weighted variant of [metapath2vec](https://ericdongyx.github.io/metapath2vec/m2v.html) to compute the node embeddings.
The embeddings can be used for downstream machine learning.
**The package is a work-in-progress**. There are bugs, and example notebooks are missing. If you want to use this package, expect to make changes.
[](https://github.com/pre-commit/pre-commit)
## Installation
```bash
pip install weighted-metapath2vec
```
## Usage
```python
from weighted_metapath2vec import WeightedMetapath2VecModel
G = ... # Load a networkx graph as G
metapaths = [
['Article', 'Author', 'Article'],
['Author', 'Article', 'Author']
]
model = WeightedMetapath2VecModel(G,
metapaths,
walk_length=3,
n_walks_per_node=20,
embedding_dim=128)
node_embeddings = model.fit_transform()
... # downstream task
```
## Contributing
Use GitHub to fork and submit pull requests.
## Citation
Please cite this code as follows (BibTeX):
```bibtex
@software{Weighted_Metapath2Vec,
author = {Ansarinia, Morteza and Cardoso-Leite, Pedro},
doi = {10.5281/zenodo.7096229},
month = {6},
title = {{Weighted Metapath2Vec Graph Embedding}},
url = {https://github.com/morteza/weighted-metapath2vec},
version = {v0.1.4},
year = {2022}
}
```
## Acknowledgements
This project is supported by the Luxembourg National Research Fund (ATTRACT/2016/ID/11242114/DIGILEARN and INTER Mobility/2017-2/ID/11765868/ULALA).
## License
MIT License. See the [LICENSE](LICENSE) file.