discriminating_distance: Compute Discriminating Distance for Similarity Graph

View source: R/class_graph.R

discriminating_distanceR Documentation

Compute Discriminating Distance for Similarity Graph

Description

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.

Usage

discriminating_distance(X, k = length(labels)/2, sigma, labels)

Arguments

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.

Value

A discriminating distance matrix in the form of a numeric matrix.

Examples

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)


bbuchsbaum/neighborweights documentation built on April 1, 2024, 8:41 p.m.