예제 #1
0
        public int ComputeProbabilisticDestinationFloor(int currentFloor, int floorBound)
        {
            double[] distrib = new double[floorBound + 1];
            ProbabilityHelper.SetUniformDistribution(distrib);
            int expected = currentFloor + RelativeFloor;

            if (expected <= floorBound && expected >= 0)
            {
                distrib[expected] = SuccessProb;
                ProbabilityHelper.NormalizePdf(distrib, 0);
            }
            ProbabilityHelper.PdfToCdf(distrib);
            return(ProbabilityHelper.Sample(distrib));
        }
예제 #2
0
파일: Camera.cs 프로젝트: Hazuwall/Courier
        /// <summary>
        /// Получить вероятностный индекс класса по распределению из матрицы ошибок
        /// </summary>
        /// <param name="trueClassName">Истинное название класса</param>
        /// <returns></returns>
        public int GetProbabalisticClassIndex(string trueClassName)
        {
            int trueClassIndex = Array.IndexOf(KnownClasses, trueClassName);

            if (trueClassIndex == -1)
            {
                trueClassIndex = Array.IndexOf(KnownClasses, ModelBase.UnknownClassName);
            }

            double[] distrib = new double[KnownClasses.Length];
            for (int i = 0; i < KnownClasses.Length; i++)
            {
                distrib[i] = ConfusionMatrix[trueClassIndex, i];
            }
            ProbabilityHelper.NormalizePdf(distrib, 0);
            ProbabilityHelper.PdfToCdf(distrib);
            return(ProbabilityHelper.Sample(distrib));
        }