diff --git a/kmeans.ts b/kmeans.ts index a2129d4..53066c2 100644 --- a/kmeans.ts +++ b/kmeans.ts @@ -5,7 +5,7 @@ export interface KMeans { centroids: Centroids; } -export type UniMultiDimensionalArray = Array; +export type UniMultiDimensionalArray = Array; // needs to be able to handle array of any size export type Vector = Array; export type Vectors = Array; export type Centroid = Array; @@ -31,7 +31,7 @@ function kmeans( let indexes: Array = []; let cent_moved: boolean = false; let iterations: number = max_it || MAX; - let count: Array = []; + let count: Vector = []; if (!init_cent) { let def_indexes: Array = []; @@ -72,8 +72,8 @@ function kmeans( } // Recalculate centroids - let sum: Array = []; - let old: Array> = []; + let sum: UniMultiDimensionalArray = []; + let old: Centroids = []; if (data[0].length > 0) { for (let j = 0; j < k; j++) { sum[j] = init(data[0].length, 0, sum[j]);