예제 #1
0
        public void Execute(List <Point> points)
        {
            var training   = points.Take(_trainingSize).ToList();
            var test       = points.Skip(_trainingSize).ToList();
            var trainWatch = Stopwatch.StartNew();

            _knn.Train(training);
            _trainingTime = trainWatch.Elapsed;
            _knn.Classify(test, _k);
            _testTime = trainWatch.Elapsed - _trainingTime;
            trainWatch.Stop();
            _classified  = test.Count(n => n.ResultLabel == n.TrueLabel);
            _datasetSize = points.Count;
            _testSize    = _datasetSize - _trainingSize;
            _accuracy    = _classified / (float)_testSize;
        }
예제 #2
0
파일: Problem.cs 프로젝트: Averdose/KMM
 public void Solve(int k)
 {
     _solver.Train(LearningPoints);
     _solver.Classify(InputPoints, k);
 }