# graphkit-learn
![GitHub Actions](https://github.com/jajupmochi/graphkit-learn/actions/workflows/github-actions.yml/badge.svg)
[![Build status](https://ci.appveyor.com/api/projects/status/bdxsolk0t1uji9rd?svg=true)](https://ci.appveyor.com/project/jajupmochi/graphkit-learn)
[![codecov](https://codecov.io/gh/jajupmochi/graphkit-learn/branch/master/graph/badge.svg)](https://codecov.io/gh/jajupmochi/graphkit-learn)
[![Documentation Status](https://readthedocs.org/projects/graphkit-learn/badge/?version=master)](https://graphkit-learn.readthedocs.io/en/master/?badge=master)
[![PyPI version](https://badge.fury.io/py/graphkit-learn.svg)](https://badge.fury.io/py/graphkit-learn)
[![Join the chat at https://gitter.im/graphkit-learn/graphkit-learn](https://badges.gitter.im/graphkit-learn/graphkit-learn.svg)](https://gitter.im/graphkit-learn/graphkit-learn?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
A Python package for graph kernels, graph edit distances and graph pre-image problem.
## Requirements
* python>=3.6
* numpy>=1.16.2
* scipy>=1.1.0
* matplotlib>=3.1.0
* networkx>=2.2
* scikit-learn>=0.20.0
* tabulate>=0.8.2
* tqdm>=4.26.0
* control>=0.8.2 (for generalized random walk kernels only)
* slycot>=0.3.3 (for generalized random walk kernels only, which requires a fortran compiler (e.g., `gfortran`) and BLAS/LAPACK (e.g. `liblapack-dev`))
## 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
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.
### Documentation
The docs of the library can be found [here](https://graphkit-learn.readthedocs.io/en/master/?badge=master).
## Main contents
### 1 List of graph kernels
* Based on walks
* [The common walk kernel](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/kernels/common_walk.py) [1]
* Exponential
* Geometric
* [The marginalized kernel](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/kernels/marginalized.py)
* With tottering [2]
* Without tottering [7]
* [The generalized random walk kernel](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/kernels/random_walk.py) [3]
* [Sylvester equation](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/kernels/sylvester_equation.py)
* Conjugate gradient
* Fixed-point iterations
* [Spectral decomposition](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/kernels/spectral_decomposition.py)
* Based on paths
* [The shortest path kernel](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/kernels/shortest_path.py) [4]
* [The structural shortest path kernel](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/kernels/structural_sp.py) [5]
* [The path kernel up to length h](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/kernels/path_up_to_h.py) [6]
* The Tanimoto kernel
* The MinMax kernel
* Non-linear kernels
* [The treelet kernel](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/kernels/treelet.py) [10]
* [Weisfeiler-Lehman kernel](https://github.com/jajupmochi/graphkit-learn/tree/master/gklearn/kernels/weisfeiler_lehman.py) [11]
* [Subtree](https://github.com/jajupmochi/graphkit-learn/tree/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.
### 2 Graph Edit Distances
### 3 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.
### 4 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](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.
### 5 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.
* **The trie data structure** [9] is employed in *the path kernel up to length h* to store paths in graphs.
## Issues
* This library uses `multiprocessing.Pool.imap_unordered` function to do the parallelization, which may not be able to run correctly under Windows system. For now, Windows users may need to comment the parallel codes and uncomment the codes below them which run serially. We will consider adding a parameter to control serial or parallel computations as needed.
* Some modules (such as `Numpy`, `Scipy`, `sklearn`) apply [`OpenBLAS`](https://www.openblas.net/) to perform parallel computation by default, which causes conflicts with other parallelization modules such as `multiprossing.Pool`, highly increasing the computing time. By setting its thread to 1, `OpenBLAS` is forced to use a single thread/CPU, thus avoids the conflicts. For now, this procedure has to be done manually. Under Linux, type this command in terminal before running the code:
```
$ export OPENBLAS_NUM_THREADS=1
```
Or add `export OPENBLAS_NUM_THREADS=1` at the end of your `~/.bashrc` file, then run
```
$ source ~/.bashrc
```
to make this effective permanently.
## Results
Check this paper for detailed description of graph kernels and experimental results:
Linlin Jia, Benoit Gaüzère, and Paul Honeine. Graph Kernels Based on Linear Patterns: Theoretical and Experimental Comparisons. working paper or preprint, March 2019. URL https://hal-normandie-univ.archives-ouvertes.fr/hal-02053946.
A comparison of performances of graph kernels on benchmark datasets can be found [here](https://graphkit-learn.readthedocs.io/en/m
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
机器学习 机器学习使计算机能够从研究数据和统计信息中学习。 机器学习是迈向人工智能(AI)方向的其中一步。 机器学习是一种程序,可以分析数据并学习预测结果。 从何处开始? 在本教程中,我们将回到数学并研究统计学,以及如何根据数据集计算重要数值。 我们还将学习如何使用各种 Python 模块来获得所需的答案。 并且,我们将学习如何根据所学知识编写能够预测结果的函数。 数据集 在计算机中,数据集指的是任何数据集合。它可以是从数组到完整数据库的任何内容。 通过查看数据库,我们可以看到最受欢迎的颜色是白色,最老的车龄是 17 年,但是如果仅通过查看其他值就可以预测汽车是否具有 AutoPass,该怎么办? 这就是机器学习的目的!分析数据并预测结果! 在机器学习中,通常使用非常大的数据集。在本教程中,我们会尝试让您尽可能容易地理解机器学习的不同概念,并将使用一些易于理解的小型数据集。 数据类型 如需分析数据,了解我们要处理的数据类型非常重要。 我们可以将数据类型分为三种主要类别: 数值(Numerical) 分类(Categorical) 序数(Ordinal) 数值数据是数字,可以分为两种数值
资源推荐
资源详情
资源评论
收起资源包目录
Python 图机器学习算法库.zip (2002个子文件)
01b94b364c85119b98139785721bbf13be9c2ca1 0B
01b94b364c85119b98139785721bbf13be9c2ca1 0B
043d832fc06e4ec53967af316a21f121e664773c 0B
043d832fc06e4ec53967af316a21f121e664773c 0B
0529318615168dd6102a3502a932ba4a813a0c50 0B
0529318615168dd6102a3502a932ba4a813a0c50 0B
05915e3a585e9e5a5aae5dd7a6d1a51975ae273f 1KB
05915e3a585e9e5a5aae5dd7a6d1a51975ae273f 0B
060dc0608a9bce3d368c892cb4ea3bc972629c6b 0B
060dc0608a9bce3d368c892cb4ea3bc972629c6b 0B
06aadc0b7579d9bbff1dd4a5390450f80d7a37b8 227B
06aadc0b7579d9bbff1dd4a5390450f80d7a37b8 0B
0a7dfaa4532d6e51983a69680821672be0d83174 0B
0a7dfaa4532d6e51983a69680821672be0d83174 0B
0aa36dd3888601b15ef73b970692ae7db93a2f8f 3KB
0aa36dd3888601b15ef73b970692ae7db93a2f8f 0B
0f2375f1b4d10845307ed1f42939a6f2a43c3215 0B
0f2375f1b4d10845307ed1f42939a6f2a43c3215 0B
13c6cdf4f9cc25683780a2fc99baabe516cba62c 0B
13c6cdf4f9cc25683780a2fc99baabe516cba62c 0B
179411feaa380d24c4035eb1222de86db56379d3 0B
179411feaa380d24c4035eb1222de86db56379d3 0B
18dbfca2c6fa039d73391bd3e49dd1651e9066a9 0B
18dbfca2c6fa039d73391bd3e49dd1651e9066a9 0B
1d5a8bee7114cbb604f132a1c5834c6ba0031053 0B
1d5a8bee7114cbb604f132a1c5834c6ba0031053 0B
1ea8e1f20e3805d04076e75a3f752b5e9902fed3 0B
1ea8e1f20e3805d04076e75a3f752b5e9902fed3 0B
1fcfed8fc62ee1400a5f1866aa8afc2ff52b5251 1KB
1fcfed8fc62ee1400a5f1866aa8afc2ff52b5251 0B
21df9f8a402700ffaf847f6ec20ef2d64748dfdd 0B
21df9f8a402700ffaf847f6ec20ef2d64748dfdd 0B
24671dbee28ce774a56941240eed55e488e4bc76 0B
24671dbee28ce774a56941240eed55e488e4bc76 0B
26324932e1aa5ee0e91c0f932affcea5f9905e1c 0B
26324932e1aa5ee0e91c0f932affcea5f9905e1c 0B
2665e957c48fba652d4edd5dd26871601375b7c8 0B
2665e957c48fba652d4edd5dd26871601375b7c8 0B
26fb5e3132db5789cda694cec8292bbeff675058 0B
26fb5e3132db5789cda694cec8292bbeff675058 0B
29a2fc76743fd26a7142bb53490016d7e70163b1 3KB
29a2fc76743fd26a7142bb53490016d7e70163b1 0B
2bfd584ceefc524481a8c53f9ef51f8a98664cae 0B
2bfd584ceefc524481a8c53f9ef51f8a98664cae 0B
2c5073c839a01c60a156dadbfeaa781b48f896b9 0B
2c5073c839a01c60a156dadbfeaa781b48f896b9 0B
2ca791a2f24e42a15cac20e0c7163be6f9dc900f 0B
2ca791a2f24e42a15cac20e0c7163be6f9dc900f 0B
34c2bb1a36247a2f5aa6afd8e7291816aba2d5f8 0B
34c2bb1a36247a2f5aa6afd8e7291816aba2d5f8 0B
3836ed96c28f296c6d050109c121b98f1fd3ad91 97B
3836ed96c28f296c6d050109c121b98f1fd3ad91 0B
39f44bdcafa64ebef22fa65a084bfe4f4317cf93 0B
39f44bdcafa64ebef22fa65a084bfe4f4317cf93 0B
3a5a943aeed9ed192649c7ec6b295c63d8007e78 0B
3a5a943aeed9ed192649c7ec6b295c63d8007e78 0B
3fc3aa98d9d0672b8100d6da2683ed997d1ca739 0B
3fc3aa98d9d0672b8100d6da2683ed997d1ca739 0B
497177dbb2f999b9497bb2477e29854b53df87c2 0B
497177dbb2f999b9497bb2477e29854b53df87c2 0B
4b702098a401fe45afea244c1caca0768741bdcc 2KB
4b702098a401fe45afea244c1caca0768741bdcc 0B
4df2885441d3fd3625817c3a8a4e6b6ee196bd67 0B
4df2885441d3fd3625817c3a8a4e6b6ee196bd67 0B
597709853ff57fcbba7a2607ce6c878fb82b6124 0B
597709853ff57fcbba7a2607ce6c878fb82b6124 0B
5af625c95c6f9bf7a79681e1f8e3a92069600e54 0B
5af625c95c6f9bf7a79681e1f8e3a92069600e54 0B
5f78298c3afe92b1da5ef447770fa9ba46dd25e4 0B
5f78298c3afe92b1da5ef447770fa9ba46dd25e4 0B
65b3c7d735a52b89f94818e4f1a804520dfefbde 0B
65b3c7d735a52b89f94818e4f1a804520dfefbde 0B
68ab39f7a917945ead43148a14f94a1b5553036f 556B
68ab39f7a917945ead43148a14f94a1b5553036f 0B
6992cfead3ff137ae8655009c6e739f4428a4218 0B
6992cfead3ff137ae8655009c6e739f4428a4218 0B
6a8f893b9bd2a9cc6dcf6ed5ad58c14c40695276 0B
6a8f893b9bd2a9cc6dcf6ed5ad58c14c40695276 0B
6c1d30301377c00fbb7e01f900be0522b9d6e608 0B
6c1d30301377c00fbb7e01f900be0522b9d6e608 0B
6e0172b4ebe5b2f63bcc1d7986336a15fe6c34da 0B
6e0172b4ebe5b2f63bcc1d7986336a15fe6c34da 0B
6eea4893c5c81441cedee0b66f947f1dab8a0803 0B
6eea4893c5c81441cedee0b66f947f1dab8a0803 0B
6f70a49441bc6b1ca0f25bfd7b4b2967aeee84bc 0B
6f70a49441bc6b1ca0f25bfd7b4b2967aeee84bc 0B
6ff43eee7d2f13a780d4c8ef7d59b88e2c7eb530 0B
6ff43eee7d2f13a780d4c8ef7d59b88e2c7eb530 0B
752527b9d3386556856a276e81c193ee7b001e7c 0B
752527b9d3386556856a276e81c193ee7b001e7c 0B
7709599cfd506bc95162963fbf7ce7964ca88dc3 0B
7709599cfd506bc95162963fbf7ce7964ca88dc3 0B
79830bcc05934d937eb9fc5de0ba7d313ac9ec91 0B
79830bcc05934d937eb9fc5de0ba7d313ac9ec91 0B
82e2574f762883e3d50db5eed77cd26c896589f0 0B
82e2574f762883e3d50db5eed77cd26c896589f0 0B
83c34b721dac5696bdb2caffbb78e541767ddc34 0B
83c34b721dac5696bdb2caffbb78e541767ddc34 0B
8857c6c83e02f88ac335d86f03a25e46c87af9e2 0B
8857c6c83e02f88ac335d86f03a25e46c87af9e2 0B
共 2002 条
- 1
- 2
- 3
- 4
- 5
- 6
- 21
资源评论
野生的狒狒
- 粉丝: 2471
- 资源: 2142
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功