Transforms
AdjToSpTensor
spektral.transforms.adj_to_sp_tensor.AdjToSpTensor()
Converts the adjacency matrix to a SparseTensor.
ClusteringCoeff
spektral.transforms.clustering_coefficient.ClusteringCoeff()
Concatenates to each node attribute the clustering coefficient of the corresponding node.
Constant
spektral.transforms.constant.Constant(value)
Concatenates a constant value to the node attributes.
Arguments
value
: the value to concatenate to the node attributes.
Delaunay
spektral.transforms.delaunay.Delaunay()
Computes the Delaunay triangulation of the node features.
The adjacency matrix is obtained from the edges of the triangulation and replaces the previous adjacency matrix. Duplicate edges are ignored and the adjacency matrix is binary.
Node features must be 2-dimensional.
Degree
spektral.transforms.degree.Degree(max_degree)
Concatenates to each node attribute the one-hot degree of the corresponding node.
The adjacency matrix is expected to have integer entries and the degree is cast to integer before one-hot encoding.
Arguments
max_degree
: the maximum degree of the nodes, i.e., the size of the one-hot vectors.
GCNFilter
spektral.transforms.gcn_filter.GCNFilter(symmetric=True)
Normalizes the adjacency matrix as described by Kipf & Welling (2017):
where .
Arguments
symmetric
: If False, then it computes instead.
LayerPreprocess
spektral.transforms.layer_preprocess.LayerPreprocess(layer_class)
Applies the preprocess
function of a convolutional Layer to the adjacency
matrix.
Arguments
layer_class
: the class of a layer fromspektral.layers.convolutional
, or any Layer that implements apreprocess(adj)
method.
NormalizeAdj
spektral.transforms.normalize_adj.NormalizeAdj(symmetric=True)
Normalizes the adjacency matrix as:
Arguments
symmetric
: If False, then it computes instead.
NormalizeOne
spektral.transforms.normalize_one.NormalizeOne()
Normalizes the node attributes by dividing each row by its sum, so that it sums to 1:
NormalizeSphere
spektral.transforms.normalize_sphere.NormalizeSphere()
Normalizes the node attributes so that they are centered at the origin and contained within a sphere of radius 1:
where is the centroid of the node features.
OneHotLabels
spektral.transforms.one_hot.OneHotLabels(depth=None, labels=None)
One-hot encodes the graph labels along the innermost dimension (also if they are simple scalars).
Either depth
or labels
must be passed as argument.
Arguments
depth
: int, the size of the one-hot vector (labels are intended as indices for a vector of sizedepth
);labels
: list or tuple, the possible values that the labels can take (labels are one-hot encoded according to where they are found inlabels
).