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; }
public void Solve(int k) { _solver.Train(LearningPoints); _solver.Classify(InputPoints, k); }