grakel.NeighborhoodHash#

class grakel.NeighborhoodHash(n_jobs=None, normalize=False, verbose=False, random_state=None, R=3, nh_type='simple', bits=8)[source][source]#

Neighborhood hashing kernel as proposed in [HK09].

Parameters:
Rint, default=3

The maximum number of neighborhood hash.

nh_typestr, valid_types={“simple”, “count_sensitive”}, default=”simple”

The existing neighborhood hash type as defined in [HK09].

bytesint, default=2

Byte size of hashes.

random_stateRandomState or int, default=None

A random number generator instance or an int to initialize a RandomState as a seed.

Attributes:
NH_function

The neighborhood hashing function.

random_state_RandomState

A RandomState object handling all randomness of the class.

Methods

ROT(n, d)

rot operation for binary numbers.

diagonal()

Calculate the kernel matrix diagonal of the fit/transfromed data.

fit(X[, y])

Fit a dataset, for a transformer.

fit_transform(X[, y])

Fit and transform, on the same dataset.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

initialize()

Initialize all transformer arguments, needing initialization.

neighborhood_hash_count_sensitive(G)

Count sensitive neighborhood hash as defined in [HK09].

neighborhood_hash_simple(G)

(simple) neighborhood hashing as defined in [HK09].

pairwise_operation(x, y)

Calculate a pairwise kernel between two elements.

parse_input(X)

Parse the given input and raise errors if it is invalid.

radix_sort_rot(labels)

Sorts vertices based on labels.

set_output(*[, transform])

Set output container.

set_params(**params)

Call the parent method.

transform(X)

Calculate the kernel matrix, between given and fitted dataset.

Initialize a neighborhood_hash kernel.

Attributes:
X

Methods

ROT(n, d)

rot operation for binary numbers.

diagonal()

Calculate the kernel matrix diagonal of the fit/transfromed data.

fit(X[, y])

Fit a dataset, for a transformer.

fit_transform(X[, y])

Fit and transform, on the same dataset.

get_metadata_routing()

Get metadata routing of this object.

get_params([deep])

Get parameters for this estimator.

initialize()

Initialize all transformer arguments, needing initialization.

neighborhood_hash_count_sensitive(G)

Count sensitive neighborhood hash as defined in [HK09].

neighborhood_hash_simple(G)

(simple) neighborhood hashing as defined in [HK09].

pairwise_operation(x, y)

Calculate a pairwise kernel between two elements.

parse_input(X)

Parse the given input and raise errors if it is invalid.

radix_sort_rot(labels)

Sorts vertices based on labels.

set_output(*[, transform])

Set output container.

set_params(**params)

Call the parent method.

transform(X)

Calculate the kernel matrix, between given and fitted dataset.

__init__(n_jobs=None, normalize=False, verbose=False, random_state=None, R=3, nh_type='simple', bits=8)[source][source]#

Initialize a neighborhood_hash kernel.

Bibliography#

[HK09] (1,2,3,4,5,6,7,8,9,10)

Shohei Hido and Hisashi Kashima. A Linear-time Graph Kernel. In Proceedings of the 9th International Conference on Data Mining, 179–188. 2009.