-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathhclust.d.ts
44 lines (39 loc) · 888 Bytes
/
hclust.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
export type AgglomerationMethod =
| 'single'
| 'complete'
| 'average'
| 'upgma'
| 'wpgma'
| 'median'
| 'wpgmc'
| 'centroid'
| 'upgmc'
| 'ward'
| 'ward2';
export interface AgnesOptions<T> {
distanceFunction?: (a: T, b: T) => number;
method?: AgglomerationMethod;
isDistanceMatrix?: boolean;
}
// export interface DianaOptions<T> {
// distanceFunction?: (a: T, b: T) => number;
// }
export class Cluster {
children: Cluster[];
height: number;
size: number;
index: number;
isLeaf: boolean;
cut: (threshold: number) => Cluster[];
group: (groups: number) => Cluster;
traverse: (cb: (cluster: Cluster) => void) => void;
indices: () => number[];
}
export function agnes<T = number[]>(
data: T[],
options?: AgnesOptions<T>,
): Cluster;
// export function diana<T = number[]>(
// data: T[],
// options?: DianaOptions<T>,
// ): Cluster;