Exemplo n.º 1
0
        private static void CreateEvaluationSet(string @fileName)
        {
            List <double>     Opens          = SuperUtils.QuickParseCSV(fileName, "Open", 1200, 1200);
            List <double>     High           = NetworkUtility.QuickParseCSV(fileName, "High", 1200, 1200);
            List <double>     Low            = NetworkUtility.QuickParseCSV(fileName, "Low", 1200, 1200);
            List <double>     Close          = NetworkUtility.QuickParseCSV(fileName, "Close", 1200, 1200);
            List <double>     Volume         = NetworkUtility.QuickParseCSV(fileName, 5, 1200, 1200);
            TemporalMLDataSet superTemportal = new TemporalMLDataSet(100, 1);

            double[] Ranges = NetworkUtility.CalculateRanges(Opens.ToArray(), Close.ToArray());

            superTemportal = NetworkUtility.GenerateTrainingWithPercentChangeOnSerie(100, 1, Opens.ToArray(),
                                                                                     Close.ToArray(), High.ToArray(), Low.ToArray(), Volume.ToArray());

            IMLDataPair        aPairInput  = SuperUtils.ProcessPair(NetworkUtility.CalculatePercents(Opens.ToArray()), NetworkUtility.CalculatePercents(Opens.ToArray()), 100, 1);
            IMLDataPair        aPairInput3 = SuperUtils.ProcessPair(NetworkUtility.CalculatePercents(Close.ToArray()), NetworkUtility.CalculatePercents(Close.ToArray()), 100, 1);
            IMLDataPair        aPairInput2 = SuperUtils.ProcessPair(NetworkUtility.CalculatePercents(High.ToArray()), NetworkUtility.CalculatePercents(High.ToArray()), 100, 1);
            IMLDataPair        aPairInput4 = SuperUtils.ProcessPair(NetworkUtility.CalculatePercents(Volume.ToArray()), NetworkUtility.CalculatePercents(Volume.ToArray()), 100, 1);
            IMLDataPair        aPairInput5 = SuperUtils.ProcessPair(NetworkUtility.CalculatePercents(Ranges.ToArray()), NetworkUtility.CalculatePercents(Ranges.ToArray()), 100, 1);
            List <IMLDataPair> listData    = new List <IMLDataPair>();

            listData.Add(aPairInput);
            listData.Add(aPairInput2);
            listData.Add(aPairInput3);
            listData.Add(aPairInput4);
            listData.Add((aPairInput5));


            var minitrainning = new BasicMLDataSet(listData);

            var    network           = (BasicNetwork)CreateElmanNetwork(100, 1);
            double normalCorrectRate = EvaluateNetworks(network, minitrainning);

            double temporalErrorRate = EvaluateNetworks(network, superTemportal);

            Console.WriteLine("Percent Correct with normal Data Set:" + normalCorrectRate + " Percent Correct with temporal Dataset:" +
                              temporalErrorRate);



            Console.WriteLine("Paused , Press a key to continue to evaluation");
            Console.ReadKey();
        }
Exemplo n.º 2
0
        public static BasicMLDataSet CreateEvaluationSetAndLoad(string @fileName, int startLine, int HowMany, int WindowSize, int outputsize)
        {
            List <double> Opens  = NetworkUtility.QuickParseCSV(fileName, "Open", startLine, HowMany);
            List <double> High   = NetworkUtility.QuickParseCSV(fileName, "High", startLine, HowMany);
            List <double> Low    = NetworkUtility.QuickParseCSV(fileName, "Low", startLine, HowMany);
            List <double> Close  = NetworkUtility.QuickParseCSV(fileName, "Close", startLine, HowMany);
            List <double> Volume = NetworkUtility.QuickParseCSV(fileName, 5, startLine, HowMany);


            TemporalMLDataSet superTemportal = new TemporalMLDataSet(WindowSize, outputsize);

            double[] Ranges = NetworkUtility.CalculateRanges(Opens.ToArray(), Close.ToArray());



            superTemportal = NetworkUtility.GenerateTrainingWithPercentChangeOnSerie(100, 1, Opens.ToArray(),
                                                                                     Close.ToArray(), High.ToArray(), Low.ToArray(), Volume.ToArray());

            IMLDataPair        aPairInput  = SuperUtils.ProcessPair(NetworkUtility.CalculatePercents(Opens.ToArray()), NetworkUtility.CalculatePercents(Opens.ToArray()), WindowSize, outputsize);
            IMLDataPair        aPairInput3 = SuperUtils.ProcessPair(NetworkUtility.CalculatePercents(Close.ToArray()), NetworkUtility.CalculatePercents(Close.ToArray()), WindowSize, outputsize);
            IMLDataPair        aPairInput2 = SuperUtils.ProcessPair(NetworkUtility.CalculatePercents(High.ToArray()), NetworkUtility.CalculatePercents(High.ToArray()), WindowSize, outputsize);
            IMLDataPair        aPairInput4 = SuperUtils.ProcessPair(NetworkUtility.CalculatePercents(Volume.ToArray()), NetworkUtility.CalculatePercents(Volume.ToArray()), WindowSize, outputsize);
            IMLDataPair        aPairInput5 = SuperUtils.ProcessPair(NetworkUtility.CalculatePercents(Ranges.ToArray()), NetworkUtility.CalculatePercents(Ranges.ToArray()), WindowSize, outputsize);
            List <IMLDataPair> listData    = new List <IMLDataPair>();

            listData.Add(aPairInput);
            listData.Add(aPairInput2);
            listData.Add(aPairInput3);
            listData.Add(aPairInput4);
            listData.Add((aPairInput5));


            var minitrainning = new BasicMLDataSet(listData);

            return(minitrainning);
        }