Пример #1
0
 public static ScalarAccuracy Of(SampleDataset dataset)
 {
     return(PersistentCache.Get("accuracy", dataset.Path, () =>
     {
         var trio = QuantileFunction.Of(dataset);
         var accuracy = new ScalarAccuracy();
         accuracy.Fmr100 = QuantileFunction.FnmrAtFmr(trio.Matching, trio.Nonmatching, 1.0 / 100);
         accuracy.Fmr1K = QuantileFunction.FnmrAtFmr(trio.Matching, trio.Nonmatching, 1.0 / 1_000);
         accuracy.Fmr10K = QuantileFunction.FnmrAtFmr(trio.Matching, trio.Nonmatching, 1.0 / 10_000);
         accuracy.Eer = QuantileFunction.Eer(trio.Matching, trio.Nonmatching);
         return accuracy;
     }));
 }
Пример #2
0
 public static double[][] Of(SampleDataset dataset)
 {
     return(PersistentCache.Get("scores", dataset.Path, () =>
     {
         var fingerprints = dataset.Fingerprints;
         var templates = fingerprints.Select(fp => NativeTemplate.Of(fp)).ToList();
         var scores = new double[fingerprints.Count][];
         foreach (var probe in fingerprints)
         {
             var matcher = new FingerprintMatcher(templates[probe.Id]);
             scores[probe.Id] = new double[fingerprints.Count];
             foreach (var candidate in fingerprints)
             {
                 scores[probe.Id][candidate.Id] = matcher.Match(templates[candidate.Id]);
             }
         }
         return scores;
     }));
 }
Пример #3
0
        public static Trio Of(SampleDataset dataset)
        {
            var fingerprints = dataset.Fingerprints;
            var scores       = ScoreTable.Of(dataset);
            var matching     = new List <double>();
            var nonmatching  = new List <double>();
            var selfmatching = new List <double>();

            foreach (var probe in fingerprints)
            {
                foreach (var candidate in fingerprints)
                {
                    var score = scores[probe.Id][candidate.Id];
                    if (probe.Id == candidate.Id)
                    {
                        selfmatching.Add(score);
                    }
                    else if (probe.Finger.Id == candidate.Finger.Id)
                    {
                        matching.Add(score);
                    }
                    else
                    {
                        nonmatching.Add(score);
                    }
                }
            }
            matching.Sort();
            nonmatching.Sort();
            selfmatching.Sort();
            var trio = new Trio();

            trio.Matching     = matching.ToArray();
            trio.Nonmatching  = nonmatching.ToArray();
            trio.Selfmatching = selfmatching.ToArray();
            return(trio);
        }
Пример #4
0
 public SampleFingerprint(SampleDataset dataset, int id)
 {
     Dataset = dataset;
     Id      = id;
 }
Пример #5
0
 public static Table ExtractorTable(SampleDataset dataset)
 {
     return(SumTables(dataset.Fingerprints.Select(fp => ExtractorTable(fp)).ToList()));
 }