internal OptimizationView(AlgorithmOptimization AO) { InitializeComponent(); Text = "Оптимизация " + AO.algorithm.h.nodes[1].getValue(); this.AO = AO; }
public void algorithmOptimization() { expert = new Expert("Эксперт 1", this); mainThread = System.Threading.Thread.CurrentThread; sourceDataFile = pathPrefix + @"Временные ряды\BTC_USD_exmo.txt"; var dataset_file = expert.savePreparedDataset(sourceDataFile, "<symbol_time>;<server_time>;<TIME>;<DATE>;<local_time>;<TICKER>;<PER>;<DATEandTIME>;<DATE_TIME>;\"\"", true); algorithm = new Easy(this, "Easy"); // algorithm.h.addVariable(0, "learning_rate", 0.00001, 0.002, 0.003, 0.0017); algorithm.h.addVariable(0, "window_size", 10, 300, 3, 50); algorithm.h.addVariable(0, "number_of_epochs", 1, 80, 5, 47); algorithm.h.setValueByName("learning_rate", "0.0017"); // algorithm.h.setValueByName( "window_size","14"); // algorithm.h.setValueByName("number_of_epochs", "5"); algorithm.h.setValueByName("split_point", "0.9"); algorithm.h.setValueByName("steps_forward", "10"); algorithm.h.setValueByName("start_point", "0"); algorithm.h.setValueByName("normalize", "true"); //algorithm.h.add("input_file", dataset_file); algorithm.h.add("input_file", pathPrefix + @"Временные ряды\BTC_USD_exmo-dataset.txt"); algorithm.h.add("path_prefix", pathPrefix); algorithm.h.add("predicted_column_index:0"); algorithm.h.setValueByName("show_train_charts", "True"); // MyAlgorithmOptimization MAO = new MyAlgorithmOptimization(this, algorithm); // MAO.run(); // algorithm.train(); ///////////////////////////////////////////////////////////// // АНСАМБЛИРОВАНИЕ /* Ensemble ensemble = new Ensemble(this); * //ensemble.algorithms.Add((new Easy(this, "Easy[0]").Open(@"E:\Anton\Desktop\MAIN\Экспертная система\Экспертная система\Алгоритмы прогнозирования\Easy\h.json"))); * ensemble.algorithms.Add((new Easy(this, "Easy[0]").Open(@"E:\Anton\Desktop\MAIN\Optimization\Easy\Easy[0]\h.json"))); * // ensemble.algorithms.Add((new Easy(this, "Easy[1]").Open(@"E:\Anton\Desktop\MAIN\Optimization\Easy\Easy[1]\h.json"))); * // ensemble.algorithms.Add((new Easy(this, "Easy[3]").Open(@"E:\Anton\Desktop\MAIN\Optimization\Easy\Easy[3]\h.json"))); * // ensemble.algorithms.Add((new Easy(this, "Easy[2]").Open(@"E:\Anton\Desktop\MAIN\Optimization\Easy\Easy[2]\h.json"))); * // ensemble.algorithms.Add((new Easy(this, "Easy[5]").Open(@"E:\Anton\Desktop\MAIN\Optimization\Easy\Easy[5]\h.json"))); * * // ensemble.cyclicPrediction(true); * ensemble.stepByStepPrediction();*/ ///////////////////////////////////////////////////////////// /// /// // I.executePythonScript(pathPrefix + @"\Экспертная система\Экспертная система\Алгоритмы прогнозирования\Easy\cyclic_prediction.py", "--json_file_path \"" + pathPrefix + @"\Optimization\Easy\Easy[0]\h.json" + '\"'); // I.executePythonScript(pathPrefix + @"\Экспертная система\Экспертная система\Алгоритмы прогнозирования\Easy\cyclic_prediction.py", "--json_file_path \"" + pathPrefix + @"\Экспертная система\Экспертная система\Алгоритмы прогнозирования\Easy\h.json" + '\"'); // algorithm.h.setValueByName("show_train_charts", "True"); // algorithm.getAccAndStdDev(File.ReadAllLines(@"E:\Anton\Desktop\MAIN\Optimization\Easy\Easy[0]\predictions.txt")); // algorithm.getAccAndStdDev(File.ReadAllLines(pathPrefix + @"\Optimization\Easy\Easy[0]\cyclic_prediction.txt")); // vis.enableGrid = true; // vis.addCSV(@"E:\Anton\Desktop\MAIN\Экспертная система\Экспертная система\Алгоритмы прогнозирования\Easy\cyclic_prediction.txt", "\"MT_250\"", "\"MT_250\"", "r", 1000, 0, 0); // vis.addCSV(@"E:\Anton\Desktop\MAIN\Экспертная система\Экспертная система\Алгоритмы прогнозирования\Easy\cyclic_prediction.txt", "\"MT_250\"", "(predicted -> )\"MT_250\"", "pred", 1000, 0, 0); // vis.addCSV(@"E:\Anton\Desktop\MAIN\Экспертная система\Экспертная система\Алгоритмы прогнозирования\Easy\predictions.txt", "realVSpredictions", "MT_250", "real", 1000, 0.95, 0); // vis.addCSV(@"E:\Anton\Desktop\MAIN\Экспертная система\Экспертная система\Алгоритмы прогнозирования\Easy\predictions.txt", "realVSpredictions", "LAST_COLUMN", "predictions", 1000, 0.95, 0); AO = new AlgorithmOptimization(algorithm, this, population_value: 16, mutation_rate: 16, architecture_variation_rate: 0, elite_ratio: 0.25, iterarions: 500, test_count: 1, AlgorithmOptimization.TargetFunctionType.STDDEV); AO.run(); // algorithm.h.draw(0, picBox, 25, 300); // algorithm.Save(); /* algorithm = new BidAsk(this, "BidAsk"); * algorithm.getAccAndStdDev(File.ReadAllLines(@"E:\Anton\Desktop\MAIN\Экспертная система\Экспертная система\Алгоритмы прогнозирования\BidAsk\predictions.txt")); * // algorithm.Open(@"E:\Anton\Desktop\MAIN\Optimization\BidAsk\BidAsk[0]\h.json"); * * //<DATE_TIME>;<bid_top>;<bid_quantity>;<bid_amount>;<ask_top>;<ask_quantity>;<ask_amount> * * /* sourceDataFile = pathPrefix + @"Временные ряды\BTC_USD_exmo.txt"; * expert.H.add("input_file", expert.savePreparedDataset(sourceDataFile, "<symbol_time>;<server_time>;<TIME>;<DATE>;<local_time>;<TICKER>;<PER>;<DATEandTIME>;<DATE_TIME>", true)); * * Expert.addSpread(pathPrefix + @"Временные ряды\BTC_USD_exmo-dataset.txt", sourceDataFile);*/ /* algorithm.h.setValueByName("bid_column_index", "0"); * algorithm.h.setValueByName("ask_column_index", "3"); * * algorithm.h.setValueByName("start_point", "0"); * algorithm.h.setValueByName("normalize", "true"); * algorithm.h.add("input_file", pathPrefix + @"Временные ряды\BTC_USD_exmo-dataset.txt"); * algorithm.h.add("path_prefix", pathPrefix); * algorithm.h.add("predicted_column_index:3"); * algorithm.h.setValueByName("show_train_charts", "True"); * * algorithm.train().Wait(); */ vis.refresh(); }