Esempio n. 1
0
        // CALCULATING MINIMAL ERROR OF EXAMPLE BANK
        public string CalcMinError(string tmpString)
        {
            // CHECKING EXAMPLES
            Examples tmpExamples = Examples.Init();

            if (tmpExamples.SayExamplesNum() == 0)
            {
                return("\n-> Error calculating minimal examples error - they don't exist.");
            }

            tmpString = tmpString.Trim();

            string result;

            if (tmpString.Length == 0)
            {
                result = tmpExamples.CalcMinError(tmpExamples.GiveTrainExamples(), out float minError, true);
                if (result.Length > 0)
                {
                    return(result);
                }
            }
            else
            {
                int  testExamples = -1;
                bool isLast       = true;

                result = Parsing.ParseInt(ref tmpString, ref testExamples, ref isLast, "showDetails", Parsing.AfterParsingCheck.NonNegative);
                if (result.Length > 0)
                {
                    return(result);
                }

                bool trainTest = testExamples == 0 ? false : true;

                if (trainTest)
                {
                    result = tmpExamples.CalcMinError(tmpExamples.GiveTestExamples(), out float minError);
                    if (result.Length > 0)
                    {
                        return(result);
                    }
                }
                else
                {
                    result = tmpExamples.CalcMinError(tmpExamples.GiveTrainExamples(), out float minError);
                    if (result.Length > 0)
                    {
                        return(result);
                    }
                }
            }

            return("");
        }