Exemple #1
0
        private void EvalDifference()
        {
            Evaluated = true;

            // get each class SoFs in this split
            // and keep min and max
            int classSof = 0;

            if (ClassIndex == -1)
            {
                classSof = Split.GlobalSof;
            }
            else
            {
                classSof = Split.GetClassSof(ClassIndex);
            }
            int min = classSof;

            MaxSofInSplit = Split.GetMaxClassSof(ClassIndex); // max of other classes
            if (MaxSofInSplit == 0)
            {
                MaxSofInSplit = classSof;
            }
            // -->

            // exit if 0
            if (min == 0 && MaxSofInSplit == 0)
            {
                Evaluated = false; // we can not eval that
                return;
            }
            // -->


            double referencesof = classSof;

            if (classSof == 0)
            {
                referencesof = min;
            }
            ClassSof = Convert.ToInt32(referencesof);
            // -->

            // difference in % between min and max

            double a = referencesof;
            double b = MaxSofInSplit;

            if (a == 0 || b == 0)
            {
                PercentDifference = 0;
                return;
            }


            int diff = 100 - Convert.ToInt32(Math.Round(100 * a / b));

            diff = Math.Max(diff, 0);
            PercentDifference = diff;
            // -->
        }