Ejemplo n.º 1
0
 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();
 }
Ejemplo n.º 2
0
 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();
 }
Ejemplo n.º 3
0
        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());
            }
        }
Ejemplo n.º 4
0
        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());
            }
        }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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;
        }
Ejemplo n.º 8
0
 private void dataSource_NewDataAvailable(ClusterCollection clusters)
 {
     this.OnRequestRefresh();
 }
Ejemplo n.º 9
0
 private void dataSource_NewDataAvailable(ClusterCollection clusters)
 {
     this.Dispatcher.Invoke(new Action(() => InvalidateVisual()));
 }