affinity_matrix: Generate a symmetric affinity matrix based on a distance...

View source: R/SpectralClustering.R

affinity_matrixR Documentation

Generate a symmetric affinity matrix based on a distance matrix using 'local' Gaussian kernel

Description

Generate a symmetric affinity matrix based on a distance matrix using 'local' Gaussian kernel

Usage

affinity_matrix(D, k, alpha = 1/6, beta = 1/6)

Arguments

D

distance matrix (need to be a square and non-negative matrix)

k

the number of k-nearest neighbors

alpha

coefficient for local diameters. Default value: 1/6. This default value should work for most cases.

beta

coefficient for pair-wise distance. Default value: 1/6. This default value should work for most cases.

Value

an affinity matrix

Examples

D = matrix(runif(400), nrow=20)
A = affinity_matrix(D, 5)

BeautyOfWeb/ANF documentation built on Feb. 18, 2024, 5:03 p.m.