예제 #1
0
        private static void Random2DPoints_OnGeneratePointGroups(IEnumerable <Point2D> Nodes)
        {
            Points2DCollectionsViewer View = Points2DCollectionsViewer.BuildViewer(Nodes, "RawData Generated", 0, NodesMaxValueSet);

            Points2DCollectionsViewer.ShowViewer(View);
            Points2DCollectionsViewer.CloseAllButLastView();
        }
예제 #2
0
        private static void Kmeans_OnIteration(IEnumerable <VectorCollection <Point2D> > Groups, int IterationCount)
        {
            List <Point2D> point2Ds = new List <Point2D>();

            foreach (var Group in Groups)
            {
                point2Ds.AddRange(Group);
            }

            Points2DCollectionsViewer View = Points2DCollectionsViewer.BuildViewer(point2Ds, "Round:" + Round + ",Iteration:" + IterationCount, 0, NodesMaxValueSet);

            foreach (var Group in Groups)
            {
                View.AddMarkAt(Group.Center, 16, 1);
            }
            Points2DCollectionsViewer.ShowViewer(View);
        }
예제 #3
0
        private static void Knn_OnClassify(Point2D NewNode, IEnumerable <Point2D> ClosestKPoints, string MostTag, IEnumerable <Point2D> ClassifiedNodes)
        {
            Console.WriteLine("NewPoint,x:{0},y:{1}\t,closet points in {2}", NewNode.x, NewNode.y, k);

            foreach (var ClosestPoint in ClosestKPoints)
            {
                Console.WriteLine("Point,x:{0},y:{1}\t,tag:{2},distance{3}", ClosestPoint.x, ClosestPoint.y, ClosestPoint.Tag, ClosestPoint.GetEuclideanDistance(NewNode));
            }

            Console.WriteLine("MostTag:{0}", MostTag);
            Console.WriteLine("----------------------------------");

            List <Point2D> point2Ds = new List <Point2D>();

            point2Ds.AddRange(ClassifiedNodes);

            StringBuilder sb = new StringBuilder();

            sb.Append("Round:");
            sb.Append(Round++);
            sb.Append(" ,AddPoint At:");
            sb.Append(NewNode.x);
            sb.Append(",");
            sb.Append(NewNode.y);
            sb.Append(",Tag:");
            sb.Append(NewNode.Tag);
            Points2DCollectionsViewer View = Points2DCollectionsViewer.BuildViewer(point2Ds, sb.ToString(), 0, NodesMaxValueSet);

            View.AddMarkAt(NewNode, 20, 7);

            foreach (var ClosestPoint in ClosestKPoints)
            {
                View.AddMarkAt(ClosestPoint, 6, 7);
            }
            Points2DCollectionsViewer.ShowViewer(View);
        }