Пример #1
0
        static void Main(string[] args)
        {
            var dataDirectory = @".\data\";
            var distance      = new ManhattanDistance();
            var classifier    = new BasicClassifier(distance);

            var training = DataReader.ReadObservations(dataDirectory + "trainingsample" + ".csv");

            classifier.Train(training);

            var validation = DataReader.ReadObservations(dataDirectory + "validationsample" + ".csv");

            var correct = Evaluator.Correct(validation, classifier);

            Console.WriteLine("Correctly classified: {0:P2}", correct);

            Console.ReadLine();
        }
Пример #2
0
 public static double Correct(IEnumerable <Observation> validationSet, BasicClassifier classifier) =>
 validationSet
 .Select(obs => Score(obs, classifier))
 .Average();