private static Tuple <double[][], double[][]> split(double[][] cluster, KMeans kmeans, double threshold) { kmeans.Randomize(cluster, useSeeding: false); kmeans.Tolerance = threshold; kmeans.ComputeInformation = false; int[] idx = kmeans.Compute(cluster); List <double[]> a = new List <double[]>(); List <double[]> b = new List <double[]>(); for (int i = 0; i < idx.Length; i++) { if (idx[i] == 0) { a.Add(cluster[i]); } else { b.Add(cluster[i]); } } return(Tuple.Create(a.ToArray(), b.ToArray())); }
private static Tuple <double[][], double[][]> split(double[][] cluster, KMeans kmeans) { kmeans.Randomize(cluster); int[] idx = kmeans.Compute(cluster); List <double[]> a = new List <double[]>(); List <double[]> b = new List <double[]>(); for (int i = 0; i < idx.Length; i++) { if (idx[i] == 0) { a.Add(cluster[i]); } else { b.Add(cluster[i]); } } return(Tuple.Create(a.ToArray(), b.ToArray())); }