internal static List<double> NormalizedInputForMemoryLearning(StarterInfo si, int ppCount)
        {
            var input = new List<double>();

            if (si.CountPreceding >= ppCount)
            {
                si.GetPreviousPerformances(ppCount).ToList().ForEach(si2 => input.Add(si2.GoldenFigure));

                double min = input.Min();
                double max = input.Max();

                for (int i = 0; i < input.Count; ++i)
                {
                    input[i] = (input[i] - min) / max;
                }

                PopulateNormalizedDataForMemoryLearning(si, input, ppCount);
                input.Add(NormalizeDaysOff(si));
                input.Add(NormalizePostPosition(si));
                input.Add(NormalizeDistance(si));
                input.Add(NormalizeBoolean(si.RestrictedToFemalesOnly));
                input.Add(NormalizeBoolean(si.RestrictedToStateBredsOnly));
                input.Add(NormalizeBoolean(si.WasClaimed));
                input.Add(NormalizeBoolean(si.BlinkersOff));
                input.Add(NormalizeBoolean(si.FirstTimeLasix));
                input.Add(NormalizeBoolean(si.RestrictedToTwoYearsOnly));
                input.Add(NormalizeBoolean(si.RestrictedToThreeYearsOnly));
                double desiredValue = si.GoldenFigure > max ? 1.0 : 0.0;
                input.Add(desiredValue);
            }

            return input;
        }
 internal static List<double> NormalizedInputForImprovementDetection(StarterInfo si, int ppCount)
 {
     var input = new List<double>();
     var gf = new List<double>();
     si.GetPreviousPerformances(ppCount).ToList().ForEach(si2 => gf.Add(si2.GoldenFigure));
     double min = gf.Min();
     double max = gf.Max();
     PopulateNormalizedData(si, input, min, max, ppCount);
     input.Add(NormalizeDaysOff(si));
     input.Add(NormalizePostPosition(si));
     input.Add(NormalizeDistance(si));
     return input;
 }
 private static void PopulateNormalizedDataForMemoryLearning(StarterInfo starterInfo, List<double> input, int count)
 {
     starterInfo.GetPreviousPerformances(count).ToList().ForEach(
                     si =>
                     {
                         input.Add(NormalizeTrackCondition(si));
                         input.Add(NormalizeOdds(si));
                         input.Add(NormalizeDistance(si));
                         input.Add(NormalizePosition(si.FinishPosition));
                         input.Add(NormalizePosition(si.SecondCallPosition));
                         input.Add(NormalizeDaysOff(si));
                         input.Add(NormalizeRaceType(si));
                         input.Add(NormalizePostPosition(si));
                         input.Add(NormalizeBoolean(si.RestrictedToFemalesOnly));
                         input.Add(NormalizeBoolean(si.RestrictedToStateBredsOnly));
                         input.Add(NormalizeBoolean(si.WasClaimed));
                         input.Add(NormalizeBoolean(si.BlinkersOff));
                         input.Add(NormalizeBoolean(si.FirstTimeLasix));
                         input.Add(NormalizeBoolean(si.RestrictedToTwoYearsOnly));
                         input.Add(NormalizeBoolean(si.RestrictedToThreeYearsOnly));
                     });
 }
        private static void PopulateNormalizedData(StarterInfo starterInfo, List<double> normalizedData, double min, double max, double average, int count)
        {
            starterInfo.GetPreviousPerformances(count).ToList().ForEach(
                si =>
                {
                    normalizedData.Add(NormalizeGoldenFigure(si.GoldenFigure, min, max, average));
                   // normalizedData.Add(NormalizeGoldenFigure(si.WinnersGoldenFigure, min, max, average));
                    normalizedData.Add(NormalizeTrackCondition(si));
                   // normalizedData.Add(NormalizeOdds(si));
                    normalizedData.Add(NormalizeDistance(si));
                    //normalizedData.Add(NormalizePosition(si.FinishPosition));

                    /*
                    normalizedData.Add(NormalizePosition(si.SecondCallPosition));
                    normalizedData.Add(NormalizeDaysOff(si));
                    normalizedData.Add(NormalizeRaceType(si));
                    normalizedData.Add(NormalizePostPosition(si));

                   normalizedData.Add(NormalizeBoolean(si.RestrictedToFemalesOnly));
                   normalizedData.Add(NormalizeBoolean(si.RestrictedToStateBredsOnly));
                   normalizedData.Add(NormalizeBoolean(si.WasClaimed));
                   normalizedData.Add(NormalizeBoolean(si.BlinkersOff));
                   normalizedData.Add(NormalizeBoolean(si.FirstTimeLasix));
                   normalizedData.Add(NormalizeBoolean(si.RestrictedToTwoYearsOnly));
                   normalizedData.Add(NormalizeBoolean(si.RestrictedToThreeYearsOnly));
                    */
                });
        }
        internal static List<double> NormalizedInputToChooseBetweenFirstAndSecondFavorite(StarterInfo favorite, StarterInfo secondFavorite, StarterInfo thirdFavorite, int ppCount)
        {
            var input = new List<double>();
            var gf = new List<double>();
            favorite.GetPreviousPerformances(ppCount).ToList().ForEach(si => gf.Add(si.GoldenFigure));
               // favorite.GetPreviousPerformances(ppCount).ToList().ForEach(si => gf.Add(si.WinnersGoldenFigure));
            secondFavorite.GetPreviousPerformances(ppCount).ToList().ForEach(si => gf.Add(si.GoldenFigure));
            //secondFavorite.GetPreviousPerformances(ppCount).ToList().ForEach(si => gf.Add(si.WinnersGoldenFigure));

            thirdFavorite.GetPreviousPerformances(ppCount).ToList().ForEach(si => gf.Add(si.GoldenFigure));
            double min = gf.Min();
            double max = gf.Max();
            PopulateNormalizedData(favorite, input, min, max, gf.Average(),ppCount);
            PopulateNormalizedData(secondFavorite, input, min, max, gf.Average(), ppCount);
            PopulateNormalizedData(thirdFavorite, input, min, max, gf.Average(), ppCount);

            input.Add(NormalizeDaysOff(favorite));
            input.Add(NormalizeDaysOff(secondFavorite));
            input.Add(NormalizeDaysOff(thirdFavorite));

            //input.Add(NormalizeOdds(favorite));
            //input.Add(NormalizeOdds(secondFavorite));
            //input.Add(NormalizeOdds(thirdFavorite));

            //input.Add(NormalizePostPosition(favorite));
            //input.Add(NormalizePostPosition(secondFavorite));
            //input.Add(NormalizePostPosition(thirdFavorite));
            //input.Add(NormalizeDistance(favorite));
            return input;
        }