public KMeansClusterFactory(ClusterDataSourceSettings settings, IClusterMergeStrategy mergeStrategy, IntSize size) { this.settings = settings; this.mergeStrategy = mergeStrategy; this.algorithm = new KMeans(this.settings.ClusterCount, settings.DepthRange, size); this.value = new ClusterCollection(); }
private void FindClusters(IList<Point> pointList) { this.InitializeAlgorithm(pointList); this.algorithm.IterateUntilStable(); if (this.algorithm.ClusterCount > 0) { var prototypes = this.FlattenIfRequired(this.MergeClustersIfRequired(this.algorithm.Clusters)); this.value = new ClusterCollection(prototypes.Select(p => p.ToCluster()).ToList()); } }
private void FindClusters(IList <Point> pointList) { this.InitializeAlgorithm(pointList); this.algorithm.IterateUntilStable(); if (this.algorithm.ClusterCount > 0) { var prototypes = this.FlattenIfRequired(this.MergeClustersIfRequired(this.algorithm.Clusters)); this.value = new ClusterCollection(prototypes.Select(p => p.ToCluster()).ToList()); } }
public ClusterCollection Create(IList<Point> points) { var reducedPoints = this.ReducePoints(points); if (this.AreEnoughPointsForClustering(reducedPoints.Count)) { this.FindClusters(reducedPoints); this.AssignAllPoints(points); } else { this.value = new ClusterCollection(); } return this.value; }
public ShapeCollection Create(ClusterCollection clusterData) { var result = new ShapeCollection(); foreach (var cluster in clusterData.Clusters) { var convexHull = new GrahamScan(cluster.Points).FindHull(); var map = CreateMap(cluster); var contour = CreateContour(map, cluster); if (contour.Count >= settings.MinimalPointsInContour) { result.Shapes.Add(new Shape(cluster.Center, cluster.Volume, contour, convexHull, cluster.Points)); } } return result; }
public ClusterCollection Create(IList <Point> points) { var reducedPoints = this.ReducePoints(points); if (this.AreEnoughPointsForClustering(reducedPoints.Count)) { this.FindClusters(reducedPoints); this.AssignAllPoints(points); } else { this.value = new ClusterCollection(); } return(this.value); }
private void ClusterDataSource_NewDataAvailable(ClusterCollection data) { // todo }
private void dataSource_NewDataAvailable(ClusterCollection clusters) { this.Dispatcher.Invoke(new Action(() => InvalidateVisual())); }