grakel.WeisfeilerLehman

class grakel.WeisfeilerLehman(n_jobs=None, verbose=False, normalize=False, n_iter=5, base_graph_kernel=<class 'grakel.kernels.vertex_histogram.VertexHistogram'>)[source][source]

Compute the Weisfeiler Lehman Kernel.

See [SSVL+11].

Parameters
n_iterint, default=5

The number of iterations.

base_graph_kernelgrakel.kernels.Kernel or tuple, default=None

If tuple it must consist of a valid kernel object and a dictionary of parameters. General parameters concerning normalization, concurrency, .. will be ignored, and the ones of given on __init__ will be passed in case it is needed. Default base_graph_kernel is VertexHistogram.

Attributes
Xdict

Holds a dictionary of fitted subkernel modules for all levels.

_nxnumber

Holds the number of inputs.

_n_iterint

Holds the number, of iterations.

_base_graph_kernelfunction

A void function that initializes a base kernel object.

_inv_labelsdict

An inverse dictionary, used for relabeling on each iteration.

Methods

diagonal()

Calculate the kernel matrix diagonal for fitted data.

fit(X[, y])

Fit a dataset, for a transformer.

fit_transform(X[, y])

Fit and transform, on the same dataset.

get_params([deep])

Get parameters for this estimator.

initialize()

Initialize all transformer arguments, needing initialization.

pairwise_operation(x, y)

Calculate a pairwise kernel between two elements.

parse_input(X)

Parse input for weisfeiler lehman.

set_params(**params)

Call the parent method.

transform(X)

Calculate the kernel matrix, between given and fitted dataset.

Initialise a weisfeiler_lehman kernel.

Attributes
X

Methods

diagonal()

Calculate the kernel matrix diagonal for fitted data.

fit(X[, y])

Fit a dataset, for a transformer.

fit_transform(X[, y])

Fit and transform, on the same dataset.

get_params([deep])

Get parameters for this estimator.

initialize()

Initialize all transformer arguments, needing initialization.

pairwise_operation(x, y)

Calculate a pairwise kernel between two elements.

parse_input(X)

Parse input for weisfeiler lehman.

set_params(**params)

Call the parent method.

transform(X)

Calculate the kernel matrix, between given and fitted dataset.

__init__(n_jobs=None, verbose=False, normalize=False, n_iter=5, base_graph_kernel=<class 'grakel.kernels.vertex_histogram.VertexHistogram'>)[source][source]

Initialise a weisfeiler_lehman kernel.

Bibliography

SSVL+11

Nino Shervashidze, Pascal Schweitzer, Erik Jan van Van Leeuwen, Kurt Mehlhorn, and Karsten M. Borgwardt. Weisfeiler-Lehman Graph Kernels. Journal of Machine Learning Research, 12:2539–2561, 2011.