예제 #1
0
        float ComputeModeUtility(
            eye_tracking_mouse.Options.CalibrationMode mode,
            Dictionary <long, float> new_test_results,
            TestResultsInfo info)
        {
            long key = iterator.GetUniqueKey(mode);


            if (previous_test_results.ContainsKey(key))
            {
                info.cached_results_reused++;
                return(previous_test_results[key]);
            }

            if (new_test_results.ContainsKey(key))
            {
                info.cached_results_reused++;
                return(new_test_results[key]);
            }

            info.modes_tested++;
            float utility = Helpers.GetCombinedUtility(Helpers.TestCalibrationMode(data_set, mode));

            new_test_results.Add(key, utility);

            return(utility);
        }
예제 #2
0
    /// <summary>
    /// Gets the arguements from the handler to set the progress indicator.
    /// </summary>
    /// <param name="args">The args.</param>
    private void ImportHandler(ImportProgressArgs args)
    {
        //ImportManager importManager = Page.Session["testimportManager"] as ImportManager;
        TestResultsInfo    testResultInfo = GetTestResultInfo();
        RadProgressContext importProgress = RadProgressContext.Current;

        importProgress["PrimaryPercent"] = Convert.ToString(Math.Round(Decimal.Divide(args.ProcessedCount, args.RecordCount) * 100));
        importProgress["PrimaryValue"]   = String.Format("({0})", args.ProcessedCount);
        importProgress["PrimaryTotal"]   = String.Format("({0})", args.RecordCount);
        //importProgress["SecondaryTotal"] = String.Format("{0}   Duplicates:{1}", args.ErrorCount, args.DuplicateCount);
        importProgress["ProcessCompleted"]   = "False";
        testResultInfo.TotalRecords          = args.RecordCount.ToString();
        testResultInfo.TotalRecordsProcessed = args.ProcessedCount.ToString();
        testResultInfo.TotalDuplicates       = args.DuplicateCount.ToString();
        testResultInfo.TotalWarnings         = args.WarningCount.ToString();
        testResultInfo.TotalTotalMerged      = args.MergeCount.ToString();
        testResultInfo.TotalErrors           = args.ErrorCount.ToString();
        try
        {
            if (args.RecordCount == 0)
            {
                testResultInfo.ProjectedDuplicateRate = string.Format("{0:P}", 0);
            }
            else
            {
                testResultInfo.ProjectedDuplicateRate = string.Format("{0:P}", Decimal.Divide(args.DuplicateCount, args.RecordCount));
            }
        }
        catch (Exception)
        {
        }
        SaveTestResultInfo(testResultInfo);
        LoadResults();
    }
예제 #3
0
    /// <summary>
    /// Loads the results.
    /// </summary>
    private void LoadResults()
    {
        TestResultsInfo testResultInfo = GetTestResultInfo();

        txtTotalRecordsProcessed.Text = testResultInfo.TotalRecordsProcessed;
        txtTotalDuplicates.Text       = testResultInfo.TotalDuplicates;
        txtProjectedDuplicates.Text   = testResultInfo.ProjectedDuplicateRate;
    }
예제 #4
0
    private TestResultsInfo GetTestResultInfo()
    {
        TestResultsInfo testInfo = ContextService.GetContext("TestResultsInfo") as TestResultsInfo;

        if (testInfo == null)
        {
            testInfo = new TestResultsInfo();
        }
        return(testInfo);
    }
 private void SaveTestResultInfo(TestResultsInfo  testResultInfo)
 {
     ContextService.SetContext("TestResultsInfo", testResultInfo);
 }
    private TestResultsInfo GetTestResultInfo()
    {
        TestResultsInfo testInfo = ContextService.GetContext("TestResultsInfo") as TestResultsInfo;
           if (testInfo == null)
           {
           testInfo = new TestResultsInfo();

           }
           return testInfo;
    }
예제 #7
0
        List <UtilityAndModePair> FindNeighbourExtremums(
            eye_tracking_mouse.Options.CalibrationMode starting_mode,
            List <CalibrationModeIterator.OptionsField> options_to_iterate)
        {
            TestResultsInfo test_results_info = new TestResultsInfo {
                cached_results_reused = 0, modes_tested = 0
            };
            int i_max = options_to_iterate[0].Range.Length;
            int j_max = options_to_iterate[1].Range.Length;
            int k_max = options_to_iterate[2].Range.Length;

            Debug.Assert(options_to_iterate.Count == 3);
            var test_results = new UtilityAndModePair[i_max, j_max, k_max];

            for (int i = 0; i < i_max; i++)
            {
                for (int j = 0; j < j_max; j++)
                {
                    for (int k = 0; k < k_max; k++)
                    {
                        var mode = starting_mode.Clone();
                        options_to_iterate[0].SetFieldValue(mode, options_to_iterate[0].Range[i]);
                        options_to_iterate[1].SetFieldValue(mode, options_to_iterate[1].Range[j]);
                        options_to_iterate[2].SetFieldValue(mode, options_to_iterate[2].Range[k]);

                        cancellation_token.ThrowIfCancellationRequested();
                        test_results[i, j, k] =
                            new UtilityAndModePair(
                                Helpers.TestCalibrationMode(data_points, mode).UtilityFunction,
                                mode);
                        test_results_info.modes_tested++;
                    }
                }
            }

            test_results_info_callback(test_results_info);

            HashSet <int>             non_extremum_indexes = new HashSet <int>();
            List <UtilityAndModePair> extremums            = new List <UtilityAndModePair>();

            for (int i = 0; i < i_max; i++)
            {
                for (int j = 0; j < j_max; j++)
                {
                    for (int k = 0; k < k_max; k++)
                    {
                        bool is_extremum = true;
                        if (non_extremum_indexes.Contains(ConvertIndexesToSingleInt(i, j, k, i_max, j_max)))
                        {
                            is_extremum = false;
                        }


                        // n means neighbor
                        for (int n_i = Math.Max(0, i - 1); n_i <= i + 1 && n_i < i_max; n_i++)
                        {
                            for (int n_j = Math.Max(0, j - 1); n_j <= j + 1 && n_j < j_max; n_j++)
                            {
                                for (int n_k = Math.Max(0, k - 1); n_k <= k + 1 && n_k < k_max; n_k++)
                                {
                                    if (i == n_i && j == n_j && k == n_k)
                                    {
                                        continue;
                                    }
                                    if (test_results[i, j, k].utility < test_results[n_i, n_j, n_k].utility)
                                    {
                                        is_extremum = false;
                                    }
                                    else if (test_results[i, j, k].utility == test_results[n_i, n_j, n_k].utility)
                                    {
                                        non_extremum_indexes.Add(ConvertIndexesToSingleInt(
                                                                     n_i,
                                                                     n_j,
                                                                     n_k,
                                                                     i_max,
                                                                     j_max));
                                    }
                                }
                            }
                        }

                        if (is_extremum)
                        {
                            extremums.Add(test_results[i, j, k]);
                        }
                    }
                }
            }

            return(extremums);
        }
예제 #8
0
 private void SaveTestResultInfo(TestResultsInfo testResultInfo)
 {
     ContextService.SetContext("TestResultsInfo", testResultInfo);
 }