/** @import {InputType} from "../index.js" */ /** @import { ParametersKMedoids } from "./index.js" */ /** * K-Medoids (PAM - Partitioning Around Medoids) * * A robust clustering algorithm similar to K-Means, but uses actual data points (medoids) * as cluster centers and can work with any distance metric. * * @class * @extends Clustering * @category Clustering * @see {@link KMeans} for a faster but less robust alternative */ export class KMedoids extends Clustering { /** * @param {InputType} points - Data matrix * @param {Partial} parameters * @see {@link https://link.springer.com/chapter/10.1007/978-3-030-32047-8_16} Faster k-Medoids Clustering: Improving the PAM, CLARA, and CLARANS Algorithms */ constructor(points: InputType, parameters?: Partial); _A: Float64Array[]; _max_iter: number; _distance_matrix: Matrix; _randomizer: Randomizer; _clusters: any[]; _cluster_medoids: number[]; _is_initialized: boolean; /** @returns {number[]} The cluster list */ get_cluster_list(): number[]; /** @returns {number[][]} - Array of clusters with the indices of the rows in given points. */ get_clusters(): number[][]; /** @returns {number} */ get k(): number; /** @returns {number[]} */ get medoids(): number[]; /** @returns {number[]} */ get_medoids(): number[]; generator(): AsyncGenerator; /** Algorithm 1. FastPAM1: Improved SWAP algorithm */ /** FastPAM1: One best swap per iteration */ _iteration(): boolean; /** * * @param {number} i * @param {number} j * @param {Float64Array?} x_i * @param {Float64Array?} x_j * @returns */ _get_distance(i: number, j: number, x_i?: Float64Array | null, x_j?: Float64Array | null): number; /** * * @param {Float64Array} x_j * @param {number} j * @returns */ _nearest_medoid( x_j: Float64Array, j: number, ): { distance_nearest: number; index_nearest: number; distance_second: number; index_second: number; }; _update_clusters(): void; /** * Computes `K` clusters out of the `matrix`. * @param {number} K - Number of clusters. * @param {number[]} cluster_medoids */ init(K: number, cluster_medoids: number[]): this; /** * Algorithm 3. FastPAM LAB: Linear Approximate BUILD initialization. * * @param {number} K - Number of clusters * @returns {number[]} */ _get_random_medoids(K: number): number[]; } import type { ParametersKMedoids } from "./index.js"; import { Clustering } from "./Clustering.js"; import { Matrix } from "../matrix/index.js"; import { Randomizer } from "../util/index.js"; import type { InputType } from "../index.js"; //# sourceMappingURL=KMedoids.d.ts.map