rbf_kernel_weights: Construct Clustering Weights Based on the Radial Basis...

Description Usage Arguments Details Value Examples

Description

This is a factory function - it returns a function which can be used to create a matrix of clustering weights. In particular, it returns a function which takes a n-by-p data matrix X and returns an n-by-n matrix whose (i, j)-th element is given by e^{-phi * dist(x_i, x_j)} where x_i, x_j are the i-th and j-th row of X respectively. The distance metric used is determined by the dist.method and p arguments, which are passed to dist.

Usage

1
2
3
4
5
6
7
8
dense_rbf_kernel_weights(
  phi = "auto",
  dist.method = c("euclidean", "maximum", "manhattan", "canberra", "binary",
    "minkowski"),
  p = 2
)

sparse_rbf_kernel_weights(..., k = "auto")

Arguments

phi

The scale factor used for the RBF kernel

dist.method

The type of distance used to calculate distances between points. See the method argument to dist.

p

The power of the Minkowski distance (only relevant if method == "minkowski"). See the p argument to dist.

...

Arguments passed through from sparse_rbf_kernel_weights to dense_rbf_kernel_weights

k

The number of neighbors to use

Details

The sparse weights (sparse_rbf_kernel_weights) are calculated by dropping all but the k largest weights for each row of the matrix (equivalent to taking the k nearest neighbors to each point). The weight matrix is symmetrized, so if a is a neighbor of b, but not vice versa, the edge is still included. If k is too small, resulting in a non-fully-connected graph, an error is thrown.

If phi == "auto", a grid of possible phi values are used and the phi which maximizes the variance of the resulting weights is taken.

If k == "auto", the smallest k that still yields a fully connected graph is used.

Value

A function which, when called, returns a matrix of clustering weights.

Examples

1
2
3
4
5
6
7
8
weight_func <- dense_rbf_kernel_weights()
weight_func(presidential_speech)

weight_func <- dense_rbf_kernel_weights(phi=0.1, dist.method="canberra")
weight_func(presidential_speech)

weight_func <- sparse_rbf_kernel_weights()
weight_func(presidential_speech)

jjn13/clustRviz documentation built on Sept. 1, 2020, 7:53 a.m.