Esempio n. 1
0
        public double CrossValidate(Random seed)
        {
            //Console.WriteLine("Start time: " + DateTime.Now.ToString());
            DatasetParser datasetParser = new DatasetParser();

            Example[] examples = datasetParser.parseDatasetFile(this.EXAMPLES_FILENAME);

            CharacterRecognition cr = new CharacterRecognition(this.NUM_NETWORKS,
                                                               NETWORK_NUM_INPUTS, NETWORK_NUM_OUTPUTS,
                                                               NETWORK_NUM_HIDDEN_LAYERS, NETWORK_NUM_NEURONS_PER_HIDDEN_LAYER
                                                               , seed);

            CrossValidation cv        = new CrossValidation(examples, 5, ref cr, seed);
            double          precision = cv.CalculatePrecision(ref examples);

            //Console.WriteLine(1.0 - precision);
            //Console.WriteLine("End time: " + DateTime.Now.ToString());
            return(1.0 - precision);
        }
Esempio n. 2
0
        public static void CrossValidate(Random seed)
        {
            DatasetParser datasetParser;

            Example[]            examples;
            CharacterRecognition cr;
            CrossValidation      cv;


            NetworkEvolution.GENERATIONS_NUMBER = 20000;
            NetworkEvolution.STAGNANT_NUMBER    = 50;
            Console.WriteLine("-------stag50||its20000_mut0,003_pop20_30_L1_70-------------------------");
            Console.WriteLine("Start time: " + DateTime.Now.ToString());
            datasetParser = new DatasetParser();
            examples      = datasetParser.parseDatasetFile(EXAMPLES_FILENAME);
            cr            = new CharacterRecognition(NUM_NETWORKS,
                                                     NETWORK_NUM_INPUTS, NETWORK_NUM_OUTPUTS,
                                                     1, new int[] { 70 }, seed);
            cv = new CrossValidation(examples, 5, ref cr, seed);
            Console.WriteLine(cv.CalculatePrecision(ref examples));
            Console.WriteLine("End time: " + DateTime.Now.ToString());
        }