static void ClusterPoints() { var points = Enumerable.Range(0, 100) .Select(_ => Enumerable.Range(1, 3).Select(i => RandomUtility.NextDouble(0, i)).ToArray()) .ToArray(); var records = points .Select((p, i) => new Record <int> { Element = i, Features = p, }) .ToArray(); var clustering = new KMeans <int>(10, 20); var clusters = clustering.Train(records); foreach (var cluster in clusters) { Console.WriteLine(cluster.Key); Array.ForEach(cluster.Value, r => Console.WriteLine(FeaturesHelper.ToString(r.Features))); } }
string ToDebugString() { return(string.Format("{0}: {1}", Element, FeaturesHelper.ToString(Features))); }
string ToDebugString() { return(string.Format("{0}: {1}: {2} records", Id, FeaturesHelper.ToString(Centroid), Records.Count)); }