WWL Package
Installation
To install wwl, run the following:
$ pip install cython numpy
$ pip install wwl
Usage
WWL can be used to compute the pairwise kernel matrix between a list of Graphs.
The kernel function wwl takes as input a list of igraph Graph objects. It can also take their node features (if they are continuously attributed), the number of iterations for the embedding scheme,
the value for gamma in the Laplacian kernel, and a flag for sinkhorn approximations.
from wwl import wwl
# load the graphs
graphs = [ig.read(fname) for fname in graph_filenames]
# load node features for continuous graphs
node_features = np.load(path_to_node_features)
# compute the kernel
kernel_matrix = wwl(graphs, node_features=node_features, num_iterations=4)
# use in SVM
from sklearn.svm import SVC
train_index, test_index = np.load(train_index_path), np.load(test_index_path)
y = np.load(path_to_labels)
K_train = kernel_matrix[train_index][:,train_index]
K_test = kernel_matrix[test_index][:,train_index]
svm = SVC(kernel='precomputed') # For a Krein SVM, please refer to krein.py
svm.fit(K_train)
y_predict = svm.predict(K_test)
Please see utilities.wwl_custom_grid_search_cv for a custom crossvalidation to cross-validate the number of iterations, gammas in the Laplacian kernel, and other parameters for the SVM.
Metadata
Release files for wwl 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wwl-0.1.2.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wwl-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.3 kB
Release files / wwl-0.1.2.tar.gz
| Download URL | wwl-0.1.2.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df2ce1f8d57dee88706c4350ab9ff22d43fb9fe7596f6fafb408a65845a5c3e6
|
|
BLAKE2b-256 checksum How to use checksums |
96c08d0e8c1d5b9c92102173f42d6834c14d20ea3bbf2cb811c8eb4b8710718e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.22.0
|
Release files / wwl-0.1.2-py3-none-any.whl
| Download URL | wwl-0.1.2-py3-none-any.whl |
|---|---|
| Size | 8.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
109dabcb32b7657f8a911bd9b098b7488c0e58031834e0e56a6c89a0b3484925
|
|
BLAKE2b-256 checksum How to use checksums |
74bd11f5a76d34fc739432a4db2cd90ac95caa6e7ee4c0dc4222730c66016d02
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.22.0
|