import { ClusterBase } from '../base/cluster'; import { Params } from '../base/estimator'; import { Distance } from '../metrics'; export interface HDBScanProps { /** smallest group of points considered a cluster (clamped to >= 2) */ min_cluster_size?: number; /** neighborhood size for core distances; defaults to min_cluster_size */ min_samples?: number | null; /** clusters split below this distance are merged back together */ cluster_selection_epsilon?: number; /** distance metric name */ metric?: Distance.IDistanceType; /** allow the root of the tree to be selected as a single cluster */ allow_single_cluster?: boolean; } export declare class HDBScan extends ClusterBase { private minClusterSize; /** raw prop value; null means "default to min_cluster_size" (resolved at fit time) */ private minSamples; private epsilon; private allowSingleCluster; private metric; private labels; private probabilities; constructor(props?: HDBScanProps); /** @deprecated positional form; prefer the props-object constructor */ constructor(min_cluster_size?: number, min_samples?: number | null, cluster_selection_epsilon?: number, metric?: Distance.IDistanceType, allow_single_cluster?: boolean); getParams(): Params; /** resolved lazily from the metric name so instances stay JSON-serializable */ private get distance(); fitPredict(samplesX: number[][]): number[]; getLabels(): number[]; /** * Cluster membership strength of each sample from the last fitPredict * call. Noise points have probability 0. */ getProbabilities(): number[]; /** * Compute the mutual reachability matrix. The core distance of a point * is its distance to the min_samples-th nearest neighbor, where the * point itself is counted (sklearn semantics). */ private mutualReachability; /** * Prim's algorithm on the dense mutual reachability graph. Returns the * MST as [from, to, weight] edges. Mirrors sklearn's * mst_from_mutual_reachability exactly, including first-minimum * tie-breaking and recording the most recently added node (rather than * the true argmin source) as the from-endpoint, which matters for tie * resolution in the subsequent single linkage step. */ private primMST; /** * Convert the weight-sorted MST edge list into a single linkage * hierarchy in scipy format: row i merges two clusters into cluster * n + i. */ private singleLinkage; private bfsFromHierarchy; /** * Condense the single linkage tree: splits where a side has fewer than * min_cluster_size points are treated as points falling out of the * parent cluster rather than new clusters. Lambda values are 1/distance. */ private condenseTree; /** * Stability S(C) = sum over children rows of (lambda - lambda_birth(C)) * weighted by size. */ private computeStability; private bfsFromClusterTree; /** * Walk from a selected cluster towards the root until the birth * distance of the parent exceeds cluster_selection_epsilon * (sklearn's traverse_upwards). */ private traverseUpwards; /** sklearn's epsilon_search over the EOM/leaf-selected clusters. */ private epsilonSearch; /** * EOM cluster selection, labelling and probabilities, mirroring * sklearn's _get_clusters / _do_labelling / get_probabilities. */ private extractClusters; }