discriminating_distance | R Documentation |
This function computes a discriminating distance matrix for the similarity graph based on the class labels. It adjusts the similarity graph by modifying the weights within and between classes, making it more suitable for tasks like classification and clustering.
discriminating_distance(X, k = length(labels)/2, sigma, labels)
X |
A numeric matrix or data frame containing the data points. |
k |
An integer representing the number of nearest neighbors to consider. Default is the number of unique labels divided by 2. |
sigma |
A numeric value representing the scaling factor for the heat kernel. If not provided, it will be estimated. |
labels |
A factor or numeric vector containing the class labels for each data point. |
A discriminating distance matrix in the form of a numeric matrix.
X <- matrix(rnorm(100*100), 100, 100)
labels <- factor(rep(1:5, each=20))
sigma <- 0.7
D <- discriminating_distance(X, k=length(labels)/2, sigma, labels)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.