Пример #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();
 }
Пример #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();
 }
Пример #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());
            }
        }
Пример #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());
            }
        }
Пример #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;
        }
Пример #6
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;
        }
Пример #7
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);
        }
Пример #8
0
 private void ClusterDataSource_NewDataAvailable(ClusterCollection data)
 {
     // todo
 }
Пример #9
0
 private void dataSource_NewDataAvailable(ClusterCollection clusters)
 {
     this.Dispatcher.Invoke(new Action(() => InvalidateVisual()));
 }