sgtl.graph.rbf_graph#
- sgtl.graph.rbf_graph(data, variance=1, threshold=0.1) Graph #
Construct a graph from the given data using a radial basis function. The weight of the edge between each pair of data points is given by the Gaussian kernel function
\[k(x_i, x_j) = \exp\left( - \frac{||x_i - x_j||^2}{2 \sigma^2} \right)\]where \(\sigma^2\) is the variance of the kernel and defaults to 1. Any weights less than the specified threshold (default \(0.1\)) are discarded and no edge is added to the graph.
- Parameters:
data – a sparse matrix with dimension \((n, d)\) containing the raw data
variance – the variance of the gaussian kernel to be used
threshold – the threshold under which to ignore the weights of an edge. Set to 0 to keep all edges.
- Returns:
an sgtl.Graph object