fastwlk is a Python package that implements a fast version of the Weisfeiler-Lehman kernel.
Project description
What does fastwlk do?
fastwlk is a Python package that implements a fast version of the Weisfeiler-Lehman kernel. It manages to outperform current state-of-the-art implementations on sparse graphs by implementing a number of improvements compared to vanilla implementations:
It parallelizes the execution of Weisfeiler-Lehman hash computations since each graph’s hash can be computed independently prior to computing the kernel.
It parallelizes the computation of similarity of graphs in RKHS by computing batches of the inner products independently.
On sparse graphs, lots of computations are spent processing positions/hashes that do not actually overlap between graph representations. As such, we manually loop over the overlapping keys, outperforming numpy dot product-based implementations.
This implementation works best when graphs have relatively few connections and are reasonably dissimilar from one another. If you are not sure the graphs you are using are either sparse or dissimilar enough, try to benchmark this package with others out there.
How fast is fastwlk?
Running the benchmark script in examples/benchmark.py shows that for the graphs in data/graphs.pkl, we get an approximately 80% speed improvement over other implementations like grakel.
To see how much faster this implementation is for your use case:
$ git clone git://github.com/pjhartout/fastwlk
$ poetry install
$ poetry run python examples/benchmark.py
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
Hashes for fastwlk-0.2.0.dev0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1d2b327b5007efddab3f09196fafa68b8b6eca86e3acbb224e4a70232d5a4e5 |
|
MD5 | 99dcb0ddb679d6f3c15f530e1f5c6a31 |
|
BLAKE2b-256 | 9d66350f91b20dd962485ceaa339fad5130d8c0d78a179ea7efd85152f223c58 |