Skip to main content

A weighted alternative to metapath2vec for heterogenous graph embedding

Project description

Weighted-Metapath2Vec

Weighted-Metapath2Vec is a Python package to embed heterogeneous graphs. The algorithm uses a weighted alternative to Metapath2vec to compute the embeddings. The embeddings can be used for downstream machine learning.

pre-commit

Installation

pip install weighted-metapath2vec

Usage

from weighted_metapath2vec import WeightedMetapath2VecModel

...  # 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.

License

MIT License. See the LICENSE file.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

weighted-metapath2vec-0.1.4.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

weighted_metapath2vec-0.1.4-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file weighted-metapath2vec-0.1.4.tar.gz.

File metadata

  • Download URL: weighted-metapath2vec-0.1.4.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Darwin/21.5.0

File hashes

Hashes for weighted-metapath2vec-0.1.4.tar.gz
Algorithm Hash digest
SHA256 b0a59acf3f1b25e1002e580ab56ba3fd42d0a859a43f2459cd423d0b674cc6c8
MD5 ba679d5c7d3f2a32ee621999e0e2e4e4
BLAKE2b-256 a57a2c8f44fa882f92366fcfe542c06fff0164207f9039ea17f90aa4fc3413e8

See more details on using hashes here.

File details

Details for the file weighted_metapath2vec-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for weighted_metapath2vec-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 079410485211ac9687e964b199915d5bf390ed1870be5b93b385178c1d176830
MD5 3c211409792fbae36d943db2eaa0736b
BLAKE2b-256 2b4cfb6c63dabf5e04bda0e931d2175a3903a9245f3a106da19b28ee4622f25b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page