clustering-tfjs
Version:
High-performance TypeScript clustering algorithms (K-Means, Spectral, Agglomerative) with TensorFlow.js acceleration and scikit-learn compatibility
17 lines • 847 B
TypeScript
import * as tf from '../tf-adapter';
/**
* Creates the constant eigenvector for connected graphs in spectral clustering.
*
* For a connected graph, the smallest eigenvalue of the normalized Laplacian is 0,
* and its corresponding eigenvector should be constant. However, numerical computation
* can introduce small variations. sklearn replaces this with the theoretical constant
* eigenvector to improve clustering stability.
*
* sklearn uses a simple constant vector 1/sqrt(n) for all entries, not the
* degree-weighted version. This is then scaled by the spectral embedding normalization.
*
* @param affinity The affinity matrix
* @returns The constant eigenvector as a column vector (n x 1)
*/
export declare function createConstantEigenvector(affinity: tf.Tensor2D): tf.Tensor2D;
//# sourceMappingURL=constant_eigenvector.d.ts.map