Learn R Programming

cvxclustr (version 1.1.1)

knn_weights: "Thin" a weight vector to be positive only for its k-nearest neighbors

Description

knn_weights takes a weight vector w and sets the ith component w[i] to zero if either of the two corresponding nodes is not among the other's k nearest neighbors.

Usage

knn_weights(w, k, n)

Arguments

w
A vector of nonnegative weights. The ith entry w[i] denotes the weight used between the ith pair of centroids. The weights are in dictionary order.
k
The number of nearest neighbors
n
The number of data points.

Value

A vector w of weights for convex clustering.