grakel
.GraphletSampling¶
- class grakel.GraphletSampling(n_jobs=None, normalize=False, verbose=False, random_state=None, k=5, sampling=None)[source][source]¶
The graphlet sampling kernel.
See [SPM+09].
If either “delta”, “epsilon”, “a” or “n_samples” is given calculates the kernel value for the given (or derived) random picked n_samples, by randomly sampling from k from 3 to 5. Otherwise calculates the kernel value drawing all possible connected samples of size k.
- Parameters
- random_stateRandomState or int, default=None
A random number generator instance or an int to initialize a RandomState as a seed.
- kint, default=5
The dimension of the given graphlets.
- samplingNone or dict
Defines if random sampling of graphlets will be utilised. If not None the dictionary can either contain:
- n_samplesint
Sets the value of randomly drawn random samples, from sizes between 3..k. Overides the parameters a, epsilon, delta.
or
delta : float, default=0.05 Confidence level (typically 0.05 or 0.1). For calculation of the number of samples achieving the certain bound. n_samples argument must not be provided and for initialising the default value either “epsilon” or “a” must be set.
- epsilonfloat, default=0.05
Precision level (typically 0.05 or 0.1). For calculation of the number of samples achieving the certain bound. n_samples argument must not be provided and for initialising the default value either “delta” or “a” must be set.
- aint
Number of isomorphism classes of graphlets. If -1 the number is the maximum possible, from a database 1 until 9 or else predicted through interpolation. For calculation of the number of samples achieving the certain bound. n_samples argument must not be provided and for initializing the default value either “delta” or “epsilon” must be set.
- Attributes
- Xdict
A dictionary of pairs between each input graph and a bins where the sampled graphlets have fallen.
- sample_graphlets_function
A function taking as input a binary adjacency matrix, parametrised to work for the certain samples, k and deterministic/propabilistic mode.
- random_state_RandomState
A RandomState object handling all randomness of the class.
- _graph_binsdict
A dictionary of graph bins holding pynauty objects
- _nxint
Holds the number of sampled X graphs.
- _nyint
Holds the number of sampled Y graphs.
- _X_diagnp.array, shape=(_nx, 1)
Holds the diagonal of X kernel matrix in a numpy array, if calculated (fit_transform).
- _phi_Xnp.array, shape=(_nx, len(_graph_bins))
Holds the features of X in a numpy array, if calculated. (fit_transform).
Methods
diagonal
()Calculate the kernel matrix diagonal for fitted data.
fit
(X[, y])Fit a dataset, for a transformer.
fit_transform
(X)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 and create features for graphlet_sampling kernel.
set_params
(**params)Call the parent method.
transform
(X)Calculate the kernel matrix, between given and fitted dataset.
Initialise a subtree_wl 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)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 and create features for graphlet_sampling kernel.
set_params
(**params)Call the parent method.
transform
(X)Calculate the kernel matrix, between given and fitted dataset.