-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rework options and write TS definitions
BREAKING CHANGE: the `disFunc` option was renamed to `distanceFunction`.
- Loading branch information
Showing
3 changed files
with
70 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,29 @@ | ||
declare module 'hclust' {} | ||
declare module 'ml-hclust' { | ||
export type LinkageKind = | ||
| 'single' | ||
| 'complete' | ||
| 'average' | ||
| 'centroid' | ||
| 'ward'; | ||
export interface AgnesOptions { | ||
distanceFunction: (a: number[], b: number[]) => number; | ||
kind: LinkageKind; | ||
isDistanceMatrix: boolean; | ||
} | ||
|
||
export interface DianaOptions { | ||
distanceFunction: (a: number[], b: number[]) => number; | ||
} | ||
|
||
export interface Cluster { | ||
children: Cluster[]; | ||
distance: number; | ||
index: number[]; | ||
cut: (threshold: number) => Cluster[]; | ||
group: (minGroups: number) => Cluster; | ||
traverse: (cb: (cluster: Cluster) => void) => void; | ||
} | ||
|
||
export function agnes(data: number[][], options?: AgnesOptions): Cluster; | ||
export function diana(data: number[][], options?: DianaOptions): Cluster; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters