Beispiel #1
0
        private static void Main(string[] args)
        {
            var payload = new List <IEntitySpecification>
            {
                new EntitySpecification("Ivan", 65.0, 170.0),
                new EntitySpecification("Oleg", 73.0, 172.0),
                new EntitySpecification("Sergei", 59.0, 168.0),
                new EntitySpecification("Kostya", 61.0, 171.0),
                new EntitySpecification("Alexey", 75.0, 150.0),
                new EntitySpecification("Victor", 67.0, 174.0),
                new EntitySpecification("Dima", 68.0, 175.0),
                new EntitySpecification("Anton", 70.0, 180.0),
                new EntitySpecification("Valera", 62.0, 169.0),
                new EntitySpecification("Danila", 66.0, 168.0),
                new EntitySpecification("Sasha", 77.0, 190.0),
                new EntitySpecification("Stas", 75.0, 180.0),
                new EntitySpecification("Tamara", 74.0, 184.0),
                new EntitySpecification("Olga", 70.0, 170.0),
                new EntitySpecification("Nadya", 61.0, 150.0),
                new EntitySpecification("Irina", 58.0, 145.0),
                new EntitySpecification("Maksim", 66.0, 160.0),
                new EntitySpecification("Katya", 59.0, 148.0),
                new EntitySpecification("Pavel", 68.0, 182.0),
                new EntitySpecification("Igor", 61.0, 135.0)
            };

            var kMean  = new KMean(new ClusterService(new MeanService(), new CentroidService(new Metric())), new Metric());
            var result = kMean.Calculate(payload, CountClusters, CountTry);

            ShowClustering(result, 3, kMean.GetClusters());
        }
Beispiel #2
0
            public async Task <List <TrainingData> > Handle(Query request, CancellationToken cancellationToken)
            {
                var points = await db.PointTests.Where(t => t.ClassRoomId == request.IdSubject).ToListAsync();

                var    listdata = new List <Data>();
                var    data     = new Data();
                double value    = 0;

                foreach (var p in points)
                {
                    value = (((double)p.Tk * 0.2 + (double)p.Gk * 0.3 + (double)p.Ck * 0.5) * 2
                             + (double)p.Th) / 3;

                    value = Math.Round(value, 2, MidpointRounding.AwayFromZero);

                    var studentDTO = _mapper.Map <Student, StudentDTO>(p.Student);

                    studentDTO.Point = _mapper.Map <PointTest, PointTestDTO>(p);

                    data = new Data()
                    {
                        Student = studentDTO,
                        Value   = value
                    };
                    listdata.Add(data);
                }
                kMean = new KMean(listdata, 4);
                kMean.Run();
                return(kMean.TrainingDatas);
            }
Beispiel #3
0
        private void grupujToolStripMenuItem_Click(object sender, EventArgs e)
        {
            KMean clasifications = new KMean();

            if (clasifications.ShowDialog() == DialogResult.OK)
            {
                Operator.KMeanGroup(clasifications.Metric, clasifications.K);
                RefreshTable();
            }
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            KMean km = new KMean();

            string filename = "location.txt";

            //string filename = "location_demo.txt";


            km.LoadData(filename);
            km.InitializeRandomCenteroidForClusters(3);

            km.MakeCluster();

            km.Print();
            km.Write();
        }