public static BasicMLDataSet CreateEvaluationSetAndLoad(string @fileName, int startLine, int HowMany, int WindowSize, int outputsize) { List <double> Opens = QuickCSVUtils.QuickParseCSV(fileName, "Open", startLine, HowMany); List <double> High = QuickCSVUtils.QuickParseCSV(fileName, "High", startLine, HowMany); // List<double> Low = QuickCSVUtils.QuickParseCSV(fileName, "Low", startLine, HowMany); List <double> Close = QuickCSVUtils.QuickParseCSV(fileName, "Close", startLine, HowMany); List <double> Volume = QuickCSVUtils.QuickParseCSV(fileName, 5, startLine, HowMany); double[] Ranges = NetworkUtility.CalculateRanges(Opens.ToArray(), Close.ToArray()); IMLDataPair aPairInput = TrainerHelper.ProcessPairs(NetworkUtility.CalculatePercents(Opens.ToArray()), NetworkUtility.CalculatePercents(Opens.ToArray()), WindowSize, outputsize); IMLDataPair aPairInput3 = TrainerHelper.ProcessPairs(NetworkUtility.CalculatePercents(Close.ToArray()), NetworkUtility.CalculatePercents(Close.ToArray()), WindowSize, outputsize); IMLDataPair aPairInput2 = TrainerHelper.ProcessPairs(NetworkUtility.CalculatePercents(High.ToArray()), NetworkUtility.CalculatePercents(High.ToArray()), WindowSize, outputsize); IMLDataPair aPairInput4 = TrainerHelper.ProcessPairs(NetworkUtility.CalculatePercents(Volume.ToArray()), NetworkUtility.CalculatePercents(Volume.ToArray()), WindowSize, outputsize); IMLDataPair aPairInput5 = TrainerHelper.ProcessPairs(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); }
// ReSharper disable UnusedMember.Local private static void CreateEvaluationSet(string @fileName) // ReSharper restore UnusedMember.Local { List <double> Opens = QuickCSVUtils.QuickParseCSV(fileName, "Open", 1200, 1200); List <double> High = QuickCSVUtils.QuickParseCSV(fileName, "High", 1200, 1200); List <double> Low = QuickCSVUtils.QuickParseCSV(fileName, "Low", 1200, 1200); List <double> Close = QuickCSVUtils.QuickParseCSV(fileName, "Close", 1200, 1200); List <double> Volume = QuickCSVUtils.QuickParseCSV(fileName, 5, 1200, 1200); double[] Ranges = NetworkUtility.CalculateRanges(Opens.ToArray(), Close.ToArray()); TemporalMLDataSet superTemportal = TrainerHelper.GenerateTrainingWithPercentChangeOnSerie(100, 1, Opens.ToArray(), Close.ToArray(), High.ToArray(), Low.ToArray(), Volume.ToArray()); IMLDataPair aPairInput = TrainerHelper.ProcessPairs(NetworkUtility.CalculatePercents(Opens.ToArray()), NetworkUtility.CalculatePercents(Opens.ToArray()), 100, 1); IMLDataPair aPairInput3 = TrainerHelper.ProcessPairs(NetworkUtility.CalculatePercents(Close.ToArray()), NetworkUtility.CalculatePercents(Close.ToArray()), 100, 1); IMLDataPair aPairInput2 = TrainerHelper.ProcessPairs(NetworkUtility.CalculatePercents(High.ToArray()), NetworkUtility.CalculatePercents(High.ToArray()), 100, 1); IMLDataPair aPairInput4 = TrainerHelper.ProcessPairs(NetworkUtility.CalculatePercents(Volume.ToArray()), NetworkUtility.CalculatePercents(Volume.ToArray()), 100, 1); IMLDataPair aPairInput5 = TrainerHelper.ProcessPairs(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(); }
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); }