private static void DBTest()
 {
     DbHelper dbHelper = new DbHelper();
     int      a        = DbHelper.GetBestFingerprint(5);
     var      b        = DbHelper.GetTestingFingerprintSame(100, DbHelper.GetBestFingerprint(100));
     var      c        = dbHelper.GetTestingFingerprintDiff(100);
     //DbHelper.FindBestQualityFingerprint();
 }
 private static void DBTest()
 {
     DbHelper dbHelper = new DbHelper();
   int a = DbHelper.GetBestFingerprint(5);
   var b = DbHelper.GetTestingFingerprintSame(100, DbHelper.GetBestFingerprint(100));
   var c = dbHelper.GetTestingFingerprintDiff(100);
   //DbHelper.FindBestQualityFingerprint();
 }
Exemple #3
0
        public static long MultymodalAllDifTest(int step, double thresholdStep, double startThreshold, double endThreshold)
        {
            Stopwatch w        = Stopwatch.StartNew();
            string    strFirst = String.Format("Threshold NumFull NumYes NumNo NumIdk\n");

            File.AppendAllText(Constants.resultsPath + "MultymodalAllDifTest.txt", strFirst);

            DecisionMaker decisionMaker = new DecisionMaker();
            QualityHelper qhelper       = new QualityHelper();
            DbHelper      dbHelper      = new DbHelper();
            Dictionary <int, List <Tuple <string, string, string> > > fpForMatchDictionary = new Dictionary <int, List <Tuple <string, string, string> > >();
            Dictionary <int, int> BestFp = new Dictionary <int, int>();

            for (int j = 1; j < 101; j += step)
            {
                var newFpForMatch = dbHelper.GetTestingFingerprintDiff(j);
                fpForMatchDictionary.Add(j, newFpForMatch);

                int bestFp = DbHelper.GetBestFingerprint(j);
                BestFp.Add(j, bestFp);
            }

            for (double threshold = startThreshold; threshold < endThreshold + 0.001; threshold += thresholdStep)
            {
                int numYes = 0;
                int numNo  = 0;
                int numIdk = 0;
                int numAll = 0;
                for (int j = 1; j < 101; j += step)
                {
                    int bestFp     = BestFp[j];
                    var fpForMatch = fpForMatchDictionary[j];

                    string fileNameEt = j.ToString() + "_" + bestFp.ToString() + ".tif";
                    foreach (var item in fpForMatch)
                    {
                        var input = InputHelper.GetMultymodalInput(item.Item1, item.Item2, item.Item3, fileNameEt);
                        if (input[0] > threshold && input[1] > threshold && input[2] > threshold)
                        {
                            numYes++;
                        }
                        else
                        {
                            numNo++;
                        }
                        numAll++;
                    }
                }
                string str = String.Format("{0} {1} {2} {3} {4}\n", threshold, numAll, numYes, numNo, 0);
                File.AppendAllText(Constants.resultsPath + "MultymodalAllDifTest.txt", str);
            }
            w.Stop();
            return(w.ElapsedMilliseconds);
        }
        public static long FuzzyDifTest(int step, double thresholdStep, double startThreshold, double endThreshold)
        {

            Stopwatch w = Stopwatch.StartNew();
            string strFirst = String.Format("Threshold NumFull NumYes NumNo NumIdk\n");
            File.AppendAllText(Constants.resultsPath + "FuzzyDifTest.txt", strFirst);

            DecisionMaker decisionMaker = new DecisionMaker();
            QualityHelper qhelper = new QualityHelper();
            DbHelper dbHelper = new DbHelper();
            Dictionary<int, List<Tuple<string, string, string>>> fpForMatchDictionary = new Dictionary<int, List<Tuple<string, string, string>>>();
            Dictionary<int, int> BestFp = new Dictionary<int, int>();

            for (int j = 1; j < 101; j += step)
            {
                var newFpForMatch = dbHelper.GetTestingFingerprintDiff(j);
                fpForMatchDictionary.Add(j, newFpForMatch);

                int bestFp = DbHelper.GetBestFingerprint(j);
                BestFp.Add(j, bestFp);
            }

            for (double threshold = startThreshold; threshold < endThreshold + 0.001; threshold += thresholdStep)
            {
                int numYes = 0;
                int numNo = 0;
                int numIdk = 0;
                int numAll = 0;
                for (int j = 1; j < 101; j += step)
                {
                    int bestFp = BestFp[j];
                    var fpForMatch = fpForMatchDictionary[j];

                    string fileNameEt = j.ToString() + "_" + bestFp.ToString() + ".tif";

                    foreach (var item in fpForMatch)
                    {
                        var input = InputHelper.GetMultyFuzzyInput(item.Item1, item.Item2, item.Item3, fileNameEt, qhelper);

                        var answer = decisionMaker.GetAnswer(input, threshold);
                        switch (answer.ValueName)
                        {
                            case "yes":
                                numYes++;
                                break;
                            case "no":
                                numNo++;
                                break;
                            case "idk":
                                numIdk++;
                                break;
                            default:
                                break;
                        }
                        numAll++;
                    }
                }
                string str = String.Format("{0} {1} {2} {3} {4}\n", threshold, numAll, numYes, numNo, numIdk);
                File.AppendAllText(Constants.resultsPath + "FuzzyDifTest.txt", str);
            }
            w.Stop();
            return w.ElapsedMilliseconds;
        }
        public static long MonomodalDifTest(int step, double thresholdStep, double startThreshold, double endThreshold)
        {

            Stopwatch w = Stopwatch.StartNew();
            string strFirst = String.Format("Threshold NumFull NumYes NumNo NumIdk\n");
            File.AppendAllText(Constants.resultsPath + "MonomodalSameTest.txt", strFirst);

            DecisionMaker decisionMaker = new DecisionMaker();
            QualityHelper qhelper = new QualityHelper();
            DbHelper dbHelper = new DbHelper();
            Dictionary<int, List<Tuple<string, string, string>>> fpForMatchDictionary = new Dictionary<int, List<Tuple<string, string, string>>>();
            Dictionary<int, int> BestFp = new Dictionary<int, int>();

            for (int j = 1; j < 101; j += step)
            {
                var newFpForMatch = dbHelper.GetTestingFingerprintDiff(j);
                fpForMatchDictionary.Add(j, newFpForMatch);

                int bestFp = DbHelper.GetBestFingerprint(j);
                BestFp.Add(j, bestFp);
            }

            for (double threshold = startThreshold; threshold < endThreshold + 0.001; threshold += thresholdStep)
            {
                int numYes = 0;
                int numNo = 0;
                int numIdk = 0;
                int numAll = 0;
                for (int j = 1; j < 101; j += step)
                {
                    int bestFp = BestFp[j];
                    var fpForMatch = fpForMatchDictionary[j];

                    string fileNameEt = j.ToString() + "_" + bestFp.ToString() + ".tif";
                    foreach (var item in fpForMatch)
                    {
                        var input1 = InputHelper.GetMonomodalInput(item.Item1, fileNameEt);
                        if (input1 < threshold)
                        {
                            numNo++;
                        }
                        else
                        {
                            numYes++;
                        }
                        numAll++;

                        var input2 = InputHelper.GetMonomodalInput(item.Item2, fileNameEt);
                        if (input2 < threshold)
                        {
                            numNo++;
                        }
                        else
                        {
                            numYes++;
                        }
                        numAll++;

                        var input3 = InputHelper.GetMonomodalInput(item.Item3, fileNameEt);
                        if (input3 < threshold)
                        {
                            numNo++;
                        }
                        else
                        {
                            numYes++;
                        }
                        numAll++;
                    }

                }
                string str = String.Format("{0} {1} {2} {3} {4}\n", threshold, numAll, numYes, numNo, 0);
                File.AppendAllText(Constants.resultsPath + "MonomodalDifTest.txt", str);

            }
            w.Stop();
            return w.ElapsedMilliseconds;
        }