From d040440081f90dbbb068cead919171f8891f70e1 Mon Sep 17 00:00:00 2001 From: jajupmochi Date: Tue, 23 Jun 2020 10:26:27 +0200 Subject: [PATCH 1/3] Update README.md. --- README.md | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 7cfdecc..2191f22 100644 --- a/README.md +++ b/README.md @@ -22,19 +22,53 @@ A Python package for graph kernels, graph edit distances and graph pre-image pro ## How to use? +### Install the library + +* Install stable version from PyPI (may not be up-to-date): +``` +$ pip install graphkit-learn +``` + +* Install latest version from GitHub: +``` +$ git clone https://github.com/jajupmochi/graphkit-learn.git +$ cd graphkit-learn/ +$ python setup.py install +``` + +### Run the test + +A series of [tests](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/tests) can be run to check if the library works correctly. +``` +$ pip install -U pip pytest codecov coverage pytest-cov +$ pytest -v --cov-config=.coveragerc --cov-report term --cov=gklearn gklearn/tests/ +``` + +### Check examples + +A series of demos of using the library can be found on [Google Colab](https://drive.google.com/drive/folders/1r2gtPuFzIys2_MZw1wXqE2w3oCoVoQUG?usp=sharing) and in the [`example`](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/examples) folder. + +### Other demos + Simply clone this repository and voilà! Then check [`notebooks`](https://github.com/jajupmochi/graphkit-learn/tree/master/notebooks) directory for demos: * [`notebooks`](https://github.com/jajupmochi/graphkit-learn/tree/master/notebooks) directory includes test codes of graph kernels based on linear patterns; * [`notebooks/tests`](https://github.com/jajupmochi/graphkit-learn/tree/master/notebooks/tests) directory includes codes that test some libraries and functions; * [`notebooks/utils`](https://github.com/jajupmochi/graphkit-learn/tree/master/notebooks/utils) directory includes some useful tools, such as a Gram matrix checker and a function to get properties of datasets; * [`notebooks/else`](https://github.com/jajupmochi/graphkit-learn/tree/master/notebooks/else) directory includes other codes that we used for experiments. -## List of graph kernels +### Check the docs. + +The docs of the library can be found [here](https://graphkit-learn.readthedocs.io/en/master/?badge=master). + +## Main contents. + +### List of graph kernels * Based on walks * The common walk kernel [1] * Exponential * Geometric - * The marginalized kenrel + * [The marginalized kenrel](https://github.com/jajupmochi/graphkit-learn/blob/master/gklearn/kernels/marginalized.py) * With tottering [2] * Without tottering [7] * The generalized random walk kernel [3] @@ -43,15 +77,27 @@ Simply clone this repository and voilà! Then check [`notebooks`](https://github * Fixed-point iterations * Spectral decomposition * Based on paths - * The shortest path kernel [4] - * The structural shortest path kernel [5] - * The path kernel up to length h [6] + * [The shortest path kernel](https://github.com/jajupmochi/graphkit-learn/blob/master/gklearn/kernels/shortest_path.py) [4] + * [The structural shortest path kernel](https://github.com/jajupmochi/graphkit-learn/blob/master/gklearn/kernels/structural_sp.py) [5] + * [The path kernel up to length h](https://github.com/jajupmochi/graphkit-learn/blob/master/gklearn/kernels/path_up_to_h.py) [6] * The Tanimoto kernel * The MinMax kernel * Non-linear kernels - * The treelet kernel [10] - * Weisfeiler-Lehman kernel [11] - * Subtree + * [The treelet kernel](https://github.com/jajupmochi/graphkit-learn/blob/master/gklearn/kernels/treelet.py) [10] + * [Weisfeiler-Lehman kernel](https://github.com/jajupmochi/graphkit-learn/blob/master/gklearn/kernels/weisfeiler_lehman.py) [11] + * [Subtree](https://github.com/jajupmochi/graphkit-learn/blob/master/gklearn/kernels/weisfeiler_lehman.py#L479) + +A demo of computing graph kernels can be found on [Google Colab](https://colab.research.google.com/drive/17Q2QCl9CAtDweGF8LiWnWoN2laeJqT0u?usp=sharing) and in the [`examples`](https://github.com/jajupmochi/graphkit-learn/blob/master/gklearn/examples/compute_graph_kernel.py) folder. + +### Graph Edit Distances + +### Graph preimage methods + +A demo of generating graph preimages can be found on [Google Colab](https://colab.research.google.com/drive/1PIDvHOcmiLEQ5Np3bgBDdu0kLOquOMQK?usp=sharing) and in the [`examples`](https://github.com/jajupmochi/graphkit-learn/blob/master/gklearn/examples/median_preimege_generator.py) folder. + +### Interface to `GEDLIB` + +[`GEDLIB`](https://github.com/dbblumenthal/gedlib) is an easily extensible C++ library for (suboptimally) computing the graph edit distance between attributed graphs. A Python interface for `GEDLIB` is integrated in this library, based on [`gedlibpy`](https://github.com/Ryurin/gedlibpy) library. ## Computation optimization methods @@ -81,6 +127,10 @@ Linlin Jia, Benoit Gaüzère, and Paul Honeine. Graph Kernels Based on Linear Pa A comparison of performances of graph kernels on benchmark datasets can be found [here](https://graphkit-learn.readthedocs.io/en/master/experiments.html). +## How to contribute + +Fork the library and open a pull request! Make your own contribute to the community! + ## References [1] Thomas Gärtner, Peter Flach, and Stefan Wrobel. On graph kernels: Hardness results and efficient alternatives. Learning Theory and Kernel Machines, pages 129–143, 2003. From f4d279e7f35e216f159fef3c60185838fbb1975d Mon Sep 17 00:00:00 2001 From: jajupmochi Date: Tue, 23 Jun 2020 10:38:39 +0200 Subject: [PATCH 2/3] Update .travis.yml. --- .travis.yml | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8703d37..08ae7a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,11 @@ language: python + python: - '3.5' - '3.6' - '3.7' - '3.8' + before_install: - python --version - pip install -U pip @@ -16,9 +18,27 @@ install: - pip install -r requirements.txt - pip install wheel -script: -- python setup.py bdist_wheel -- pytest -v --cov-config=.coveragerc --cov-report term --cov=gklearn gklearn/tests/ +jobs: + include: + - python: 3.5 + script: + - python setup.py bdist_wheel + - pytest -v --cov-config=.coveragerc --cov-report term --cov=gklearn gklearn/tests/ --ignore=gklearn/tests/test_median_preimage_generator.py + include: + - python: 3.6 + script: + - python setup.py bdist_wheel + - pytest -v --cov-config=.coveragerc --cov-report term --cov=gklearn gklearn/tests/ + include: + - python: 3.7 + script: + - python setup.py bdist_wheel + - pytest -v --cov-config=.coveragerc --cov-report term --cov=gklearn gklearn/tests/ --ignore=gklearn/tests/test_median_preimage_generator.py + include: + - python: 3.8 + script: + - python setup.py bdist_wheel + - pytest -v --cov-config=.coveragerc --cov-report term --cov=gklearn gklearn/tests/ --ignore=gklearn/tests/test_median_preimage_generator.py after_success: - codecov From d39d0a0aec9261a2e02d58ba671e3d4be21414b8 Mon Sep 17 00:00:00 2001 From: jajupmochi Date: Tue, 23 Jun 2020 10:55:27 +0200 Subject: [PATCH 3/3] Update. --- .travis.yml | 28 +++++++--------------------- README.md | 12 ++++++------ 2 files changed, 13 insertions(+), 27 deletions(-) diff --git a/.travis.yml b/.travis.yml index 08ae7a2..f757ef7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,27 +18,13 @@ install: - pip install -r requirements.txt - pip install wheel -jobs: - include: - - python: 3.5 - script: - - python setup.py bdist_wheel - - pytest -v --cov-config=.coveragerc --cov-report term --cov=gklearn gklearn/tests/ --ignore=gklearn/tests/test_median_preimage_generator.py - include: - - python: 3.6 - script: - - python setup.py bdist_wheel - - pytest -v --cov-config=.coveragerc --cov-report term --cov=gklearn gklearn/tests/ - include: - - python: 3.7 - script: - - python setup.py bdist_wheel - - pytest -v --cov-config=.coveragerc --cov-report term --cov=gklearn gklearn/tests/ --ignore=gklearn/tests/test_median_preimage_generator.py - include: - - python: 3.8 - script: - - python setup.py bdist_wheel - - pytest -v --cov-config=.coveragerc --cov-report term --cov=gklearn gklearn/tests/ --ignore=gklearn/tests/test_median_preimage_generator.py + +script: +- python setup.py bdist_wheel +- if [ $TRAVIS_PYTHON_VERSION == 3.6 ]; + then pytest -v --cov-config=.coveragerc --cov-report term --cov=gklearn gklearn/tests/; + else pytest -v --cov-config=.coveragerc --cov-report term --cov=gklearn gklearn/tests/ --ignore=gklearn/tests/test_median_preimage_generator.py; + fi after_success: - codecov diff --git a/README.md b/README.md index 2191f22..386d9a4 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ $ python setup.py install ### Run the test -A series of [tests](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/tests) can be run to check if the library works correctly. +A series of [tests](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/tests) can be run to check if the library works correctly: ``` $ pip install -U pip pytest codecov coverage pytest-cov $ pytest -v --cov-config=.coveragerc --cov-report term --cov=gklearn gklearn/tests/ @@ -50,17 +50,17 @@ A series of demos of using the library can be found on [Google Colab](https://dr ### Other demos -Simply clone this repository and voilà! Then check [`notebooks`](https://github.com/jajupmochi/graphkit-learn/tree/master/notebooks) directory for demos: +Check [`notebooks`](https://github.com/jajupmochi/graphkit-learn/tree/master/notebooks) directory for more demos: * [`notebooks`](https://github.com/jajupmochi/graphkit-learn/tree/master/notebooks) directory includes test codes of graph kernels based on linear patterns; * [`notebooks/tests`](https://github.com/jajupmochi/graphkit-learn/tree/master/notebooks/tests) directory includes codes that test some libraries and functions; * [`notebooks/utils`](https://github.com/jajupmochi/graphkit-learn/tree/master/notebooks/utils) directory includes some useful tools, such as a Gram matrix checker and a function to get properties of datasets; * [`notebooks/else`](https://github.com/jajupmochi/graphkit-learn/tree/master/notebooks/else) directory includes other codes that we used for experiments. -### Check the docs. +### Documentation The docs of the library can be found [here](https://graphkit-learn.readthedocs.io/en/master/?badge=master). -## Main contents. +## Main contents ### List of graph kernels @@ -97,9 +97,9 @@ A demo of generating graph preimages can be found on [Google Colab](https://cola ### Interface to `GEDLIB` -[`GEDLIB`](https://github.com/dbblumenthal/gedlib) is an easily extensible C++ library for (suboptimally) computing the graph edit distance between attributed graphs. A Python interface for `GEDLIB` is integrated in this library, based on [`gedlibpy`](https://github.com/Ryurin/gedlibpy) library. +[`GEDLIB`](https://github.com/dbblumenthal/gedlib) is an easily extensible C++ library for (suboptimally) computing the graph edit distance between attributed graphs. [A Python interface](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/gedlib) for `GEDLIB` is integrated in this library, based on [`gedlibpy`](https://github.com/Ryurin/gedlibpy) library. -## Computation optimization methods +### Computation optimization methods * Python’s `multiprocessing.Pool` module is applied to perform **parallelization** on the computations of all kernels as well as the model selection. * **The Fast Computation of Shortest Path Kernel (FCSP) method** [8] is implemented in *the random walk kernel*, *the shortest path kernel*, as well as *the structural shortest path kernel* where FCSP is applied on both vertex and edge kernels.