Esempio n. 1
0
        public void  postprocessResults(Core.Evaluation.Results.Results results)
        {
            string summary = "";

            foreach (string method in results.Methods)
            {
                this.onProgressChanged(new ProgressReport("StatisticsSummary: " + method));
                Statistics s = new Statistics(method, results);
                summary += method + ";" + s.FAR.ToString() + ";" + s.FRR.ToString() + "\n";
            }

            File.WriteAllText(FileName, summary);
            this.onProgressChanged(new ProgressReport("StatisticsSummary: done"));
        }
Esempio n. 2
0
        public void evaluateRecords(Core.Database.IRecordEnumerable <TInputRecord> inputDatabase, TemplateDatabase templateDatabase, Core.Evaluation.Results.Results results)
        {
            onProgressChanged(new ProgressReport("Records evaluation started"));

            Dictionary <string, Dictionary <int, Core.Database.TemplateDatabase.TemplateRecord> > cache = new Dictionary <string, Dictionary <int, Core.Database.TemplateDatabase.TemplateRecord> >();

            //onProgressChanged(new ProgressReport("Create cache"));
            //List<TemplateCacheRecord> cache = new List<TemplateCacheRecord>();

            foreach (var block in evaluationSettings.getEvaluatedBlockIterator())
            {
                block.resetTemplates();
                cache.Add(block.Name, new Dictionary <int, Core.Database.TemplateDatabase.TemplateRecord>());
                foreach (Core.Database.TemplateDatabase.TemplateRecord templateRecord in templateDatabase.getCollections().getRecords())
                {
                    cache[block.Name].Add(
                        block.pushTemplate(
                            templateRecord.PersistentTemplate.getSubtemplate(block.Name)),
                        templateRecord
                        );
                }
            }

            int total = inputDatabase.getRecords().Count() * evaluationSettings.getEvaluatedBlockIterator().Count();
            int act   = 0;

            foreach (TInputRecord r in inputDatabase.getRecords())
            {
                string message = "Records evaluation ";
                message += ".";
                onProgressChanged(new ProgressReport(message, act, total));

                //create input data
                TInputData inputData = this.evaluationSettings.getInputDataCreator().createInputData(r);

                message += ".";
                onProgressChanged(new ProgressReport(message, act, total));

                foreach (var block in evaluationSettings.getEvaluatedBlockIterator())
                {
                    act++;

                    block.setInputData(inputData);

                    foreach (KeyValuePair <int, Core.Database.TemplateDatabase.TemplateRecord> pair in cache[block.Name])
                    {
                        //compare
                        MatchingScore matchingScore = block.computeMatchingScore(pair.Key);

                        //store result
                        Result result = new Result(new Record(pair.Value), new Record(r));
                        result.setMatchingScore(block.Name, matchingScore);

                        results.addResult(result);
                    }

                    message += ".";
                    onProgressChanged(new ProgressReport(message, act, total));
                }
            }
        }