├── .gitignore ├── LICENSE ├── abfols_elm_script.py ├── data ├── formatted │ ├── draw_data.py │ ├── handle_data.py │ └── results │ │ ├── cpu_ram.pdf │ │ ├── google_cpu_5m.pdf │ │ ├── google_ram_5m.pdf │ │ ├── internet_traffic_eu_5m.pdf │ │ ├── internet_traffic_uk_5m.pdf │ │ └── worldcup98_5m.pdf └── note.md ├── de_elm_script.py ├── drafts ├── draw │ ├── draw_3d_barchart.py │ ├── draw_3d_barchart2.py │ ├── draw_error_full.py │ ├── draw_errors.py │ ├── draw_paper_bfo.py │ ├── draw_pred_full.py │ ├── draw_spider_chart.py │ ├── draw_spider_chart2.py │ ├── draw_spider_chart3.py │ ├── draw_spider_chart4.py │ ├── draw_spider_chart_final.py │ ├── draw_spider_chart_final2.py │ ├── error_eu_SL2.csv │ ├── error_eu_SL5.csv │ ├── error_uk_SL2.csv │ ├── error_uk_SL5.csv │ ├── hehe.png │ ├── img │ │ ├── abfo_elm_sl2.pdf │ │ ├── abfo_elm_sl5.pdf │ │ ├── de_elm_sl2.pdf │ │ ├── de_elm_sl5.pdf │ │ ├── elm_sl2.pdf │ │ ├── elm_sl5.pdf │ │ ├── error_eu_SL2.pdf │ │ ├── error_eu_SL5.pdf │ │ ├── error_uk_SL2.pdf │ │ ├── error_uk_SL5.pdf │ │ ├── ga_elm_sl2.pdf │ │ ├── ga_elm_sl5.pdf │ │ ├── mlnn_sl2.pdf │ │ ├── mlnn_sl5.pdf │ │ ├── otwo_elm_sl2.pdf │ │ ├── otwo_elm_sl5.pdf │ │ ├── pso_elm_sl2.pdf │ │ ├── pso_elm_sl5.pdf │ │ ├── two_elm_sl2.pdf │ │ └── two_elm_sl5.pdf │ ├── k2k5.png │ ├── models.png │ ├── myplot2.png │ ├── new │ │ ├── 1otwo_elm_eu_sl5.eps │ │ ├── 1otwo_elm_eu_sl5.jpg │ │ ├── 1otwo_elm_eu_sl5.pdf │ │ ├── 1otwo_elm_eu_sl5.png │ │ ├── 2otwo_elm_eu_sl5.eps │ │ ├── 2otwo_elm_eu_sl5.jpg │ │ ├── 2otwo_elm_eu_sl5.pdf │ │ ├── 2otwo_elm_eu_sl5.png │ │ ├── 3otwo_elm_eu_sl5.eps │ │ ├── 3otwo_elm_eu_sl5.jpg │ │ ├── 3otwo_elm_eu_sl5.pdf │ │ ├── 3otwo_elm_eu_sl5.png │ │ ├── 4otwo_elm_eu_sl2.eps │ │ ├── 4otwo_elm_eu_sl2.jpg │ │ ├── 4otwo_elm_eu_sl2.pdf │ │ ├── 4otwo_elm_eu_sl2.png │ │ ├── 4otwo_elm_eu_sl5.eps │ │ ├── 4otwo_elm_eu_sl5.jpg │ │ ├── 4otwo_elm_eu_sl5.pdf │ │ ├── 4otwo_elm_eu_sl5.png │ │ ├── 4otwo_elm_uk_sl2.eps │ │ ├── 4otwo_elm_uk_sl2.jpg │ │ ├── 4otwo_elm_uk_sl2.pdf │ │ ├── 4otwo_elm_uk_sl2.png │ │ ├── 4otwo_elm_uk_sl5.eps │ │ ├── 4otwo_elm_uk_sl5.jpg │ │ ├── 4otwo_elm_uk_sl5.pdf │ │ ├── 4otwo_elm_uk_sl5.png │ │ ├── otwo_elm_eu_sl5.eps │ │ ├── otwo_elm_eu_sl5.jpg │ │ ├── otwo_elm_eu_sl5.pdf │ │ └── otwo_elm_eu_sl5.png │ ├── pred_eu_SL2.csv │ ├── pred_eu_SL5.csv │ ├── pred_uk_SL2.csv │ └── pred_uk_SL5.csv └── images │ └── code │ ├── BFO.png │ ├── CRO.png │ ├── DE.png │ ├── GA.png │ ├── PSO.png │ ├── all_code_fit.pdf │ ├── all_code_fit.svg │ ├── all_code_wrapper.pdf │ ├── all_code_wrapper.png │ ├── all_code_wrapper.svg │ ├── hybrid_mlnn.png │ ├── neural_network.png │ ├── root_ann.png │ ├── root_hybrid_mlnn.png │ └── root_rnn.png ├── elm_script.py ├── envs ├── environment.yml └── readme_first.md ├── ga_elm_script.py ├── mlnn1hl_script.py ├── model ├── main │ ├── hybrid_elm.py │ ├── traditional_elm.py │ ├── traditional_ffnn.py │ └── traditional_rnn.py └── root │ ├── hybrid │ └── root_hybrid_elm.py │ ├── root_base.py │ └── traditional │ ├── root_elm.py │ ├── root_mlnn.py │ └── root_rnn.py ├── otwo_elm_script.py ├── project_note.md ├── pso_elm_script.py ├── readme.md ├── two_elm_script.py └── utils ├── GraphUtil.py ├── IOUtil.py ├── MathUtil.py ├── MeasureUtil.py ├── PreprocessingUtil.py └── SettingPaper.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | .idea/ 3 | data/raw/ 4 | 5 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 chasebk 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /abfols_elm_script.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 00:51, 29/03/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from os.path import splitext, basename, realpath 11 | from sklearn.model_selection import ParameterGrid 12 | from model.main.hybrid_elm import ABfoLSElm 13 | from utils.SettingPaper import abfols_elm_paras_final as param_grid 14 | from utils.SettingPaper import * 15 | from utils.IOUtil import load_dataset 16 | 17 | if SP_RUN_TIMES == 1: 18 | all_model_file_name = SP_LOG_FILENAME 19 | else: # If runs with more than 1, like stability test --> name of the models ==> such as: rnn1hl.csv 20 | all_model_file_name = str(splitext(basename(realpath(__file__)))[0]) 21 | 22 | 23 | def train_model(item): 24 | root_base_paras = { 25 | "dataset": dataset, 26 | "feature_size": feature_size, 27 | "data_idx": SP_DATA_SPLIT_INDEX_2, 28 | "sliding": item["sliding"], 29 | "multi_output": multi_output, 30 | "output_idx": output_index, 31 | "method_statistic": SP_PREPROCESSING_METHOD, 32 | "log_filename": all_model_file_name, 33 | "n_runs": SP_RUN_TIMES, # 1 or others 34 | "path_save_result": SP_PATH_SAVE_BASE + SP_DATA_FILENAME[loop] + "/", 35 | "draw": SP_DRAW, 36 | "print_train": SP_PRINT_TRAIN, # 0: nothing, 1 : full detail, 2: short version 37 | } 38 | paras_name = "hs_{}-ep_{}-act_{}-Ci_{}-Ped_{}-Ns_{}-N_minmax_{}".format(item["hidden_size"], item["epoch"], item["activation"], 39 | item["Ci"], item["Ped"], item["Ns"], item["N_minmax"]) 40 | root_hybrid_paras = { 41 | "hidden_size": item["hidden_size"], "activation": item["activation"], "epoch": item["epoch"], "domain_range": item["domain_range"], 42 | "paras_name": paras_name 43 | } 44 | abfols_paras = { 45 | "epoch": item["epoch"], "pop_size": item["pop_size"], "Ci": item["Ci"], "Ped": item["Ped"], "Ns": item["Ns"], "N_minmax": item["N_minmax"] 46 | } 47 | md = ABfoLSElm(root_base_paras=root_base_paras, root_hybrid_paras=root_hybrid_paras, abfols_paras=abfols_paras) 48 | md._running__() 49 | 50 | 51 | for _ in range(SP_RUN_TIMES): 52 | for loop in range(len(SP_DATA_FILENAME)): 53 | filename = SP_LOAD_DATA_FROM + SP_DATA_FILENAME[loop] 54 | dataset = load_dataset(filename, cols=SP_DATA_COLS[loop]) 55 | feature_size = len(SP_DATA_COLS[loop]) 56 | multi_output = SP_DATA_MULTI_OUTPUT[loop] 57 | output_index = SP_OUTPUT_INDEX[loop] 58 | # Create combination of params. 59 | for item in list(ParameterGrid(param_grid)): 60 | train_model(item) 61 | -------------------------------------------------------------------------------- /data/formatted/draw_data.py: -------------------------------------------------------------------------------- 1 | from utils.IOUtil import read_dataset_file 2 | from matplotlib.ticker import FuncFormatter 3 | import matplotlib.pyplot as plt 4 | 5 | def plot_all_files(filenames, col_indexs, xlabels, ylabels, titles, colours, pathsaves): 6 | for i in range(0, len(filenames)): 7 | filename = filenames[i] + ".csv" 8 | pathsave = pathsaves[i] + ".pdf" 9 | col_index = col_indexs[i] 10 | color = colours[i] 11 | xlabel = xlabels[i] 12 | ylabel = ylabels[i] 13 | title = titles[i] 14 | 15 | dataset = read_dataset_file(filename, usecols=col_index, header=0) 16 | ax = plt.subplot() 17 | plt.plot(dataset, color) 18 | plt.xlabel(xlabel) 19 | plt.ylabel(ylabel) 20 | ax.set_title(title) 21 | 22 | plt.savefig(pathsave, bbox_inches = "tight") 23 | plt.show() 24 | 25 | 26 | def plot_file_with_scale_label(filename, col_index, xlabel, ylabel, title, color, pathsave, scaler): 27 | """ 28 | :param scaler: [ text_scale, math_scale, coordinate_text ] 29 | Eg: [ "%1.2fK", 1e-3, "x" ], [ "%1.2fM", 1e-6, "y" ], [ "%1.2fB", 1e-9, "both" ] 30 | :return: 31 | """ 32 | def scaler_function(x, pos): 33 | 'The two args are the value and tick position' # millions, thousands, billions, ... 34 | return scaler[0] % (x * scaler[1]) 35 | formatter = FuncFormatter(scaler_function) 36 | 37 | dataset = read_dataset_file(filename, usecols=col_index, header=0) 38 | ax = plt.subplot() 39 | if scaler[2] == "x": 40 | ax.xaxis.set_major_formatter(formatter) 41 | elif scaler[2] == "y": 42 | ax.yaxis.set_major_formatter(formatter) 43 | elif scaler[2] == "both": 44 | ax.xaxis.set_major_formatter(formatter) 45 | ax.yaxis.set_major_formatter(formatter) 46 | else: 47 | "====== Don't wanna scale anything =====" 48 | plt.plot(dataset, color) 49 | plt.xlabel(xlabel) 50 | plt.ylabel(ylabel) 51 | ax.set_title(title) 52 | 53 | plt.savefig(pathsave, bbox_inches="tight") 54 | plt.show() 55 | 56 | 57 | # filename = "worldcup98_5m.csv" 58 | # pathsave = "results/worldcup98_5m_test.pdf" 59 | # col_index = [1] 60 | # color = '#ff7f0e' 61 | # xlabel = "Time (5 minutes)" 62 | # ylabel = "Number of requests" 63 | # title = "Request to server in worldcup season in 1998" 64 | # scaler = ["%1.1fK", 1e-3, "both"] 65 | # 66 | # plot_file_with_scale_label(filename, col_index, xlabel, ylabel, title, col_index, pathsave, scaler) 67 | 68 | 69 | 70 | 71 | ### Default Color plotly 72 | # D3: #1f77b4 73 | # Plotly: #1f77b4 ; rgb(31, 119, 180) 74 | # D3: #ff7f0e 75 | # Plotly: #ff7f0e ; rgb(255, 127, 14) 76 | # D3: #2ca02c 77 | # Plotly: #2ca02c ; rgb(44, 160, 44) 78 | # D3: #d62728 79 | # Plotly: #d62728 ; rgb(214, 39, 40) 80 | # D3: #9467bd 81 | # Plotly: #9467bd ; rgb(148, 103, 189) 82 | # D3: #8c564b 83 | # Plotly: #8c564b ; rgb(140, 86, 75) 84 | # D3: #e377c2 85 | # Plotly: #e377c2 ; rgb(227, 119, 194) 86 | # D3: #7f7f7f 87 | # Plotly: #7f7f7f ; rgb(127, 127, 127) 88 | # D3: #bcbd22 89 | # Plotly: #bcbd22 ; rgb(188, 189, 34) 90 | # D3: #17becf 91 | # Plotly: #17becf ; rgb(23, 190, 207) 92 | 93 | 94 | # filenames = ["internet_traffic_eu_5m", "internet_traffic_uk_5m","worldcup98_5m", "google_5m", "google_5m"] 95 | # pathsaves = ["internet_traffic_eu_5m", "internet_traffic_uk_5m","worldcup98_5m", "google_cpu_5m", "google_ram_5m"] 96 | # col_indexs = [ [4], [1], [1], [1], [2] ] 97 | # xlabels = ["Time (5 minutes)", "Time (5 minutes)", "Time (5 minutes)", "Time (5 minutes)", "Time (5 minutes)"] 98 | # ylabels = ["Megabyte", "Bit", "Request", "CPU usage", "Memory usage"] 99 | # titles = ["Internet traffic data from EU cities", "Internet traffic data from UK cities", 100 | # "Request to server in worldcup season in 1998", 101 | # "CPU usage from Google trace in 2011", "Memory usage from Google trace in 2011"] 102 | # colours = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd'] 103 | # 104 | # plot_all_files(filenames, col_indexs, xlabels, ylabels, titles, colours, pathsaves) 105 | 106 | 107 | 108 | 109 | def draw_2d(data=None, labels=None, title=None, pathsave=None): 110 | ax = plt.subplot() 111 | plt.figure(1) 112 | plt.plot(data[:, 0:1], data[:, 1:2], 'co', markersize=1.0) 113 | plt.ylabel(labels[1]) 114 | plt.xlabel(labels[0]) 115 | ax.set_title(title) 116 | plt.savefig(pathsave, bbox_inches="tight") 117 | plt.close() 118 | return None 119 | 120 | filename = "google_5m.csv" 121 | pathsave = "results/cpu_ram.pdf" 122 | col_idx = [1, 2] 123 | labels = ["CPU usage", "Memory usage"] 124 | title = "CPU usage and Memory usage from Google trace in 2011" 125 | dataset = read_dataset_file(filename, usecols=col_idx, header=0) 126 | draw_2d(dataset, labels, title, pathsave) 127 | 128 | 129 | -------------------------------------------------------------------------------- /data/formatted/handle_data.py: -------------------------------------------------------------------------------- 1 | from utils.IOUtil import read_dataset_file, save_formatted_data_csv 2 | import numpy as np 3 | 4 | filename = "internet_traffic_eu_5m.csv" 5 | pathsave = "test.csv" 6 | 7 | dataset = read_dataset_file(filename, usecols=[1], header=0) 8 | 9 | t1 = dataset[:, 0:1] / 8 10 | t2 = dataset[:, 0:1] / (8*1024) 11 | t3 = dataset[:, 0:1] / (8 * 1024 * 1024) 12 | 13 | done = np.concatenate((dataset, t1, t2, t3), axis=1) 14 | 15 | save_formatted_data_csv(done, pathsave, "") 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /data/formatted/results/cpu_ram.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/data/formatted/results/cpu_ram.pdf -------------------------------------------------------------------------------- /data/formatted/results/google_cpu_5m.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/data/formatted/results/google_cpu_5m.pdf -------------------------------------------------------------------------------- /data/formatted/results/google_ram_5m.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/data/formatted/results/google_ram_5m.pdf -------------------------------------------------------------------------------- /data/formatted/results/internet_traffic_eu_5m.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/data/formatted/results/internet_traffic_eu_5m.pdf -------------------------------------------------------------------------------- /data/formatted/results/internet_traffic_uk_5m.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/data/formatted/results/internet_traffic_uk_5m.pdf -------------------------------------------------------------------------------- /data/formatted/results/worldcup98_5m.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/data/formatted/results/worldcup98_5m.pdf -------------------------------------------------------------------------------- /data/note.md: -------------------------------------------------------------------------------- 1 | ### Dataset 2 | 3 | #### Computing 4 | 5 | 1. Internet traffic data (in bits) from a private ISP with centres 6 | 7 | https://datamarket.com/data/list/?q=cat:ecd%20provider:tsdl 8 | 9 | 10 | 1. Internet traffic data (in bits) from a private ISP with centres in 11 European cities. 11 | The data corresponds to a transatlantic link and was collected from 06:57 hours on 7 June to 11:17 hours on 31 July 2005. Hourly data., 12 | 13 | 2. Internet traffic data (in bits) from a private ISP with centres in 11 European cities. 14 | The data corresponds to a transatlantic link and was collected from 06:57 hours on 7 June to 11:17 hours on 31 July 2005. Data collected at five minute intervals., 15 | 16 | 3. Internet traffic data (in bits) from a private ISP with centres in 11 European cities. 17 | The data corresponds to a transatlantic link and was collected from 06:57 hours on 7 June to 11:17 hours on 31 July 2005. Daily data., 18 | 19 | 4. Internet traffic data (in bits) from an ISP. Aggregated traffic in the United Kingdom academic network backbone. It was collected between 19 November 2004, at 09:30 hours and 27 January 2005, at 11:11 hours. Data collected at five minute intervals. 20 | 21 | 5. Internet traffic data (in bits) from an ISP. Aggregated traffic in the United Kingdom academic network backbone. It was collected between 19 November 2004, at 09:30 hours and 27 January 2005, at 11:11 hours. Daily data 22 | 23 | 6. Internet traffic data (in bits) from an ISP. Aggregated traffic in the United Kingdom academic network backbone. It was collected between 19 November 2004, at 09:30 hours and 27 January 2005, at 11:11 hours. Hourly data 24 | 25 | 26 | 27 | ### Traffic 5m 28 | 1. EU 29 | https://datamarket.com/data/set/232n/internet-traffic-data-in-bits-from-a-private-isp-with-centres-in-11-european-cities-the-data-corresponds-to-a-transatlantic-link-and-was-collected-from-0657-hours-on-7-june-to-1117-hours-on-31-july-2005-data-collected-at-five-minute-intervals#!ds=232n&display=line 30 | 2. UK 31 | https://datamarket.com/data/set/232g/internet-traffic-data-in-bits-from-an-isp-aggregated-traffic-in-the-united-kingdom-academic-network-backbone-it-was-collected-between-19-november-2004-at-0930-hours-and-27-january-2005-at-1111-hours-data-collected-at-five-minute-intervals#!ds=232g 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /de_elm_script.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 00:51, 29/03/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from os.path import splitext, basename, realpath 11 | from sklearn.model_selection import ParameterGrid 12 | from model.main.hybrid_elm import DeElm 13 | from utils.SettingPaper import de_elm_paras_final as param_grid 14 | from utils.SettingPaper import * 15 | from utils.IOUtil import load_dataset 16 | 17 | if SP_RUN_TIMES == 1: 18 | all_model_file_name = SP_LOG_FILENAME 19 | else: # If runs with more than 1, like stability test --> name of the models ==> such as: rnn1hl.csv 20 | all_model_file_name = str(splitext(basename(realpath(__file__)))[0]) 21 | 22 | 23 | def train_model(item): 24 | root_base_paras = { 25 | "dataset": dataset, 26 | "feature_size": feature_size, 27 | "data_idx": SP_DATA_SPLIT_INDEX_2, 28 | "sliding": item["sliding"], 29 | "multi_output": multi_output, 30 | "output_idx": output_index, 31 | "method_statistic": SP_PREPROCESSING_METHOD, 32 | "log_filename": all_model_file_name, 33 | "n_runs": SP_RUN_TIMES, # 1 or others 34 | "path_save_result": SP_PATH_SAVE_BASE + SP_DATA_FILENAME[loop] + "/", 35 | "draw": SP_DRAW, 36 | "print_train": SP_PRINT_TRAIN, # 0: nothing, 1 : full detail, 2: short version 37 | } 38 | paras_name = "hs_{}-ep_{}-act_{}-wf_{}-cr_{}".format(item["hidden_size"], item["epoch"], item["activation"], item["wf"], item["cr"]) 39 | root_hybrid_paras = { 40 | "hidden_size": item["hidden_size"], "activation": item["activation"], "epoch": item["epoch"], "domain_range": item["domain_range"], 41 | "paras_name": paras_name 42 | } 43 | de_paras = { 44 | "epoch": item["epoch"], "pop_size": item["pop_size"], "wf": item["wf"], "cr": item["cr"] 45 | } 46 | md = DeElm(root_base_paras=root_base_paras, root_hybrid_paras=root_hybrid_paras, de_paras=de_paras) 47 | md._running__() 48 | 49 | 50 | for _ in range(SP_RUN_TIMES): 51 | for loop in range(len(SP_DATA_FILENAME)): 52 | filename = SP_LOAD_DATA_FROM + SP_DATA_FILENAME[loop] 53 | dataset = load_dataset(filename, cols=SP_DATA_COLS[loop]) 54 | feature_size = len(SP_DATA_COLS[loop]) 55 | multi_output = SP_DATA_MULTI_OUTPUT[loop] 56 | output_index = SP_OUTPUT_INDEX[loop] 57 | # Create combination of params. 58 | for item in list(ParameterGrid(param_grid)): 59 | train_model(item) 60 | 61 | 62 | -------------------------------------------------------------------------------- /drafts/draw/draw_3d_barchart.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from mpl_toolkits.mplot3d import Axes3D 3 | import matplotlib.pyplot as plt 4 | 5 | # Data generation 6 | alpha = np.linspace(1, 3, 3) 7 | t = np.linspace(0, 6, 6) 8 | T, A = np.meshgrid(t, alpha) 9 | 10 | 11 | data = np.array( 12 | [[0.9915, 0.9948, 0.9956, 0.9955, 0.9955, 0.9958], 13 | [3.0125, 2.9834, 2.9203, 2.9255, 2.9171, 2.9249], 14 | [16.716, 16.292, 15.378, 15.394, 15.400, 15.363]] 15 | ) 16 | 17 | # Plotting 18 | fig = plt.figure() 19 | ax = fig.gca(projection = '3d') 20 | 21 | Xi = T.flatten() 22 | Yi = A.flatten() 23 | Zi = np.zeros(data.size) 24 | 25 | dx = .25 * np.ones(data.size) 26 | dy = .25 * np.ones(data.size) 27 | dz = data.flatten() 28 | 29 | ax.set_xlabel('T') 30 | ax.set_ylabel('Alpha') 31 | ax.set_zlabel('Z Label') 32 | ax.bar3d(Xi, Yi, Zi, dx, dy, dz, color = 'w') 33 | 34 | plt.show() -------------------------------------------------------------------------------- /drafts/draw/draw_3d_barchart2.py: -------------------------------------------------------------------------------- 1 | """ 2 | ======================================== 3 | Create 2D bar graphs in different planes 4 | ======================================== 5 | 6 | Demonstrates making a 3D plot which has 2D bar graphs projected onto 7 | planes y=0, y=1, etc. 8 | """ 9 | 10 | from mpl_toolkits.mplot3d import Axes3D 11 | import mpl_toolkits.mplot3d.art3d as art3d 12 | import matplotlib.pyplot as plt 13 | import numpy as np 14 | 15 | fig = plt.figure() 16 | ax = fig.add_subplot(111, projection='3d') 17 | for c, z in zip(['r', 'g', 'b', 'y'], [30, 20, 10, 0]): 18 | xs = np.arange(20) 19 | ys = np.random.rand(20) 20 | 21 | # You can provide either a single color or an array. To demonstrate this, 22 | # the first bar of each set will be colored cyan. 23 | cs = [c] * len(xs) 24 | cs[0] = 'c' 25 | ax.bar(xs, ys, zs=z, zdir='y', color=cs, alpha=0.8) 26 | 27 | ax.set_xlabel('X') 28 | ax.set_ylabel('Y') 29 | ax.set_zlabel('Z') 30 | 31 | plt.show() -------------------------------------------------------------------------------- /drafts/draw/draw_error_full.py: -------------------------------------------------------------------------------- 1 | from utils.IOUtil import read_dataset_file 2 | from matplotlib.ticker import FuncFormatter 3 | import matplotlib.pyplot as plt 4 | import matplotlib.lines as lines 5 | from pandas import read_csv 6 | import numpy as np 7 | 8 | 9 | def plot_file_with_scale_label(filename, xlabel, ylabel, title, pathsave, scaler): 10 | """ 11 | :param scaler: [ text_scale, math_scale, coordinate_text ] 12 | Eg: [ "%1.2fK", 1e-3, "x" ], [ "%1.2fM", 1e-6, "y" ], [ "%1.2fB", 1e-9, "both" ] 13 | :return: 14 | """ 15 | def scaler_function(x, pos): 16 | 'The two args are the value and tick position' # millions, thousands, billions, ... 17 | return scaler[0] % (x * scaler[1]) 18 | formatter = FuncFormatter(scaler_function) 19 | 20 | point_number = 100 21 | point_start = 0 22 | 23 | t1 = "MLNN" # GA 24 | t2 = "GA-ELM" # PSO 25 | t3 = "PSO-ELM" # TWO 26 | t4 = "TWO-ELM" # OTWO 27 | t5 = "OTWO-ELM" # DE 28 | t6 = "ABFO" 29 | 30 | colnames = [t1, t2, t3, t4, t5, t6] 31 | results_df = read_csv(filename, header=None, names=colnames, index_col=False, engine='python') 32 | 33 | mlnn = results_df[t1].values 34 | lstm = results_df[t2].values 35 | ga_mlnn = results_df[t5].values 36 | cro_mlnn = results_df[t4].values 37 | rnn = results_df[t3].values 38 | 39 | ocro_mlnn = results_df[t6].values 40 | 41 | ax = plt.subplot() 42 | if scaler[2] == "x": 43 | ax.xaxis.set_major_formatter(formatter) 44 | elif scaler[2] == "y": 45 | ax.yaxis.set_major_formatter(formatter) 46 | elif scaler[2] == "both": 47 | ax.xaxis.set_major_formatter(formatter) 48 | ax.yaxis.set_major_formatter(formatter) 49 | else: 50 | "====== Don't wanna scale anything =====" 51 | 52 | x = np.arange(point_number) 53 | plt.plot(x, mlnn[point_start:point_start + point_number], color="#1f77b4", label=t1) 54 | plt.plot(x, lstm[point_start:point_start + point_number], color="#ff7f0e", label=t2) 55 | plt.plot(x, ga_mlnn[point_start:point_start + point_number], color="#2ca02c", label=t3) 56 | plt.plot(x, cro_mlnn[point_start:point_start + point_number], color="#9467bd", label=t4) 57 | plt.plot(x, rnn[point_start:point_start + point_number], color="#d62728", label=t5) 58 | 59 | plt.xlabel(xlabel) 60 | plt.ylabel(ylabel) 61 | plt.legend() 62 | ax.set_title(title) 63 | plt.savefig(pathsave, bbox_inches="tight") 64 | plt.show() 65 | 66 | 67 | read_filepath = "error_uk_SL5.csv" 68 | write_filepath = "img/error_uk_SL5.pdf" 69 | x_label = "Epoch" 70 | y_label = "MSE" 71 | title = 'Internet Traffic UK (k=5)' 72 | 73 | scaler = ["%1.2fE-5", 1e+5, "y"] 74 | plot_file_with_scale_label(read_filepath, x_label, y_label, title, write_filepath, scaler) 75 | 76 | 77 | 78 | ### Default Color plotly 79 | # D3: #1f77b4 80 | # Plotly: #1f77b4 ; rgb(31, 119, 180) 81 | # D3: #ff7f0e 82 | # Plotly: #ff7f0e ; rgb(255, 127, 14) 83 | # D3: #2ca02c 84 | # Plotly: #2ca02c ; rgb(44, 160, 44) 85 | # D3: #d62728 86 | # Plotly: #d62728 ; rgb(214, 39, 40) 87 | # D3: #9467bd 88 | # Plotly: #9467bd ; rgb(148, 103, 189) 89 | # D3: #8c564b 90 | # Plotly: #8c564b ; rgb(140, 86, 75) 91 | # D3: #e377c2 92 | # Plotly: #e377c2 ; rgb(227, 119, 194) 93 | # D3: #7f7f7f 94 | # Plotly: #7f7f7f ; rgb(127, 127, 127) 95 | # D3: #bcbd22 96 | # Plotly: #bcbd22 ; rgb(188, 189, 34) 97 | # D3: #17becf 98 | # Plotly: #17becf ; rgb(23, 190, 207) 99 | 100 | 101 | # filenames = ["internet_traffic_eu_5m", "internet_traffic_uk_5m","worldcup98_5m", "google_5m", "google_5m"] 102 | # pathsaves = ["internet_traffic_eu_5m", "internet_traffic_uk_5m","worldcup98_5m", "google_cpu_5m", "google_ram_5m"] 103 | # col_indexs = [ [4], [1], [1], [1], [2] ] 104 | # xlabels = ["Time (5 minutes)", "Time (5 minutes)", "Time (5 minutes)", "Time (5 minutes)", "Time (5 minutes)"] 105 | # ylabels = ["Megabyte", "Bit", "Request", "CPU usage", "Memory usage"] 106 | # titles = ["Internet traffic data from EU cities", "Internet traffic data from UK cities", 107 | # "Request to server in worldcup season in 1998", 108 | # "CPU usage from Google trace in 2011", "Memory usage from Google trace in 2011"] 109 | # colours = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd'] 110 | # 111 | # plot_all_files(filenames, col_indexs, xlabels, ylabels, titles, colours, pathsaves) 112 | 113 | 114 | -------------------------------------------------------------------------------- /drafts/draw/draw_errors.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import matplotlib.lines as lines 3 | from pandas import read_csv 4 | import numpy as np 5 | 6 | ## https://matplotlib.org/api/markers_api.html 7 | 8 | 9 | ## Paras 10 | 11 | x_label = "Epoch" 12 | #y_label = "CPU Usage" 13 | y_label = "MSE" 14 | title = 'Internet Traffic UK (k=5)' 15 | #title = 'Multivariate Neural Network' 16 | 17 | read_filepath = "error_uk_SL5.csv" 18 | write_filepath = "img/error_uk_SL5.pdf" 19 | 20 | # CPU: 290, 750, 850, 1000, 1300 (best images) 21 | # RAM: 290, 780, 850, 1000, 1300 (best images) 22 | point_number = 100 23 | point_start = 0 24 | 25 | t1 = "MLNN" # GA 26 | t2 = "PSO-ELM" # PSO 27 | t3 = "TWO-ELM" # TWO 28 | t4 = "OTWO-ELM" # OTWO 29 | t5 = "GA-ELM" # DE 30 | t6 = "ABFO" 31 | colnames = [t1, t2, t3, t4, t5, t6] 32 | results_df = read_csv(read_filepath, header=None,names=colnames, index_col=False, engine='python') 33 | 34 | mlnn = results_df[t1].values 35 | ga_mlnn = results_df[t2].values 36 | cro_mlnn = results_df[t3].values 37 | rnn = results_df[t4].values 38 | lstm = results_df[t5].values 39 | ocro_mlnn = results_df[t6].values 40 | 41 | x = np.arange(point_number) 42 | 43 | # plt.plot(x, mlnn[point_start:point_start + point_number], marker='o', linestyle=':',label=t1) 44 | # plt.plot(x, ga_mlnn[point_start:point_start + point_number], marker='s', linestyle=':', label=t2) 45 | # plt.plot(x, cro_mlnn[point_start:point_start + point_number], marker='*', linestyle=':', label=t3) 46 | # plt.plot(x, rnn[point_start:point_start + point_number], marker=lines.CARETDOWN, linestyle=':', label=t4) 47 | # plt.plot(x, lstm[point_start:point_start + point_number], marker='x', linestyle=':', label=t5) 48 | # plt.plot(x, ocro_mlnn[point_start:point_start + point_number], marker=4, label=t6) 49 | 50 | 51 | plt.plot(x, mlnn[point_start:point_start + point_number], label=t1) 52 | plt.plot(x, lstm[point_start:point_start + point_number], label=t5) 53 | plt.plot(x, ga_mlnn[point_start:point_start + point_number], label=t2) 54 | plt.plot(x, cro_mlnn[point_start:point_start + point_number], label=t3) 55 | plt.plot(x, rnn[point_start:point_start + point_number], label=t4) 56 | 57 | 58 | plt.xlabel(x_label) 59 | plt.ylabel(y_label) 60 | plt.title(title) 61 | plt.legend() 62 | plt.savefig(write_filepath, bbox_inches="tight") 63 | plt.show() 64 | -------------------------------------------------------------------------------- /drafts/draw/draw_paper_bfo.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import matplotlib.lines as lines 3 | from pandas import read_csv 4 | import numpy as np 5 | 6 | ## https://matplotlib.org/api/markers_api.html 7 | 8 | ## Paras 9 | 10 | x_label = "Time (5 minutes)" 11 | #y_label = "CPU Usage" 12 | y_label = "Memory Usage" 13 | #title = 'Univariate Neural Network' 14 | title = 'Multivariate FL-BFONN' 15 | 16 | read_filepath = "multi_ram.csv" 17 | write_filepath = "multi_ram_flbfonn.pdf" 18 | 19 | # CPU: 290, 750, 850, 1000, 1300 (best images) 20 | # RAM: 290, 780, 850, 1000, 1300 (best images) 21 | point_number = 500 22 | point_start = 200 23 | 24 | colnames = ['True', "FL-GANN", "FL-BFONN", "FLABL"] 25 | results_df = read_csv(read_filepath, header=None,names=colnames, index_col=False, engine='python') 26 | 27 | real = results_df['True'].values 28 | flnn = results_df['FL-GANN'].values 29 | flgann = results_df['FL-BFONN'].values 30 | flbfonn = results_df['FLABL'].values 31 | 32 | x = np.arange(point_number) 33 | 34 | # plt.plot(x, real[point_start:point_start + point_number], marker='o', label='True') 35 | # plt.plot(x, ann[point_start:point_start + point_number], marker='s', label='ANN') 36 | # plt.plot(x, mlnn[point_start:point_start + point_number], marker='*', label='MLNN') 37 | # plt.plot(x, flnn[point_start:point_start + point_number], marker=lines.CARETDOWN, label='FLNN') 38 | # plt.plot(x, flgann[point_start:point_start + point_number], marker='x', label='FL-GANN') 39 | # plt.plot(x, flbfonn[point_start:point_start + point_number], marker='+', label='FL-BFONN') 40 | 41 | 42 | plt.plot(x, real[point_start:point_start + point_number], label='Actual') 43 | #plt.plot(x, flnn[point_start:point_start + point_number], label='Predict') 44 | plt.plot(x, flgann[point_start:point_start + point_number], label='Predict') 45 | #plt.plot(x, flbfonn[point_start:point_start + point_number], label='Predict') 46 | 47 | plt.xlabel(x_label) 48 | plt.ylabel(y_label) 49 | plt.title(title) 50 | plt.legend() 51 | plt.savefig(write_filepath) 52 | plt.show() 53 | -------------------------------------------------------------------------------- /drafts/draw/draw_pred_full.py: -------------------------------------------------------------------------------- 1 | import matplotlib.pyplot as plt 2 | import matplotlib.lines as lines 3 | from pandas import read_csv 4 | import numpy as np 5 | 6 | ## https://matplotlib.org/api/markers_api.html 7 | 8 | ## Paras 9 | 10 | x_label = "Time (5 minutes)" 11 | 12 | 13 | #y_label = "Megabytes" # EU 14 | #title = "EU dataset" 15 | #read_filepath = "pred_eu_SL5.csv" 16 | #write_filepath = "new/2two_elm_eu_sl2" 17 | #write_filepath = "new/4otwo_elm_eu_sl5" 18 | #point_number = 600 19 | #point_start = 1500 20 | 21 | y_label = "Bytes" # UK 22 | title = "UK dataset" 23 | read_filepath = "pred_uk_SL2.csv" 24 | #write_filepath = "new/4otwo_elm_uk_sl2" 25 | write_filepath = "new/4otwo_elm_uk_sl2" 26 | point_number = 600 27 | point_start = 1200 28 | 29 | 30 | filetypes = [".png", ".jpg", ".eps", ".pdf"] 31 | colnames = ['True', "GA", "PSO", "TWO", "OTWO", "DE", "ABFO", "more1", "more2"] 32 | results_df = read_csv(read_filepath, header=None,names=colnames, index_col=False, engine='python') 33 | 34 | real = results_df['True'].values 35 | flgann = results_df['OTWO'].values 36 | x = np.arange(point_number) 37 | 38 | plt.plot(x, real[point_start:point_start + point_number], color='#8c564b', label='Actual') 39 | plt.plot(x, flgann[point_start:point_start + point_number], color='#17becf', linestyle='dashed', label='Predict') 40 | 41 | plt.xlabel(x_label) 42 | plt.ylabel(y_label) 43 | plt.title(title) 44 | plt.legend() 45 | for ft in filetypes: 46 | plt.savefig(write_filepath + ft, bbox_inches="tight") 47 | plt.show() 48 | -------------------------------------------------------------------------------- /drafts/draw/draw_spider_chart.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | from math import pi 3 | import matplotlib.pyplot as plt 4 | 5 | #Create a data frame from Messi and Ronaldo's 6 Ultimate Team data points from FIFA 18 6 | Messi = {'Pace':89,'Shooting':90,'Passing':86,'Dribbling':95,'Defending':26,'Physical':61} 7 | Ronaldo = {'Pace':90,'Shooting':93,'Passing':82,'Dribbling':90,'Defending':33,'Physical':80} 8 | 9 | data = pd.DataFrame([Messi,Ronaldo], index = ["Messi","Ronaldo"]) 10 | print(data) 11 | 12 | Attributes =list(data) 13 | AttNo = len(Attributes) 14 | 15 | 16 | 17 | values = data.iloc[1].tolist() 18 | values += values [:1] 19 | 20 | angles = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 21 | angles += angles [:1] 22 | 23 | 24 | 25 | #Find the values and angles for Messi - from the table at the top of the page 26 | values2 = data.iloc[0].tolist() 27 | values2 += values2 [:1] 28 | 29 | angles2 = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 30 | angles2 += angles2 [:1] 31 | 32 | 33 | #Create the chart as before, but with both Ronaldo's and Messi's angles/values 34 | ax = plt.subplot(111, polar=True) 35 | 36 | #Add the attribute labels to our axes 37 | plt.xticks(angles[:-1],Attributes) 38 | 39 | #Plot the line around the outside of the filled area, using the angles and values calculated before 40 | ax.plot(angles,values) 41 | #Fill in the area plotted in the last line 42 | ax.fill(angles, values, 'teal', alpha=0.1) 43 | 44 | ax.plot(angles2,values2) 45 | ax.fill(angles2, values2, 'red', alpha=0.1) 46 | 47 | #Rather than use a title, individual text points are added 48 | plt.figtext(0.1,0.9,"Messi",color="red") 49 | plt.figtext(0.1,0.85,"v") 50 | plt.figtext(0.1,0.8,"Ronaldo",color="teal") 51 | 52 | #Give the plot a title and show it 53 | ax.set_title("Ronaldo >< Messi") 54 | plt.show() 55 | 56 | 57 | -------------------------------------------------------------------------------- /drafts/draw/draw_spider_chart2.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | from math import pi 3 | import matplotlib.pyplot as plt 4 | 5 | #Create a data frame from Messi and Ronaldo's 6 Ultimate Team data points from FIFA 18 6 | RMSE = {'MLNN':16.716,'ELM':16.292,'GA-ELM':15.378,'PSO-ELM':15.394,'TWO-ELM':15.400,'OTWO-ELM':15.363} 7 | MAPE = {'MLNN':3.0125,'ELM':2.9834,'GA-ELM':2.9203,'PSO-ELM':2.9255, 'TWO-ELM':2.9171,'OTWO-ELM':2.9249} 8 | R2 = {'MLNN':0.9915,'ELM':0.9948,'GA-ELM':0.9956,'PSO-ELM':0.9955,'TWO-ELM':0.9955,'OTWO-ELM':0.9958} 9 | 10 | data = pd.DataFrame([RMSE, MAPE, R2], index = ["RMSE","MAPE", "$R^2$"]) 11 | print(data) 12 | 13 | Attributes =list(data) 14 | AttNo = len(Attributes) 15 | 16 | 17 | 18 | values = data.iloc[0].tolist() 19 | values += values [:1] 20 | 21 | angles = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 22 | angles += angles [:1] 23 | 24 | 25 | 26 | #Find the values and angles for Messi - from the table at the top of the page 27 | values2 = data.iloc[1].tolist() 28 | values2 += values2 [:1] 29 | 30 | angles2 = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 31 | angles2 += angles2 [:1] 32 | 33 | 34 | values3 = data.iloc[2].tolist() 35 | values3 += values3 [:1] 36 | 37 | angles3 = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 38 | angles3 += angles3 [:1] 39 | 40 | 41 | 42 | #Create the chart as before, but with both Ronaldo's and Messi's angles/values 43 | ax = plt.subplot(111, polar=True) 44 | 45 | #Add the attribute labels to our axes 46 | plt.xticks(angles[:-1],Attributes) 47 | 48 | #Plot the line around the outside of the filled area, using the angles and values calculated before 49 | ax.plot(angles,values) 50 | #Fill in the area plotted in the last line 51 | ax.fill(angles, values, 'teal', alpha=0.1) 52 | 53 | ax.plot(angles2,values2) 54 | ax.fill(angles2, values2, 'red', alpha=0.1) 55 | 56 | ax.plot(angles3,values3) 57 | ax.fill(angles3, values3, 'green', alpha=0.1) 58 | 59 | #Rather than use a title, individual text points are added 60 | plt.figtext(0.1,0.9,"RMSE",color="teal") 61 | plt.figtext(0.1,0.85,"MAPE", color="red") 62 | plt.figtext(0.1,0.8,"$R^2$",color="green") 63 | 64 | #Give the plot a title and show it 65 | ax.set_title("Sliding window k = 2") 66 | 67 | plt.savefig("hehe.png", bbox_inches="tight") 68 | plt.show() 69 | 70 | 71 | -------------------------------------------------------------------------------- /drafts/draw/draw_spider_chart3.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | from math import pi 3 | import matplotlib.pyplot as plt 4 | 5 | 6 | colors = ["teal", "red", "green", "blue", "orange", "yellow"] 7 | titles = ["MLNN","ELM", "GA-ELM", "PSO-ELM", "TWO-ELM", "OTWO-ELM"] 8 | 9 | #Create a data frame from Messi and Ronaldo's 6 Ultimate Team data points from FIFA 18 10 | MLNN = {'RMSE':16.716,'MAPE':3.0125,'$R^2$':0.9915} 11 | ELM = {'RMSE':16.292,'MAPE':2.9834,'$R^2$':0.9948} 12 | GA_ELM = {'RMSE':15.378,'MAPE':2.9203,'$R^2$':0.9956} 13 | PSO_ELM = {'RMSE':15.394,'MAPE':2.9255,'$R^2$':0.9955} 14 | TWO_ELM = {'RMSE':15.400,'MAPE':2.9171,'$R^2$':0.9955} 15 | OTWO_ELM = {'RMSE':15.363,'MAPE':2.9249,'$R^2$':0.9958} 16 | 17 | data = pd.DataFrame([MLNN, ELM, GA_ELM, PSO_ELM, TWO_ELM, OTWO_ELM], index = titles) 18 | print(data) 19 | 20 | Attributes =list(data) 21 | AttNo = len(Attributes) 22 | 23 | print(Attributes) 24 | print(AttNo) 25 | 26 | values = [] 27 | angles = [] 28 | for i in range(len(colors)): 29 | value = data.iloc[i].tolist() 30 | value += values [:1] 31 | 32 | angle = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 33 | angle += angle[:1] 34 | 35 | values.append(value) 36 | angles.append(angle) 37 | 38 | 39 | #Create the chart as before, but with both Ronaldo's and Messi's angles/values 40 | ax = plt.subplot(111, polar=True) 41 | 42 | #Add the attribute labels to our axes 43 | plt.xticks(angles[0][:-1], Attributes) 44 | 45 | #Plot the line around the outside of the filled area, using the angles and values calculated before 46 | #Fill in the area plotted in the last line 47 | for i in range(len(colors)): 48 | ax.plot(angles[i], values[i]) 49 | ax.fill(angles[i], values[i], colors[i], 'teal', alpha=0.1) 50 | 51 | #Rather than use a title, individual text points are added 52 | plt.figtext(0.1, 0.9 - 0.05*i, titles[i], color=colors[i]) 53 | 54 | #Give the plot a title and show it 55 | ax.set_title("Sliding window k = 2") 56 | 57 | plt.savefig("hehe.png", bbox_inches="tight") 58 | plt.show() 59 | 60 | 61 | -------------------------------------------------------------------------------- /drafts/draw/draw_spider_chart4.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | from math import pi 3 | import matplotlib.pyplot as plt 4 | 5 | 6 | colors = ["teal", "red", "green", "blue", "orange", "yellow"] 7 | titles = ["MLNN","ELM", "GA-ELM", "PSO-ELM", "TWO-ELM", "OTWO-ELM"] 8 | 9 | #Create a data frame from Messi and Ronaldo's 6 Ultimate Team data points from FIFA 18 10 | MLNN = {'RMSE':16.716,'MAPE':3.0125,'$R^2$':0.9915} 11 | ELM = {'RMSE':16.292,'MAPE':2.9834,'$R^2$':0.9948} 12 | GA_ELM = {'RMSE':15.378,'MAPE':2.9203,'$R^2$':0.9956} 13 | PSO_ELM = {'RMSE':15.394,'MAPE':2.9255,'$R^2$':0.9955} 14 | TWO_ELM = {'RMSE':15.400,'MAPE':2.9171,'$R^2$':0.9955} 15 | OTWO_ELM = {'RMSE':15.363,'MAPE':2.9249,'$R^2$':0.9958} 16 | 17 | data = pd.DataFrame([MLNN, ELM, GA_ELM, PSO_ELM, TWO_ELM, OTWO_ELM], index = titles) 18 | print(data) 19 | 20 | Attributes =list(data) 21 | AttNo = len(Attributes) 22 | 23 | 24 | values = data.iloc[0].tolist() 25 | values += values [:1] 26 | angles = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 27 | angles += angles [:1] 28 | 29 | values1 = data.iloc[1].tolist() 30 | values1 += values1 [:1] 31 | angles1 = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 32 | angles1 += angles1 [:1] 33 | 34 | values2 = data.iloc[2].tolist() 35 | values2 += values2 [:1] 36 | angles2 = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 37 | angles2 += angles2 [:1] 38 | 39 | values3 = data.iloc[3].tolist() 40 | values3 += values3[:1] 41 | angles3 = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 42 | angles3 += angles3[:1] 43 | 44 | values4 = data.iloc[4].tolist() 45 | values4 += values4[:1] 46 | angles4 = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 47 | angles4 += angles4[:1] 48 | 49 | values5 = data.iloc[5].tolist() 50 | values5 += values5[:1] 51 | angles5 = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 52 | angles5 += angles5[:1] 53 | 54 | 55 | #Create the chart as before, but with both Ronaldo's and Messi's angles/values 56 | ax = plt.subplot(111, polar=True) 57 | 58 | #Add the attribute labels to our axes 59 | plt.xticks(angles[:-1], Attributes) 60 | 61 | 62 | 63 | #Plot the line around the outside of the filled area, using the angles and values calculated before 64 | ax.plot(angles,values) 65 | ax.fill(angles, values, 'teal', alpha=0.1) 66 | 67 | ax.plot(angles1,values1) 68 | ax.fill(angles1, values1, 'red', alpha=0.1) 69 | 70 | ax.plot(angles2,values2) 71 | ax.fill(angles2, values2, 'green', alpha=0.1) 72 | 73 | ax.plot(angles3,values3) 74 | ax.fill(angles3, values3, 'blue', alpha=0.1) 75 | 76 | ax.plot(angles4,values4) 77 | ax.fill(angles4, values4, 'orange', alpha=0.1) 78 | 79 | ax.plot(angles5,values5) 80 | ax.fill(angles5, values5, 'yellow', alpha=0.1) 81 | 82 | 83 | 84 | 85 | #Give the plot a title and show it 86 | ax.set_title("Sliding window k = 2") 87 | 88 | plt.savefig("hehe.png", bbox_inches="tight") 89 | plt.show() 90 | 91 | 92 | -------------------------------------------------------------------------------- /drafts/draw/draw_spider_chart_final.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | from math import pi 3 | import matplotlib.pyplot as plt 4 | 5 | 6 | colors = ["teal", "red", "green", "blue", "orange", "yellow"] 7 | titles = ["MLNN","ELM", "GA-ELM", "PSO-ELM", "TWO-ELM", "OTWO-ELM"] 8 | 9 | #Create a data frame from Messi and Ronaldo's 6 Ultimate Team data points from FIFA 18 10 | k2 = {'MLNN':16.716,'ELM':16.292,'GA-ELM':15.378,'PSO-ELM':15.394,'TWO-ELM':15.400,'OTWO-ELM':15.363} 11 | k5 = {'MLNN':15.857,'ELM':15.744,'GA-ELM':14.914,'PSO-ELM':14.834, 'TWO-ELM':14.885,'OTWO-ELM':14.874} 12 | 13 | 14 | data = pd.DataFrame([k2, k5], index = ["k=2", "k=5"]) 15 | print(data) 16 | 17 | Attributes =list(data) 18 | AttNo = len(Attributes) 19 | 20 | 21 | values = data.iloc[0].tolist() 22 | values += values [:1] 23 | angles = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 24 | angles += angles [:1] 25 | 26 | values1 = data.iloc[1].tolist() 27 | values1 += values1 [:1] 28 | angles1 = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 29 | angles1 += angles1 [:1] 30 | 31 | 32 | #Create the chart as before, but with both Ronaldo's and Messi's angles/values 33 | ax = plt.subplot(111, polar=True) 34 | 35 | #Add the attribute labels to our axes 36 | plt.xticks(angles[:-1], Attributes) 37 | 38 | 39 | 40 | #Plot the line around the outside of the filled area, using the angles and values calculated before 41 | ax.plot(angles,values) 42 | ax.fill(angles, values, 'teal', alpha=0.1) 43 | 44 | ax.plot(angles1,values1) 45 | ax.fill(angles1, values1, 'red', alpha=0.1) 46 | 47 | # ax.plot(angles2,values2) 48 | # ax.fill(angles2, values2, 'green', alpha=0.1) 49 | # 50 | # ax.plot(angles3,values3) 51 | # ax.fill(angles3, values3, 'blue', alpha=0.1) 52 | # 53 | # ax.plot(angles4,values4) 54 | # ax.fill(angles4, values4, 'orange', alpha=0.1) 55 | # 56 | # ax.plot(angles5,values5) 57 | # ax.fill(angles5, values5, 'yellow', alpha=0.1) 58 | 59 | 60 | 61 | 62 | #Give the plot a title and show it 63 | ax.set_title("Sliding window k = 2") 64 | 65 | plt.savefig("hehe.png", bbox_inches="tight") 66 | plt.show() 67 | 68 | 69 | -------------------------------------------------------------------------------- /drafts/draw/draw_spider_chart_final2.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | from math import pi 3 | import matplotlib.pyplot as plt 4 | 5 | 6 | colors = ["teal", "red", "green", "blue", "orange", "yellow"] 7 | titles = ["MLNN","ELM", "GA-ELM", "PSO-ELM", "TWO-ELM", "OTWO-ELM"] 8 | 9 | #Create a data frame from Messi and Ronaldo's 6 Ultimate Team data points from FIFA 18 10 | k2 = {'MLNN':16.716,'ELM':16.292, "GA-ELM": 15.378, "PSO-ELM": 15.394, "TWO-ELM": 15.400, "OTWO-ELM": 15.363} 11 | k5 = {"MLNN": 15.857, "ELM": 15.744, "GA-ELM": 14.914, "PSO-ELM": 14.834, "TWO-ELM": 14.885, "OTWO-ELM": 14.874} 12 | 13 | 14 | data = pd.DataFrame([k2, k5], index = ["k=2", "k=5"]) 15 | print(data) 16 | 17 | Attributes =list(data) 18 | AttNo = len(Attributes) 19 | 20 | 21 | values = data.iloc[0].tolist() 22 | values += values [:1] 23 | angles = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 24 | angles += angles [:1] 25 | 26 | values1 = data.iloc[1].tolist() 27 | values1 += values1 [:1] 28 | angles1 = [n / float(AttNo) * 2 * pi for n in range(AttNo)] 29 | angles1 += angles1 [:1] 30 | 31 | #Create the chart as before, but with both Ronaldo's and Messi's angles/values 32 | ax = plt.subplot(111, polar=True) 33 | 34 | #Add the attribute labels to our axes 35 | plt.xticks(angles[:-1], Attributes) 36 | 37 | 38 | 39 | #Plot the line around the outside of the filled area, using the angles and values calculated before 40 | ax.plot(angles,values) 41 | ax.fill(angles, values, 'teal', alpha=0.1) 42 | 43 | ax.plot(angles1,values1) 44 | ax.fill(angles1, values1, 'red', alpha=0.1) 45 | 46 | 47 | #Give the plot a title and show it 48 | ax.set_title("Sliding window k = 2") 49 | 50 | plt.savefig("hehe.png", bbox_inches="tight") 51 | plt.show() 52 | 53 | 54 | -------------------------------------------------------------------------------- /drafts/draw/error_eu_SL2.csv: -------------------------------------------------------------------------------- 1 | 0.000304712324231,0.00030414240077,0.0003032765124,0.000303954845592,0.000304743758907,0.000303771091342 2 | 0.000304712324231,0.000303299247424,0.0003032765124,0.000303954845592,0.00030446910354,0.000303771091342 3 | 0.000304712324231,0.000303299247424,0.0003032765124,0.000303954845592,0.00030446910354,0.000303771091342 4 | 0.000304712324231,0.000303299247424,0.0003032765124,0.000303954845592,0.00030446910354,0.000303771091342 5 | 0.000304712324231,0.000303299247424,0.0003032765124,0.000303954845592,0.00030446910354,0.000303771091342 6 | 0.000304712324231,0.000303299247424,0.0003032765124,0.000303888485798,0.000304076175092,0.000303771091342 7 | 0.000304712324231,0.000303299247424,0.0003032765124,0.000303888485798,0.000304076175092,0.000303771091342 8 | 0.000304712324231,0.000303299247424,0.0003032765124,0.000303888485798,0.000303637977645,0.000303771091342 9 | 0.000304712324231,0.000303299247424,0.0003032765124,0.000303888485798,0.000303637977645,0.000303771091342 10 | 0.000304712324231,0.000303261387097,0.0003032765124,0.000303888485798,0.000303637977645,0.000303771091342 11 | 0.000304712324231,0.000303261387097,0.0003032765124,0.000303888485798,0.000303637977645,0.000303771091342 12 | 0.000304712324231,0.000303261387097,0.0003032765124,0.000303888485798,0.000303637977645,0.000303771091342 13 | 0.000304550658651,0.000303161986445,0.0003032765124,0.000303565220799,0.000303637977645,0.000303771091342 14 | 0.000304550658651,0.000303135760015,0.0003032765124,0.000303565220799,0.000303637977645,0.000303770828298 15 | 0.000304550658651,0.000303135760015,0.0003032765124,0.000303565220799,0.000303637977645,0.000303770828298 16 | 0.000304550658651,0.000303135760015,0.0003032765124,0.000303565220799,0.000303637977645,0.000303770828298 17 | 0.000304550658651,0.000303135760015,0.0003032765124,0.000303565220799,0.000303637977645,0.000303770828298 18 | 0.000304550658651,0.000303135760015,0.0003032765124,0.000303060493213,0.000303637977645,0.000303770828298 19 | 0.000304550658651,0.000303135760015,0.0003032765124,0.000303060493213,0.000303637977645,0.000303770828298 20 | 0.000304550658651,0.000303135760015,0.0003032765124,0.000303060493213,0.000303637977645,0.000303770828298 21 | 0.000304550658651,0.000303135519391,0.0003032765124,0.000303060493213,0.000303637977645,0.000303770828298 22 | 0.000304550658651,0.000303135519391,0.0003032765124,0.000302875399964,0.000303637977645,0.000303770828298 23 | 0.000304550658651,0.000303135519391,0.0003032765124,0.000302875399964,0.000303637977645,0.000303770828298 24 | 0.000304550658651,0.000303135519391,0.0003032765124,0.000302875399964,0.000303637977645,0.000303770828298 25 | 0.000304550658651,0.000303135519391,0.0003032765124,0.000302875399964,0.000303637977645,0.000303770828298 26 | 0.000304550658651,0.000303115455734,0.0003032765124,0.000302875399964,0.000303637977645,0.000303770828298 27 | 0.000304550658651,0.000303115455734,0.0003032765124,0.000302875399964,0.000303637977645,0.000303770828298 28 | 0.000304471199562,0.000303115455734,0.0003032765124,0.000302875399964,0.000303637977645,0.000303770828298 29 | 0.00030434901866,0.000303115455734,0.0003032765124,0.000302875399964,0.000303637977645,0.000303770828298 30 | 0.000303869011784,0.000303115455734,0.0003032765124,0.000302875399964,0.000303637977645,0.000303770828298 31 | 0.000303869011784,0.000303115455734,0.000303274692633,0.000302749739321,0.000303637977645,0.000303770828298 32 | 0.000303869011784,0.000303103941622,0.000303274692633,0.000302639255254,0.000303637977645,0.000303770828298 33 | 0.000303869011784,0.00030310146586,0.00030309222471,0.000302639255254,0.000303637977645,0.000303770828298 34 | 0.000303869011784,0.00030310146586,0.00030309222471,0.000302639255254,0.000303637977645,0.000303770828298 35 | 0.000303869011784,0.000303094120587,0.00030309222471,0.000302639255254,0.000303637977645,0.000303770828298 36 | 0.000303869011784,0.000303091557207,0.00030309222471,0.000302639255254,0.000303637977645,0.000303770828298 37 | 0.000303869011784,0.000303088735774,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 38 | 0.000303869011784,0.000303088735774,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 39 | 0.000303869011784,0.000303088735774,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 40 | 0.000303869011784,0.000303087632051,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 41 | 0.000303869011784,0.000303087632051,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 42 | 0.000303869011784,0.000303087436515,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 43 | 0.000303869011784,0.000303076629079,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 44 | 0.000303869011784,0.000303069650843,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 45 | 0.000303869011784,0.000303069650843,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 46 | 0.000303869011784,0.000303061815949,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 47 | 0.000303869011784,0.000303054836205,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 48 | 0.000303869011784,0.000303044936861,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 49 | 0.000303869011784,0.000303040918129,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 50 | 0.000303869011784,0.000303024868333,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 51 | 0.000303869011784,0.000303018231517,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 52 | 0.000303869011784,0.000303011240967,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 53 | 0.000303869011784,0.000303008000087,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 54 | 0.000303869011784,0.000303006288707,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 55 | 0.000303869011784,0.00030300178767,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 56 | 0.000303869011784,0.00030300046698,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 57 | 0.000303869011784,0.000302998900419,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 58 | 0.000303869011784,0.000302998062792,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 59 | 0.000303869011784,0.000302995153828,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 60 | 0.000303869011784,0.000302995112825,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 61 | 0.000303869011784,0.000302994667062,0.00030309222471,0.000302617020421,0.000303637977645,0.000303770828298 62 | 0.000303869011784,0.000302994270208,0.000302827680334,0.000302617020421,0.000303637977645,0.000303770828298 63 | 0.000303869011784,0.00030299312152,0.000302827680334,0.000302617020421,0.000303637977645,0.000303705535815 64 | 0.000303869011784,0.000302992732562,0.000302827680334,0.000302617020421,0.000303637977645,0.000303670117178 65 | 0.000303869011784,0.000302991994316,0.000302827680334,0.000302617020421,0.000303637977645,0.000303624392048 66 | 0.000303869011784,0.000302990446068,0.000302827680334,0.000302617020421,0.000303637977645,0.000303584438983 67 | 0.000303869011784,0.00030298947865,0.000302827680334,0.000302617020421,0.000303637977645,0.000303573319964 68 | 0.000303869011784,0.000302988468446,0.000302809990748,0.000302617020421,0.000303637977645,0.00030357203052 69 | 0.000303869011784,0.000302987571686,0.000302809990748,0.000302617020421,0.000303637977645,0.000303531843652 70 | 0.000303869011784,0.000302986921573,0.000302809990748,0.000302617020421,0.000303637977645,0.000303514200333 71 | 0.000303869011784,0.000302984659037,0.000302809990748,0.000302617020421,0.000303637977645,0.000303510894413 72 | 0.000303869011784,0.000302982126855,0.000302809990748,0.000302617020421,0.000303218531325,0.000303490012026 73 | 0.000303869011784,0.000302980851801,0.000302809990748,0.000302617020421,0.000303218531325,0.000303488892242 74 | 0.000303319190523,0.000302979121825,0.000302809990748,0.000302617020421,0.000303218531325,0.000303480054705 75 | 0.000303319190523,0.000302977161333,0.000302809990748,0.000302617020421,0.000303218531325,0.000303476798818 76 | 0.000303319190523,0.000302975318396,0.000302809990748,0.000302617020421,0.000303218531325,0.000303475972007 77 | 0.000303319190523,0.000302973780906,0.000302809990748,0.000302617020421,0.000303124329143,0.00030347548431 78 | 0.000303319190523,0.000302972455485,0.000302809990748,0.000302617020421,0.000303124329143,0.000303475314593 79 | 0.000303319190523,0.000302971145619,0.000302809990748,0.000302617020421,0.000303124329143,0.000303473345896 80 | 0.000303319190523,0.000302969955422,0.000302809990748,0.000302617020421,0.000303124329143,0.000303472982879 81 | 0.000303319190523,0.000302969190283,0.000302809990748,0.000302617020421,0.000303124329143,0.000303466005051 82 | 0.000303319190523,0.00030296850717,0.000302809990748,0.000302617020421,0.000303124329143,0.000303465862974 83 | 0.000303319190523,0.000302967712763,0.000302809990748,0.000302617020421,0.000303124329143,0.000303465351656 84 | 0.000303319190523,0.000302967060905,0.000302809990748,0.000302617020421,0.000303124329143,0.000303464657432 85 | 0.000303319190523,0.000302966427412,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 86 | 0.000303319190523,0.000302965669129,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 87 | 0.000303319190523,0.00030296522654,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 88 | 0.000303319190523,0.00030296493881,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 89 | 0.000303319190523,0.000302964174256,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 90 | 0.000303319190523,0.000302963808164,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 91 | 0.000303319190523,0.000302963335856,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 92 | 0.000303319190523,0.000302963013022,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 93 | 0.000303319190523,0.000302962671061,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 94 | 0.000303319190523,0.000302962197373,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 95 | 0.000303319190523,0.000302961819713,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 96 | 0.000303319190523,0.000302961273142,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 97 | 0.000303319190523,0.000302960843609,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 98 | 0.000303319190523,0.000302960519804,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 99 | 0.000303319190523,0.000302959991244,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 100 | 0.000303319190523,0.000302959744134,0.000302809990748,0.000302617020421,0.000303124329143,0.000303462141301 101 | -------------------------------------------------------------------------------- /drafts/draw/error_eu_SL5.csv: -------------------------------------------------------------------------------- 1 | 0.000276806543497,0.00027814206304,0.000279979589687,0.000279024648739,0.000279592441787,0.000279723137402 2 | 0.000276806543497,0.00027814206304,0.000279775471408,0.000279024648739,0.000279592441787,0.000279723137402 3 | 0.000276806543497,0.000277957716912,0.000279775471408,0.000279024648739,0.000279592441787,0.000279723137402 4 | 0.000276806543497,0.000277957716912,0.000278595880834,0.000278047327436,0.000279592441787,0.000279723137402 5 | 0.000276806543497,0.000277203686973,0.000278595880834,0.000277865841838,0.000279592441787,0.000279723137402 6 | 0.000276806543497,0.000277203686973,0.000277616876218,0.000277865841838,0.000279592441787,0.000279723137402 7 | 0.000276806543497,0.000277203686973,0.000277616876218,0.000277865841838,0.000279197752444,0.000279723137402 8 | 0.000276806543497,0.000277203686973,0.000277616876218,0.000277865841838,0.000278645606233,0.000279723137402 9 | 0.000276806543497,0.000277203686973,0.000277616876218,0.000277319894004,0.000278645606233,0.000279694913795 10 | 0.000276806543497,0.000277203686973,0.000277616876218,0.000277319894004,0.000278351402753,0.000279694913795 11 | 0.000276806543497,0.000277203686973,0.000277588249748,0.000277319894004,0.000278351402753,0.000279694840173 12 | 0.000276806543497,0.000277203686973,0.000277588249748,0.000277319894004,0.000278236754395,0.000279694840173 13 | 0.000276806543497,0.000277203686973,0.000276542125685,0.000277319894004,0.000277548982186,0.000279694840173 14 | 0.000276806543497,0.000277203686973,0.000276542125685,0.000277319894004,0.000277548982186,0.000279694840173 15 | 0.000276806543497,0.000277203686973,0.000276542125685,0.000277319894004,0.000277548982186,0.000279694840173 16 | 0.000276806543497,0.000277203686973,0.000276542125685,0.000277319894004,0.000277548982186,0.000279694840173 17 | 0.000276806543497,0.000277203686973,0.000276542125685,0.00027683796093,0.000277548982186,0.000279694840173 18 | 0.000276806543497,0.000277203686973,0.000276542125685,0.000276637305714,0.000277548982186,0.000279694840173 19 | 0.000276806543497,0.000277203686973,0.000276542125685,0.000275826823352,0.000277548982186,0.000279694840173 20 | 0.000276806543497,0.000277035627565,0.000276542125685,0.000275389912404,0.000277548982186,0.000279694840173 21 | 0.000276806543497,0.000276736521004,0.000276542125685,0.000275389912404,0.000277548982186,0.000279694840173 22 | 0.000276806543497,0.00027672328667,0.000276542125685,0.000275389912404,0.000277548982186,0.000279694840173 23 | 0.000276806543497,0.00027672328667,0.000276542125685,0.000275389912404,0.000277548982186,0.000279694840173 24 | 0.000276806543497,0.00027672328667,0.000276542125685,0.000275389912404,0.000277548982186,0.000279694840173 25 | 0.000276806543497,0.000276607857202,0.000276160183716,0.000275388027776,0.000277548982186,0.000279694840173 26 | 0.000276806543497,0.000276607857202,0.000276160183716,0.000275326644857,0.000277443731313,0.000279694840173 27 | 0.000276806543497,0.000276607857202,0.000276160183716,0.000275315338888,0.000277443731313,0.000279694840173 28 | 0.000276806543497,0.000276607857202,0.000276160183716,0.000275315338888,0.000277223152435,0.000279694840173 29 | 0.000276806543497,0.000276607857202,0.000276160183716,0.000275315338888,0.000277223152435,0.000279694840173 30 | 0.000276806543497,0.000276607857202,0.000276160183716,0.000275315338888,0.000277223152435,0.000279694840173 31 | 0.000276806543497,0.000276607857202,0.000276160183716,0.000275315338888,0.000277223152435,0.000279694840173 32 | 0.000276806543497,0.000276450710393,0.000276160183716,0.000275315338888,0.000277223152435,0.000279694840173 33 | 0.000276806543497,0.000276450710393,0.000276160183716,0.000275315338888,0.000277223152435,0.000279694840173 34 | 0.000276806543497,0.000276114645134,0.000276160183716,0.000275315338888,0.000276235954695,0.000279694840173 35 | 0.000276806543497,0.000276114645134,0.000276160183716,0.000275315338888,0.000276235954695,0.000279694840173 36 | 0.000276806543497,0.000276065254953,0.000276160183716,0.000275315338888,0.000276235954695,0.000279694840173 37 | 0.000276806543497,0.000275893411317,0.000276160183716,0.000275315338888,0.000276235954695,0.000279694840173 38 | 0.000276806543497,0.000275818518741,0.000276160183716,0.000275315338888,0.000276235954695,0.000279694840173 39 | 0.000276806543497,0.000275818518741,0.000276160183716,0.000275315338888,0.000276235954695,0.000279694840173 40 | 0.000276806543497,0.000275818518741,0.000276160183716,0.000275315338888,0.000276235954695,0.000279694840173 41 | 0.000276806543497,0.000275818518741,0.000275607274784,0.000275315338888,0.000276235954695,0.000279694840173 42 | 0.000276806543497,0.000275803889125,0.000275607274784,0.000275315338888,0.000276235954695,0.000279694840173 43 | 0.000276806543497,0.000275779076569,0.000275607274784,0.000275315338888,0.000276235954695,0.000279694840173 44 | 0.000276806543497,0.000275779076569,0.000275607274784,0.000275315338888,0.000276235954695,0.000279694840173 45 | 0.000276806543497,0.000275738682765,0.000275607274784,0.000275315338888,0.000276235954695,0.000279694840173 46 | 0.000276806543497,0.000275665075419,0.000275607274784,0.000275315338888,0.000276235954695,0.000279694840173 47 | 0.000276806543497,0.000275624070177,0.000275607274784,0.000275315338888,0.000276235954695,0.000279694840173 48 | 0.000276806543497,0.000275615745961,0.000275607274784,0.000275315338888,0.000276235954695,0.000279694840173 49 | 0.000276806543497,0.000275596240067,0.000275607274784,0.000275315338888,0.000276235954695,0.000279694840173 50 | 0.000276806543497,0.000275570187116,0.000275607274784,0.000275315338888,0.000276025832987,0.000279694840173 51 | 0.000276806543497,0.000275537294307,0.000275607274784,0.000275315338888,0.000276025832987,0.000279694840173 52 | 0.000276806543497,0.000275537294307,0.000275607274784,0.000275315338888,0.000276025832987,0.000279694840173 53 | 0.000276806543497,0.000275524783506,0.000275607274784,0.000275315338888,0.000276025832987,0.000279694840173 54 | 0.000276806543497,0.000275489191364,0.000275607274784,0.000275315338888,0.000276025832987,0.000279694840173 55 | 0.000276806543497,0.000275475460114,0.000275607274784,0.000275315338888,0.000276025832987,0.000279694840173 56 | 0.000276576277383,0.000275471627093,0.000275607274784,0.000275315338888,0.000276025832987,0.000279694840173 57 | 0.000276576277383,0.000275471627093,0.000275607274784,0.000275315338888,0.000276025832987,0.000279694840173 58 | 0.000276576277383,0.000275451212212,0.000275607274784,0.000275315338888,0.000276025832987,0.000279694840173 59 | 0.000276576277383,0.000275445224633,0.000275607274784,0.000275315338888,0.000276025832987,0.000279694840173 60 | 0.000276576277383,0.000275442991862,0.000275607274784,0.000275315338888,0.000276025832987,0.000279694840173 61 | 0.000276576277383,0.00027543620698,0.000275607274784,0.000275315338888,0.000276025832987,0.000277821976331 62 | 0.000276576277383,0.000275433097612,0.000275607274784,0.000275315338888,0.000276025832987,0.000277821976331 63 | 0.000276576277383,0.000275403128434,0.000275607274784,0.000275315338888,0.000276025832987,0.000277821976331 64 | 0.000276576277383,0.000275399638458,0.000275607274784,0.000275315338888,0.000276025832987,0.000277821976331 65 | 0.000276576277383,0.000275381366006,0.000275607274784,0.000275315338888,0.000276025832987,0.000277821976331 66 | 0.000276576277383,0.000275370682671,0.000275607274784,0.000275315338888,0.000276025832987,0.000277821976331 67 | 0.000276576277383,0.000275368008826,0.000275607274784,0.000275315338888,0.000276025832987,0.000277821976331 68 | 0.000276576277383,0.000275365260154,0.000275234230159,0.000275315338888,0.000276025832987,0.000277821976331 69 | 0.000276576277383,0.000275364035021,0.000274008267527,0.000275315338888,0.000276025832987,0.000277821976331 70 | 0.000276576277383,0.000275362292067,0.000274008267527,0.000275315338888,0.000276025832987,0.000277821976331 71 | 0.000276576277383,0.00027536107055,0.000274008267527,0.000275315338888,0.000276025832987,0.000277821976331 72 | 0.000276576277383,0.000275357013982,0.000274008267527,0.000275315338888,0.000276025832987,0.000277821976331 73 | 0.000276576277383,0.000275356008866,0.000274008267527,0.000275315338888,0.00027579470301,0.000277821976331 74 | 0.000276576277383,0.000275352355348,0.000274008267527,0.000275315338888,0.00027579470301,0.000277821976331 75 | 0.000276576277383,0.00027535186382,0.000274008267527,0.000275315338888,0.00027579470301,0.000277821976331 76 | 0.000276576277383,0.000275346397093,0.000274008267527,0.000275315338888,0.00027579470301,0.000277821976331 77 | 0.000276576277383,0.000275342431894,0.000274008267527,0.000275315338888,0.00027579470301,0.000277821976331 78 | 0.000276576277383,0.000275340791519,0.000274008267527,0.000275315338888,0.00027579470301,0.000277821976331 79 | 0.000276576277383,0.000275340184828,0.000274008267527,0.000275315338888,0.00027579470301,0.000277821976331 80 | 0.000276576277383,0.000275339023376,0.000274008267527,0.000275315338888,0.00027548781654,0.000277821976331 81 | 0.000276576277383,0.000275338024212,0.000274008267527,0.000275315338888,0.00027548781654,0.000277821976331 82 | 0.000276576277383,0.000275337554824,0.000274008267527,0.000275315338888,0.00027548781654,0.000277821976331 83 | 0.000276576277383,0.000275337277314,0.000274008267527,0.000275315338888,0.00027548781654,0.000277821976331 84 | 0.000276576277383,0.000275336691089,0.000274008267527,0.000275315338888,0.00027548781654,0.000277821976331 85 | 0.000276116677595,0.000275336631316,0.000274008267527,0.000275315338888,0.00027548781654,0.000277821976331 86 | 0.000276116677595,0.000275336391299,0.000273709285849,0.000275315338888,0.00027548781654,0.000277821976331 87 | 0.000276116677595,0.000275336376032,0.000273709285849,0.000275315338888,0.00027548781654,0.000277821976331 88 | 0.000276116677595,0.00027533623811,0.000273709285849,0.000275315338888,0.00027548781654,0.000277821976331 89 | 0.000276116677595,0.000275336167796,0.000273709285849,0.000275315338888,0.00027548781654,0.000277821976331 90 | 0.000276116677595,0.000275336064119,0.000273709285849,0.000275315338888,0.00027548781654,0.000277821976331 91 | 0.000276116677595,0.000275335960483,0.000273709285849,0.000275315338888,0.00027548781654,0.000277821976331 92 | 0.000276116677595,0.000275335775618,0.000273709285849,0.000275315338888,0.00027548781654,0.000277821976331 93 | 0.000276116677595,0.000275335647154,0.000273709285849,0.000275315338888,0.00027548781654,0.000277821976331 94 | 0.000276116677595,0.000275335644352,0.000273709285849,0.000275315338888,0.00027548781654,0.000277821976331 95 | 0.000276116677595,0.000275335617229,0.000273709285849,0.000275315338888,0.00027548781654,0.000277821976331 96 | 0.000276116677595,0.00027533557135,0.000273709285849,0.000275315338888,0.00027548781654,0.000277821976331 97 | 0.000276116677595,0.00027533553863,0.000273709285849,0.000275315338888,0.00027548781654,0.000277821976331 98 | 0.000276116677595,0.0002753354964,0.000273709285849,0.000275315338888,0.00027548781654,0.000277821976331 99 | 0.000276116677595,0.000275335479001,0.000273342828401,0.000275315338888,0.00027548781654,0.000277821976331 100 | 0.000276116677595,0.000275335383717,0.000273342828401,0.000275315338888,0.00027548781654,0.000277821976331 101 | -------------------------------------------------------------------------------- /drafts/draw/error_uk_SL2.csv: -------------------------------------------------------------------------------- 1 | 8.71290940997718E-05,8.72829988627154E-05,8.72526301767122E-05,8.72245229001253E-05,8.73401391312265E-05,8.73019087470364E-05 2 | 8.71120329908825E-05,8.72098179976686E-05,8.72526301767122E-05,8.72245229001253E-05,8.73401391312265E-05,8.73019087470364E-05 3 | 8.71120329908825E-05,8.71749435197861E-05,8.72526301767122E-05,8.72245229001253E-05,8.73401391312265E-05,8.73019087470364E-05 4 | 8.71120329908825E-05,8.71749435197861E-05,8.71511915391209E-05,8.71840260261023E-05,8.73401391312265E-05,8.73019087470364E-05 5 | 8.70191912684657E-05,8.7008345496509E-05,8.70296058074363E-05,8.71840260261023E-05,8.73401391312265E-05,8.73019087470364E-05 6 | 8.70191912684657E-05,8.7008345496509E-05,8.70296058074363E-05,8.71840260261023E-05,8.72427100419283E-05,8.73019087470364E-05 7 | 8.70191912684657E-05,8.69862085550522E-05,8.70296058074363E-05,8.71840260261023E-05,8.72022221662699E-05,8.73019087470364E-05 8 | 8.70191912684657E-05,8.69862085550522E-05,8.70296058074363E-05,8.71840260261023E-05,8.72022221662699E-05,8.73019087470364E-05 9 | 8.70191912684657E-05,8.69862085550522E-05,8.70296058074363E-05,8.71840260261023E-05,8.72022221662699E-05,8.72412844962189E-05 10 | 8.70191912684657E-05,8.69862085550522E-05,8.70296058074363E-05,8.70615978942065E-05,8.72022221662699E-05,8.72412844962189E-05 11 | 8.70191912684657E-05,8.69844563585818E-05,8.70296058074363E-05,8.70615978942065E-05,8.72022221662699E-05,8.72408992275702E-05 12 | 8.70191912684657E-05,8.69844563585818E-05,8.70296058074363E-05,8.70541410455808E-05,8.7060408243817E-05,8.72408992275702E-05 13 | 8.70191912684657E-05,8.69844563585818E-05,8.70296058074363E-05,8.70541410455808E-05,8.69923094993539E-05,8.71279383991692E-05 14 | 8.70191912684657E-05,8.69844563585818E-05,8.70296058074363E-05,8.70541410455808E-05,8.69923094993539E-05,8.71279383991692E-05 15 | 8.70191912684657E-05,8.69770620574485E-05,8.70296058074363E-05,8.70541410455808E-05,8.69923094993539E-05,8.71279383991692E-05 16 | 8.70191912684657E-05,8.69721020050187E-05,8.70296058074363E-05,8.70541410455808E-05,8.69923094993539E-05,8.71279383991692E-05 17 | 8.70191912684657E-05,8.69721020050187E-05,8.70194915058727E-05,8.70541410455808E-05,8.69923094993539E-05,8.71279383991692E-05 18 | 8.70191912684657E-05,8.69721020050187E-05,8.70194915058727E-05,8.70541410455808E-05,8.69923094993539E-05,8.71279383991692E-05 19 | 8.70191912684657E-05,8.69721020050187E-05,8.70194915058727E-05,8.70541410455808E-05,8.69923094993539E-05,8.71279383991692E-05 20 | 8.70191912684657E-05,8.69721020050187E-05,8.70194915058727E-05,8.70541410455808E-05,8.69923094993539E-05,8.71279383991692E-05 21 | 8.70191912684657E-05,8.69721020050187E-05,8.70194915058727E-05,8.70541410455808E-05,8.69923094993539E-05,8.71279383991692E-05 22 | 8.70191912684657E-05,8.6944316815105E-05,8.70194915058727E-05,8.70541410455808E-05,8.69923094993539E-05,8.71279383991692E-05 23 | 8.70191912684657E-05,8.6944316815105E-05,8.70194915058727E-05,8.69956133818152E-05,8.69923094993539E-05,8.71160937595166E-05 24 | 8.70191912684657E-05,8.6944316815105E-05,8.70194915058727E-05,8.69956133818152E-05,8.69923094993539E-05,8.71123997334618E-05 25 | 8.70191912684657E-05,8.6944316815105E-05,8.70194915058727E-05,8.69956133818152E-05,8.69923094993539E-05,8.7112361620418E-05 26 | 8.70191912684657E-05,8.6944316815105E-05,8.70194915058727E-05,8.69956133818152E-05,8.69923094993539E-05,8.7112361620418E-05 27 | 8.70191912684657E-05,8.6944316815105E-05,8.70194915058727E-05,8.69956133818152E-05,8.69923094993539E-05,8.7112361620418E-05 28 | 8.70191912684657E-05,8.6944316815105E-05,8.70194915058727E-05,8.69956133818152E-05,8.69923094993539E-05,8.7112361620418E-05 29 | 8.70191912684657E-05,8.69435811870649E-05,8.70004346410519E-05,8.69907773120888E-05,8.69923094993539E-05,8.7112361620418E-05 30 | 8.70191912684657E-05,8.69435811870649E-05,8.70004346410519E-05,8.69907773120888E-05,8.69923094993539E-05,8.7112361620418E-05 31 | 8.70191912684657E-05,8.69435811870649E-05,8.70004346410519E-05,8.69907773120888E-05,8.69923094993539E-05,8.7112361620418E-05 32 | 8.70191912684657E-05,8.69411504727453E-05,8.68341111934454E-05,8.69907773120888E-05,8.69854597935672E-05,8.7112361620418E-05 33 | 8.70191912684657E-05,8.69391342866528E-05,8.68341111934454E-05,8.69907773120888E-05,8.69854597935672E-05,8.7112361620418E-05 34 | 8.70191912684657E-05,8.69391342866528E-05,8.68341111934454E-05,8.69907773120888E-05,8.69854597935672E-05,8.7112361620418E-05 35 | 8.70191912684657E-05,8.69389445594605E-05,8.68341111934454E-05,8.69907773120888E-05,8.69854597935672E-05,8.7112361620418E-05 36 | 8.70191912684657E-05,8.6938337997297E-05,8.68341111934454E-05,8.69907773120888E-05,8.69854597935672E-05,8.7112361620418E-05 37 | 8.70191912684657E-05,8.69365225302318E-05,8.68341111934454E-05,8.69907773120888E-05,8.69854597935672E-05,8.7112361620418E-05 38 | 8.70191912684657E-05,8.69365225302318E-05,8.68341111934454E-05,8.69907773120888E-05,8.69854597935672E-05,8.7112361620418E-05 39 | 8.70191912684657E-05,8.69292419892447E-05,8.68341111934454E-05,8.69907773120888E-05,8.69854597935672E-05,8.7112361620418E-05 40 | 8.70191912684657E-05,8.69278986871107E-05,8.68341111934454E-05,8.69907773120888E-05,8.69854597935672E-05,8.7112361620418E-05 41 | 8.70191912684657E-05,8.69274015341695E-05,8.68341111934454E-05,8.69274701874845E-05,8.69854597935672E-05,8.7112361620418E-05 42 | 8.70191912684657E-05,8.69252782048009E-05,8.68341111934454E-05,8.69274701874845E-05,8.69854597935672E-05,8.70769463161761E-05 43 | 8.70191912684657E-05,8.69216095973722E-05,8.68341111934454E-05,8.69274701874845E-05,8.69854597935672E-05,8.7074207966631E-05 44 | 8.70191912684657E-05,8.69162969991166E-05,8.68341111934454E-05,8.69274701874845E-05,8.69854597935672E-05,8.69607100406098E-05 45 | 8.70191912684657E-05,8.69146946177459E-05,8.68341111934454E-05,8.69274701874845E-05,8.68431053271841E-05,8.69607100406098E-05 46 | 8.70191912684657E-05,8.69146946177459E-05,8.68341111934454E-05,8.69274701874845E-05,8.68431053271841E-05,8.6952998824463E-05 47 | 8.70191912684657E-05,8.69142809897516E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.69427622822065E-05 48 | 8.70191912684657E-05,8.69134214631027E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.69361123474368E-05 49 | 8.70191912684657E-05,8.69117522248164E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.69353615571978E-05 50 | 8.70191912684657E-05,8.69112273933814E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.69334809715457E-05 51 | 8.70191912684657E-05,8.69104298608769E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.69287111361849E-05 52 | 8.70191912684657E-05,8.69102411404832E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.69287111361849E-05 53 | 8.70191912684657E-05,8.6909308227422E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.69164234746643E-05 54 | 8.70191912684657E-05,8.69083317602706E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68915977985543E-05 55 | 8.70191912684657E-05,8.69078504181888E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 56 | 8.70191912684657E-05,8.69074776500437E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 57 | 8.70191912684657E-05,8.69066717777117E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 58 | 8.70191912684657E-05,8.69048795435179E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 59 | 8.70191912684657E-05,8.69047717912044E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 60 | 8.70191912684657E-05,8.69041554643211E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 61 | 8.70191912684657E-05,8.69034073354737E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 62 | 8.70191912684657E-05,8.6902708359082E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 63 | 8.70191912684657E-05,8.69014487712692E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 64 | 8.70191912684657E-05,8.69001749013828E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 65 | 8.70191912684657E-05,8.69000246113924E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 66 | 8.70191912684657E-05,8.68996316499612E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 67 | 8.70191912684657E-05,8.68994840241486E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 68 | 8.70191912684657E-05,8.68994759865394E-05,8.68341111934454E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 69 | 8.70191912684657E-05,8.68994470013006E-05,8.68080954974169E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 70 | 8.70191912684657E-05,8.68994470013006E-05,8.68080954974169E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 71 | 8.70191912684657E-05,8.68994245622938E-05,8.68080954974169E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 72 | 8.70191912684657E-05,8.68994093208077E-05,8.68080954974169E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 73 | 8.70191912684657E-05,8.6899392156597E-05,8.68080954974169E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 74 | 8.70191912684657E-05,8.68993906229689E-05,8.68080954974169E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 75 | 8.70191912684657E-05,8.68993873104272E-05,8.68080954974169E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 76 | 8.70191912684657E-05,8.68993873104272E-05,8.68080954974169E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 77 | 8.70191912684657E-05,8.68993812251436E-05,8.68080954974169E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 78 | 8.70191912684657E-05,8.68993773737817E-05,8.68080954974169E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 79 | 8.70191912684657E-05,8.689937371736E-05,8.68080954974169E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 80 | 8.70191912684657E-05,8.68993718100615E-05,8.68080954974169E-05,8.69274701874845E-05,8.68428026118013E-05,8.68884476877834E-05 81 | 8.70191912684657E-05,8.68993586568E-05,8.68080954974169E-05,8.69274701874845E-05,8.67047974538102E-05,8.68884476877834E-05 82 | 8.70191912684657E-05,8.68993508099603E-05,8.68080954974169E-05,8.69274701874845E-05,8.67047974538102E-05,8.68884476877834E-05 83 | 8.70191912684657E-05,8.68993478132265E-05,8.68080954974169E-05,8.69274701874845E-05,8.67047974538102E-05,8.68884476877834E-05 84 | 8.70191912684657E-05,8.68993464537702E-05,8.68080954974169E-05,8.69274701874845E-05,8.67047974538102E-05,8.68884476877834E-05 85 | 8.70191912684657E-05,8.68993385248468E-05,8.68080954974169E-05,8.69274701874845E-05,8.67047974538102E-05,8.68884476877834E-05 86 | 8.70191912684657E-05,8.689933291681E-05,8.68080954974169E-05,8.69274701874845E-05,8.67047974538102E-05,8.68884476877834E-05 87 | 8.70191912684657E-05,8.6899329754794E-05,8.68080954974169E-05,8.69274701874845E-05,8.67047974538102E-05,8.68884476877834E-05 88 | 8.70191912684657E-05,8.68993240130513E-05,8.68080954974169E-05,8.69274701874845E-05,8.67047974538102E-05,8.68884476877834E-05 89 | 8.70191912684657E-05,8.68993181580683E-05,8.68080954974169E-05,8.69274701874845E-05,8.67047974538102E-05,8.68884476877834E-05 90 | 8.70191912684657E-05,8.68993131113498E-05,8.68080954974169E-05,8.69274701874845E-05,8.67047974538102E-05,8.68884476877834E-05 91 | 8.70191912684657E-05,8.6899308637719E-05,8.68080954974169E-05,8.69274701874845E-05,8.67047974538102E-05,8.68884476877834E-05 92 | 8.70191912684657E-05,8.68993047649151E-05,8.68080954974169E-05,8.68719249834552E-05,8.67047974538102E-05,8.68884476877834E-05 93 | 8.70191912684657E-05,8.68993027631627E-05,8.68080954974169E-05,8.68719249834552E-05,8.67047974538102E-05,8.68884476877834E-05 94 | 8.70191912684657E-05,8.68993000933562E-05,8.68080954974169E-05,8.68087654732997E-05,8.67047974538102E-05,8.68884476877834E-05 95 | 8.70191912684657E-05,8.68992970623063E-05,8.68080954974169E-05,8.68087654732997E-05,8.67047974538102E-05,8.68884476877834E-05 96 | 8.70191912684657E-05,8.68992950074876E-05,8.68080954974169E-05,8.68087654732997E-05,8.67047974538102E-05,8.68884476877834E-05 97 | 8.70191912684657E-05,8.68992925154405E-05,8.68080954974169E-05,8.68087654732997E-05,8.67047974538102E-05,8.68884476877834E-05 98 | 8.69688712099846E-05,8.68992909858624E-05,8.68080954974169E-05,8.68087654732997E-05,8.67047974538102E-05,8.67422657442673E-05 99 | 8.6853070521409E-05,8.68992890933785E-05,8.68080954974169E-05,8.68087654732997E-05,8.67047974538102E-05,8.66186855663482E-05 100 | 8.6853070521409E-05,8.68992880652692E-05,8.68080954974169E-05,8.68087654732997E-05,8.67047974538102E-05,8.66186855663482E-05 101 | -------------------------------------------------------------------------------- /drafts/draw/error_uk_SL5.csv: -------------------------------------------------------------------------------- 1 | 8.05022428504292E-05,7.97584434544739E-05,8.00938924872561E-05,8.01963192755117E-05,8.01973717875252E-05,8.04517519868305E-05 2 | 8.05022428504292E-05,7.97584434544739E-05,8.00938924872561E-05,7.99089250235218E-05,8.01973717875252E-05,8.04517519868305E-05 3 | 8.05022428504292E-05,7.9648271798513E-05,7.99191735819916E-05,7.98412483866412E-05,8.0121593664403E-05,8.04517519868305E-05 4 | 8.02733965176247E-05,7.96083120375044E-05,7.98119494006957E-05,7.98412483866412E-05,8.00995753563147E-05,8.04517519868305E-05 5 | 8.02733965176247E-05,7.95736666468386E-05,7.98119494006957E-05,7.97945665559348E-05,7.99588577784697E-05,8.04517519868305E-05 6 | 8.02733965176247E-05,7.95736666468386E-05,7.97278912316135E-05,7.93675066832773E-05,7.99588577784697E-05,8.01730572669157E-05 7 | 8.02733965176247E-05,7.95736666468386E-05,7.97278912316135E-05,7.93675066832773E-05,7.98466120914774E-05,8.01730572669157E-05 8 | 8.02733965176247E-05,7.95736666468386E-05,7.97278912316135E-05,7.93675066832773E-05,7.97637116306534E-05,8.01730572669157E-05 9 | 8.02733965176247E-05,7.95736666468386E-05,7.96025968944087E-05,7.93675066832773E-05,7.97637116306534E-05,8.01730572669157E-05 10 | 8.02733965176247E-05,7.95736666468386E-05,7.95799018886997E-05,7.93675066832773E-05,7.95691664262737E-05,8.01730572669157E-05 11 | 8.02733965176247E-05,7.95736666468386E-05,7.95799018886997E-05,7.93675066832773E-05,7.95691664262737E-05,8.01730572669157E-05 12 | 8.02733965176247E-05,7.95736666468386E-05,7.95799018886997E-05,7.93675066832773E-05,7.95691664262737E-05,8.01730572669157E-05 13 | 7.99723008415629E-05,7.95736666468386E-05,7.95799018886997E-05,7.93675066832773E-05,7.95691664262737E-05,8.01358310572524E-05 14 | 7.99723008415629E-05,7.95736666468386E-05,7.94509716417189E-05,7.93675066832773E-05,7.95691664262737E-05,8.01358310572524E-05 15 | 7.99723008415629E-05,7.95736666468386E-05,7.94509716417189E-05,7.93675066832773E-05,7.95691664262737E-05,8.01358123217628E-05 16 | 7.99723008415629E-05,7.93671742874743E-05,7.94509716417189E-05,7.93675066832773E-05,7.95691664262737E-05,8.01069677592614E-05 17 | 7.99723008415629E-05,7.93671742874743E-05,7.94509716417189E-05,7.93675066832773E-05,7.95691664262737E-05,8.01069677592614E-05 18 | 7.99723008415629E-05,7.93671742874743E-05,7.94509716417189E-05,7.93675066832773E-05,7.95691664262737E-05,8.01069677592614E-05 19 | 7.99723008415629E-05,7.93671742874743E-05,7.94509716417189E-05,7.93675066832773E-05,7.95691664262737E-05,8.01056028184777E-05 20 | 7.99723008415629E-05,7.93671742874743E-05,7.94509716417189E-05,7.93675066832773E-05,7.94167519763932E-05,8.00886798238984E-05 21 | 7.99723008415629E-05,7.93671742874743E-05,7.94509716417189E-05,7.93675066832773E-05,7.94167519763932E-05,8.00886798238984E-05 22 | 7.99723008415629E-05,7.93450565928437E-05,7.94509716417189E-05,7.93675066832773E-05,7.94167519763932E-05,8.00886798238984E-05 23 | 7.99723008415629E-05,7.93308746284872E-05,7.93347299954634E-05,7.93675066832773E-05,7.94167519763932E-05,8.00886798238984E-05 24 | 7.99723008415629E-05,7.93308746284872E-05,7.93347299954634E-05,7.92044121703178E-05,7.94167519763932E-05,8.00886798238984E-05 25 | 7.99723008415629E-05,7.93308746284872E-05,7.93347299954634E-05,7.92044121703178E-05,7.94167519763932E-05,8.00886798238984E-05 26 | 7.99723008415629E-05,7.92374573263199E-05,7.93347299954634E-05,7.92044121703178E-05,7.94167519763932E-05,8.00886798238984E-05 27 | 7.99723008415629E-05,7.92374573263199E-05,7.93347299954634E-05,7.92044121703178E-05,7.94167519763932E-05,8.00886798238984E-05 28 | 7.99723008415629E-05,7.92374573263199E-05,7.93347299954634E-05,7.92044121703178E-05,7.94067580687072E-05,8.00886798238984E-05 29 | 7.99723008415629E-05,7.92374573263199E-05,7.93347299954634E-05,7.92044121703178E-05,7.93730862639741E-05,8.00886798238984E-05 30 | 7.99723008415629E-05,7.92374573263199E-05,7.93347299954634E-05,7.91906232269846E-05,7.93730862639741E-05,8.00886798238984E-05 31 | 7.99723008415629E-05,7.92374573263199E-05,7.93347299954634E-05,7.91906232269846E-05,7.93730862639741E-05,8.00886798238984E-05 32 | 7.99723008415629E-05,7.92374573263199E-05,7.93347299954634E-05,7.91906232269846E-05,7.93730862639741E-05,8.00886798238984E-05 33 | 7.99723008415629E-05,7.92242709312677E-05,7.93347299954634E-05,7.91906232269846E-05,7.93730862639741E-05,8.00886798238984E-05 34 | 7.99723008415629E-05,7.92242709312677E-05,7.93347299954634E-05,7.91906232269846E-05,7.93730862639741E-05,8.00886798238984E-05 35 | 7.99723008415629E-05,7.92158108922208E-05,7.93347299954634E-05,7.91906232269846E-05,7.93730862639741E-05,8.00886798238984E-05 36 | 7.99723008415629E-05,7.92158108922208E-05,7.93347299954634E-05,7.91906232269846E-05,7.93730862639741E-05,8.00886798238984E-05 37 | 7.99723008415629E-05,7.92158108922208E-05,7.93347299954634E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 38 | 7.99723008415629E-05,7.91938314779334E-05,7.93347299954634E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 39 | 7.99723008415629E-05,7.91938314779334E-05,7.93347299954634E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 40 | 7.99723008415629E-05,7.91929150656492E-05,7.93347299954634E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 41 | 7.99723008415629E-05,7.91929150656492E-05,7.93347299954634E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 42 | 7.99723008415629E-05,7.91929150656492E-05,7.93347299954634E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 43 | 7.99723008415629E-05,7.91826129230831E-05,7.93347299954634E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 44 | 7.99723008415629E-05,7.91822995404805E-05,7.93347299954634E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 45 | 7.99723008415629E-05,7.91760879975954E-05,7.93347299954634E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 46 | 7.99723008415629E-05,7.91760879975954E-05,7.9191373981185E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 47 | 7.99723008415629E-05,7.91760879975954E-05,7.9191373981185E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 48 | 7.99723008415629E-05,7.91760879975954E-05,7.9191373981185E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 49 | 7.99723008415629E-05,7.91728633903491E-05,7.9191373981185E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 50 | 7.99723008415629E-05,7.91724967371151E-05,7.9191373981185E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 51 | 7.99723008415629E-05,7.91682636633313E-05,7.9191373981185E-05,7.91906232269846E-05,7.9119563681925E-05,8.00886798238984E-05 52 | 7.99723008415629E-05,7.91589974828787E-05,7.9191373981185E-05,7.91906232269846E-05,7.9119563681925E-05,7.99709480127813E-05 53 | 7.99723008415629E-05,7.91486340308902E-05,7.9191373981185E-05,7.91906232269846E-05,7.9119563681925E-05,7.99249151104498E-05 54 | 7.99723008415629E-05,7.91470184484006E-05,7.9191373981185E-05,7.91906232269846E-05,7.9119563681925E-05,7.99249126507008E-05 55 | 7.99723008415629E-05,7.91447037592063E-05,7.9191373981185E-05,7.91707002653694E-05,7.9119563681925E-05,7.99249126507008E-05 56 | 7.99723008415629E-05,7.91447037592063E-05,7.91180236224282E-05,7.91707002653694E-05,7.9119563681925E-05,7.99249126507008E-05 57 | 7.99723008415629E-05,7.91421474041784E-05,7.91180236224282E-05,7.91707002653694E-05,7.9119563681925E-05,7.99249126507008E-05 58 | 7.99723008415629E-05,7.91403174316204E-05,7.91180236224282E-05,7.91707002653694E-05,7.9119563681925E-05,7.99249126507008E-05 59 | 7.99723008415629E-05,7.91364427999342E-05,7.91180236224282E-05,7.91707002653694E-05,7.9119563681925E-05,7.99249126507008E-05 60 | 7.99723008415629E-05,7.91299686777095E-05,7.91180236224282E-05,7.91707002653694E-05,7.9119563681925E-05,7.99249126507008E-05 61 | 7.99723008415629E-05,7.91259051240002E-05,7.90618034205117E-05,7.91707002653694E-05,7.9119563681925E-05,7.99249126507008E-05 62 | 7.99723008415629E-05,7.91256996395508E-05,7.90618034205117E-05,7.91373187285853E-05,7.9119563681925E-05,7.99249126507008E-05 63 | 7.99723008415629E-05,7.91245460764696E-05,7.90618034205117E-05,7.91373187285853E-05,7.9119563681925E-05,7.99249126507008E-05 64 | 7.99723008415629E-05,7.91224827316857E-05,7.90618034205117E-05,7.91373187285853E-05,7.9119563681925E-05,7.99249126507008E-05 65 | 7.99723008415629E-05,7.91214863215059E-05,7.90618034205117E-05,7.91373187285853E-05,7.9119563681925E-05,7.99249126507008E-05 66 | 7.99723008415629E-05,7.91211151126136E-05,7.90618034205117E-05,7.91373187285853E-05,7.9119563681925E-05,7.99249126507008E-05 67 | 7.99723008415629E-05,7.91177359053554E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 68 | 7.99723008415629E-05,7.91164377329058E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 69 | 7.99723008415629E-05,7.91149353399996E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 70 | 7.99723008415629E-05,7.911446138747E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 71 | 7.98989474432739E-05,7.91126074505575E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 72 | 7.98989474432739E-05,7.91115795097819E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 73 | 7.98989474432739E-05,7.91095016422722E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 74 | 7.98989474432739E-05,7.91019064917534E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 75 | 7.98989474432739E-05,7.91002627549959E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 76 | 7.98989474432739E-05,7.90947275327161E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 77 | 7.98989474432739E-05,7.90934482482254E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 78 | 7.98989474432739E-05,7.9087925597829E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 79 | 7.98989474432739E-05,7.90856166380955E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 80 | 7.98989474432739E-05,7.90818099939606E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 81 | 7.98989474432739E-05,7.9080191300389E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 82 | 7.98989474432739E-05,7.90776258476293E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 83 | 7.98989474432739E-05,7.90763080767844E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 84 | 7.98989474432739E-05,7.90749836473672E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 85 | 7.98989474432739E-05,7.90734031309191E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 86 | 7.98989474432739E-05,7.90723412464368E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 87 | 7.98989474432739E-05,7.90714210758469E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 88 | 7.97668050687858E-05,7.90707012420222E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 89 | 7.97668050687858E-05,7.90699807555481E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 90 | 7.97668050687858E-05,7.90693106794446E-05,7.90618034205117E-05,7.91349624782285E-05,7.9119563681925E-05,7.99249126507008E-05 91 | 7.97668050687858E-05,7.90689021488584E-05,7.90618034205117E-05,7.91349624782285E-05,7.91000813813679E-05,7.99249126507008E-05 92 | 7.97668050687858E-05,7.90684961321156E-05,7.90618034205117E-05,7.91115256598339E-05,7.91000813813679E-05,7.99249126507008E-05 93 | 7.97668050687858E-05,7.90680541841775E-05,7.90618034205117E-05,7.91115256598339E-05,7.91000813813679E-05,7.99249126507008E-05 94 | 7.97668050687858E-05,7.90677542180144E-05,7.89756318644606E-05,7.91115256598339E-05,7.91000813813679E-05,7.99249126507008E-05 95 | 7.97668050687858E-05,7.90675722825706E-05,7.89756318644606E-05,7.90236475722871E-05,7.91000813813679E-05,7.99249126507008E-05 96 | 7.97668050687858E-05,7.90673727890084E-05,7.89756318644606E-05,7.90236475722871E-05,7.91000813813679E-05,7.99249126507008E-05 97 | 7.97668050687858E-05,7.90670707252239E-05,7.89756318644606E-05,7.90236475722871E-05,7.91000813813679E-05,7.99249126507008E-05 98 | 7.97668050687858E-05,7.9066864657867E-05,7.89756318644606E-05,7.90236475722871E-05,7.91000813813679E-05,7.99249126507008E-05 99 | 7.97668050687858E-05,7.9066697193479E-05,7.89756318644606E-05,7.90236475722871E-05,7.91000813813679E-05,7.99249126507008E-05 100 | 7.97668050687858E-05,7.90665378903151E-05,7.89756318644606E-05,7.90236475722871E-05,7.91000813813679E-05,7.99249126507008E-05 101 | -------------------------------------------------------------------------------- /drafts/draw/hehe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/hehe.png -------------------------------------------------------------------------------- /drafts/draw/img/abfo_elm_sl2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/abfo_elm_sl2.pdf -------------------------------------------------------------------------------- /drafts/draw/img/abfo_elm_sl5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/abfo_elm_sl5.pdf -------------------------------------------------------------------------------- /drafts/draw/img/de_elm_sl2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/de_elm_sl2.pdf -------------------------------------------------------------------------------- /drafts/draw/img/de_elm_sl5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/de_elm_sl5.pdf -------------------------------------------------------------------------------- /drafts/draw/img/elm_sl2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/elm_sl2.pdf -------------------------------------------------------------------------------- /drafts/draw/img/elm_sl5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/elm_sl5.pdf -------------------------------------------------------------------------------- /drafts/draw/img/error_eu_SL2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/error_eu_SL2.pdf -------------------------------------------------------------------------------- /drafts/draw/img/error_eu_SL5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/error_eu_SL5.pdf -------------------------------------------------------------------------------- /drafts/draw/img/error_uk_SL2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/error_uk_SL2.pdf -------------------------------------------------------------------------------- /drafts/draw/img/error_uk_SL5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/error_uk_SL5.pdf -------------------------------------------------------------------------------- /drafts/draw/img/ga_elm_sl2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/ga_elm_sl2.pdf -------------------------------------------------------------------------------- /drafts/draw/img/ga_elm_sl5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/ga_elm_sl5.pdf -------------------------------------------------------------------------------- /drafts/draw/img/mlnn_sl2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/mlnn_sl2.pdf -------------------------------------------------------------------------------- /drafts/draw/img/mlnn_sl5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/mlnn_sl5.pdf -------------------------------------------------------------------------------- /drafts/draw/img/otwo_elm_sl2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/otwo_elm_sl2.pdf -------------------------------------------------------------------------------- /drafts/draw/img/otwo_elm_sl5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/otwo_elm_sl5.pdf -------------------------------------------------------------------------------- /drafts/draw/img/pso_elm_sl2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/pso_elm_sl2.pdf -------------------------------------------------------------------------------- /drafts/draw/img/pso_elm_sl5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/pso_elm_sl5.pdf -------------------------------------------------------------------------------- /drafts/draw/img/two_elm_sl2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/two_elm_sl2.pdf -------------------------------------------------------------------------------- /drafts/draw/img/two_elm_sl5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/img/two_elm_sl5.pdf -------------------------------------------------------------------------------- /drafts/draw/k2k5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/k2k5.png -------------------------------------------------------------------------------- /drafts/draw/models.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/models.png -------------------------------------------------------------------------------- /drafts/draw/myplot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/myplot2.png -------------------------------------------------------------------------------- /drafts/draw/new/1otwo_elm_eu_sl5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/1otwo_elm_eu_sl5.jpg -------------------------------------------------------------------------------- /drafts/draw/new/1otwo_elm_eu_sl5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/1otwo_elm_eu_sl5.pdf -------------------------------------------------------------------------------- /drafts/draw/new/1otwo_elm_eu_sl5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/1otwo_elm_eu_sl5.png -------------------------------------------------------------------------------- /drafts/draw/new/2otwo_elm_eu_sl5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/2otwo_elm_eu_sl5.jpg -------------------------------------------------------------------------------- /drafts/draw/new/2otwo_elm_eu_sl5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/2otwo_elm_eu_sl5.pdf -------------------------------------------------------------------------------- /drafts/draw/new/2otwo_elm_eu_sl5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/2otwo_elm_eu_sl5.png -------------------------------------------------------------------------------- /drafts/draw/new/3otwo_elm_eu_sl5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/3otwo_elm_eu_sl5.jpg -------------------------------------------------------------------------------- /drafts/draw/new/3otwo_elm_eu_sl5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/3otwo_elm_eu_sl5.pdf -------------------------------------------------------------------------------- /drafts/draw/new/3otwo_elm_eu_sl5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/3otwo_elm_eu_sl5.png -------------------------------------------------------------------------------- /drafts/draw/new/4otwo_elm_eu_sl2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/4otwo_elm_eu_sl2.jpg -------------------------------------------------------------------------------- /drafts/draw/new/4otwo_elm_eu_sl2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/4otwo_elm_eu_sl2.pdf -------------------------------------------------------------------------------- /drafts/draw/new/4otwo_elm_eu_sl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/4otwo_elm_eu_sl2.png -------------------------------------------------------------------------------- /drafts/draw/new/4otwo_elm_eu_sl5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/4otwo_elm_eu_sl5.jpg -------------------------------------------------------------------------------- /drafts/draw/new/4otwo_elm_eu_sl5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/4otwo_elm_eu_sl5.pdf -------------------------------------------------------------------------------- /drafts/draw/new/4otwo_elm_eu_sl5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/4otwo_elm_eu_sl5.png -------------------------------------------------------------------------------- /drafts/draw/new/4otwo_elm_uk_sl2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/4otwo_elm_uk_sl2.jpg -------------------------------------------------------------------------------- /drafts/draw/new/4otwo_elm_uk_sl2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/4otwo_elm_uk_sl2.pdf -------------------------------------------------------------------------------- /drafts/draw/new/4otwo_elm_uk_sl2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/4otwo_elm_uk_sl2.png -------------------------------------------------------------------------------- /drafts/draw/new/4otwo_elm_uk_sl5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/4otwo_elm_uk_sl5.jpg -------------------------------------------------------------------------------- /drafts/draw/new/4otwo_elm_uk_sl5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/4otwo_elm_uk_sl5.pdf -------------------------------------------------------------------------------- /drafts/draw/new/4otwo_elm_uk_sl5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/4otwo_elm_uk_sl5.png -------------------------------------------------------------------------------- /drafts/draw/new/otwo_elm_eu_sl5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/otwo_elm_eu_sl5.jpg -------------------------------------------------------------------------------- /drafts/draw/new/otwo_elm_eu_sl5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/otwo_elm_eu_sl5.pdf -------------------------------------------------------------------------------- /drafts/draw/new/otwo_elm_eu_sl5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/draw/new/otwo_elm_eu_sl5.png -------------------------------------------------------------------------------- /drafts/images/code/BFO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/images/code/BFO.png -------------------------------------------------------------------------------- /drafts/images/code/CRO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/images/code/CRO.png -------------------------------------------------------------------------------- /drafts/images/code/DE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/images/code/DE.png -------------------------------------------------------------------------------- /drafts/images/code/GA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/images/code/GA.png -------------------------------------------------------------------------------- /drafts/images/code/PSO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/images/code/PSO.png -------------------------------------------------------------------------------- /drafts/images/code/all_code_fit.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/images/code/all_code_fit.pdf -------------------------------------------------------------------------------- /drafts/images/code/all_code_wrapper.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/images/code/all_code_wrapper.pdf -------------------------------------------------------------------------------- /drafts/images/code/all_code_wrapper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/images/code/all_code_wrapper.png -------------------------------------------------------------------------------- /drafts/images/code/hybrid_mlnn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/images/code/hybrid_mlnn.png -------------------------------------------------------------------------------- /drafts/images/code/neural_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/images/code/neural_network.png -------------------------------------------------------------------------------- /drafts/images/code/root_ann.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/images/code/root_ann.png -------------------------------------------------------------------------------- /drafts/images/code/root_hybrid_mlnn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/images/code/root_hybrid_mlnn.png -------------------------------------------------------------------------------- /drafts/images/code/root_rnn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chasebk/code_OTWO_ELM/c5145fa50175e63e467b7aa134065398235f8e5a/drafts/images/code/root_rnn.png -------------------------------------------------------------------------------- /elm_script.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 00:51, 29/03/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from os.path import splitext, basename, realpath 11 | from sklearn.model_selection import ParameterGrid 12 | from model.main.traditional_elm import Elm 13 | from utils.SettingPaper import * 14 | from utils.IOUtil import load_dataset 15 | from utils.SettingPaper import elm_paras_final as param_grid 16 | 17 | if SP_RUN_TIMES == 1: 18 | all_model_file_name = SP_LOG_FILENAME 19 | else: # If runs with more than 1, like stability test --> name of the models ==> such as: rnn1hl.csv 20 | all_model_file_name = str(splitext(basename(realpath(__file__)))[0]) 21 | 22 | 23 | def train_model(item): 24 | root_base_paras = { 25 | "dataset": dataset, 26 | "feature_size": feature_size, 27 | "data_idx": SP_DATA_SPLIT_INDEX, 28 | "sliding": item["sliding"], 29 | "multi_output": multi_output, 30 | "output_idx": output_index, 31 | "method_statistic": SP_PREPROCESSING_METHOD, 32 | "log_filename": all_model_file_name, 33 | "n_runs": SP_RUN_TIMES, # 1 or others 34 | "path_save_result": SP_PATH_SAVE_BASE + SP_DATA_FILENAME[loop] + "/", 35 | "draw": SP_DRAW, 36 | "print_train": SP_PRINT_TRAIN, # 0: nothing, 1 : full detail, 2: short version 37 | } 38 | paras_name = "hs_{}-act_{}".format(item["hidden_size"], item["activation"]) 39 | root_elm_paras = { 40 | "hidden_size": item["hidden_size"], "activation": item["activation"], "paras_name": paras_name 41 | } 42 | md = Elm(root_base_paras=root_base_paras, root_elm_paras=root_elm_paras) 43 | md._running__() 44 | 45 | 46 | for _ in range(SP_RUN_TIMES): 47 | for loop in range(len(SP_DATA_FILENAME)): 48 | filename = SP_LOAD_DATA_FROM + SP_DATA_FILENAME[loop] 49 | dataset = load_dataset(filename, cols=SP_DATA_COLS[loop]) 50 | feature_size = len(SP_DATA_COLS[loop]) 51 | multi_output = SP_DATA_MULTI_OUTPUT[loop] 52 | output_index = SP_OUTPUT_INDEX[loop] 53 | # Create combination of params. 54 | for item in list(ParameterGrid(param_grid)): 55 | train_model(item) 56 | -------------------------------------------------------------------------------- /envs/environment.yml: -------------------------------------------------------------------------------- 1 | name: ai 2 | channels: 3 | - conda-forge 4 | - anaconda 5 | - defaults 6 | dependencies: 7 | - _tflow_select=2.2.0=eigen 8 | - absl-py=0.9.0=py37_0 9 | - asn1crypto=1.3.0=py37_0 10 | - astor=0.8.0=py37_0 11 | - atomicwrites=1.3.0=py37_1 12 | - attrs=19.3.0=py_0 13 | - automat=0.8.0=py_0 14 | - backcall=0.1.0=py37_0 15 | - bcrypt=3.1.7=py37he774522_0 16 | - blas=1.0=mkl 17 | - bleach=3.1.0=py37_0 18 | - blinker=1.4=py37_0 19 | - ca-certificates=2020.1.1=0 20 | - cachetools=3.1.1=py_0 21 | - certifi=2019.11.28=py37_1 22 | - cffi=1.14.0=py37h7a1dbc1_0 23 | - chardet=3.0.4=py37_1003 24 | - click=7.0=py37_0 25 | - colorama=0.4.3=py_0 26 | - constantly=15.1.0=py37h28b3542_0 27 | - cryptography=2.8=py37h7a1dbc1_0 28 | - cssselect=1.1.0=py_0 29 | - cycler=0.10.0=py37_0 30 | - decorator=4.4.1=py_0 31 | - defusedxml=0.6.0=py_0 32 | - entrypoints=0.3=py37_0 33 | - freetype=2.9.1=ha9979f8_1 34 | - gast=0.2.2=py37_0 35 | - google-auth=1.11.2=py_0 36 | - google-auth-oauthlib=0.4.1=py_2 37 | - google-pasta=0.1.8=py_0 38 | - grpcio=1.27.2=py37h351948d_0 39 | - h5py=2.10.0=py37h5e291fa_0 40 | - hdf5=1.10.4=h7ebc959_0 41 | - hyperlink=19.0.0=py_0 42 | - icc_rt=2019.0.0=h0cc432a_1 43 | - icu=58.2=ha66f8fd_1 44 | - idna=2.8=py37_0 45 | - importlib_metadata=1.5.0=py37_0 46 | - incremental=17.5.0=py37_0 47 | - intel-openmp=2020.0=166 48 | - ipykernel=5.1.4=py37h39e3cac_0 49 | - ipython=7.12.0=py37h5ca1d4c_0 50 | - ipython_genutils=0.2.0=py37_0 51 | - ipywidgets=7.5.1=py_0 52 | - jedi=0.16.0=py37_0 53 | - jinja2=2.11.1=py_0 54 | - joblib=0.14.1=py_0 55 | - jpeg=9b=hb83a4c4_2 56 | - jsonschema=3.2.0=py37_0 57 | - jupyter=1.0.0=py37_7 58 | - jupyter_client=5.3.4=py37_0 59 | - jupyter_console=6.1.0=py_0 60 | - jupyter_core=4.6.1=py37_0 61 | - keras=2.3.1=0 62 | - keras-applications=1.0.8=py_0 63 | - keras-base=2.3.1=py37_0 64 | - keras-preprocessing=1.1.0=py_1 65 | - kiwisolver=1.1.0=py37ha925a31_0 66 | - libiconv=1.15=h1df5818_7 67 | - libpng=1.6.37=h2a8f88b_0 68 | - libprotobuf=3.11.4=h7bd577a_0 69 | - libsodium=1.0.16=h9d3ae62_0 70 | - libxml2=2.9.9=h464c3ec_0 71 | - libxslt=1.1.33=h579f668_0 72 | - lxml=4.5.0=py37h1350720_0 73 | - m2w64-gcc-libgfortran=5.3.0=6 74 | - m2w64-gcc-libs=5.3.0=7 75 | - m2w64-gcc-libs-core=5.3.0=7 76 | - m2w64-gmp=6.1.0=2 77 | - m2w64-libwinpthread-git=5.0.0.4634.697f757=2 78 | - markdown=3.1.1=py37_0 79 | - markupsafe=1.1.1=py37he774522_0 80 | - matplotlib=3.1.3=py37_0 81 | - matplotlib-base=3.1.3=py37h64f37c6_0 82 | - mistune=0.8.4=py37he774522_0 83 | - mkl=2020.0=166 84 | - mkl-service=2.3.0=py37hb782905_0 85 | - mkl_fft=1.0.15=py37h14836fe_0 86 | - mkl_random=1.1.0=py37h675688f_0 87 | - more-itertools=8.2.0=py_0 88 | - msys2-conda-epoch=20160418=1 89 | - nbconvert=5.6.1=py37_0 90 | - nbformat=5.0.4=py_0 91 | - notebook=6.0.3=py37_0 92 | - numpy=1.18.1=py37h93ca92e_0 93 | - numpy-base=1.18.1=py37hc3f5095_1 94 | - oauthlib=3.1.0=py_0 95 | - openssl=1.1.1e=he774522_0 96 | - opt_einsum=3.1.0=py_0 97 | - packaging=20.1=py_0 98 | - pandas=1.0.1=py37h47e9c7a_0 99 | - pandoc=2.2.3.2=0 100 | - pandocfilters=1.4.2=py37_1 101 | - parsel=1.5.2=py37_0 102 | - parso=0.6.1=py_0 103 | - patsy=0.5.1=py_0 104 | - pickleshare=0.7.5=py37_0 105 | - pip=20.0.2=py37_1 106 | - pluggy=0.13.1=py37_0 107 | - prometheus_client=0.7.1=py_0 108 | - prompt_toolkit=3.0.3=py_0 109 | - protobuf=3.11.4=py37h33f27b4_0 110 | - py=1.8.1=py_0 111 | - pyasn1=0.4.8=py_0 112 | - pyasn1-modules=0.2.7=py_0 113 | - pycparser=2.19=py37_0 114 | - pydispatcher=2.0.5=py37_1 115 | - pygments=2.5.2=py_0 116 | - pyhamcrest=1.9.0=py37_2 117 | - pyjwt=1.7.1=py37_0 118 | - pyopenssl=19.1.0=py37_0 119 | - pyparsing=2.4.6=py_0 120 | - pyqt=5.9.2=py37h6538335_2 121 | - pyreadline=2.1=py37_1 122 | - pyrsistent=0.15.7=py37he774522_0 123 | - pysocks=1.7.1=py37_0 124 | - pytest=5.3.5=py37_0 125 | - pytest-runner=5.2=py_0 126 | - python=3.7.6=h60c2a47_2 127 | - python-dateutil=2.8.1=py_0 128 | - pytz=2019.3=py_0 129 | - pywin32=227=py37he774522_1 130 | - pywinpty=0.5.7=py37_0 131 | - pyyaml=5.3.1=py37he774522_0 132 | - pyzmq=18.1.1=py37ha925a31_0 133 | - qt=5.9.7=vc14h73c81de_0 134 | - qtconsole=4.6.0=py37_1 135 | - queuelib=1.5.0=py37_0 136 | - requests=2.22.0=py37_1 137 | - requests-oauthlib=1.3.0=py_0 138 | - rsa=4.0=py_0 139 | - scikit-learn=0.22.1=py37h6288b17_0 140 | - scipy=1.4.1=py37h9439919_0 141 | - scrapy=1.6.0=py37_0 142 | - seaborn=0.10.0=py_0 143 | - send2trash=1.5.0=py37_0 144 | - service_identity=18.1.0=py37h28b3542_0 145 | - setuptools=45.2.0=py37_0 146 | - sip=4.19.8=py37h6538335_0 147 | - six=1.14.0=py37_0 148 | - sqlite=3.31.1=he774522_0 149 | - statsmodels=0.11.1=py37hfa6e2cd_0 150 | - tensorboard=2.1.0=py3_0 151 | - tensorflow=2.1.0=eigen_py37hd727fc0_0 152 | - tensorflow-base=2.1.0=eigen_py37h49b2757_0 153 | - tensorflow-estimator=2.1.0=pyhd54b08b_0 154 | - termcolor=1.1.0=py37_1 155 | - terminado=0.8.3=py37_0 156 | - testpath=0.4.4=py_0 157 | - tornado=6.0.3=py37he774522_3 158 | - traitlets=4.3.3=py37_0 159 | - twisted=19.10.0=py37he774522_0 160 | - urllib3=1.25.8=py37_0 161 | - vc=14.1=h0510ff6_4 162 | - vs2015_runtime=14.16.27012=hf0eaf9b_1 163 | - w3lib=1.21.0=py_0 164 | - wcwidth=0.1.8=py_0 165 | - webencodings=0.5.1=py37_1 166 | - werkzeug=0.14.1=py37_0 167 | - wheel=0.34.2=py37_0 168 | - widgetsnbextension=3.5.1=py37_0 169 | - win_inet_pton=1.1.0=py37_0 170 | - wincertstore=0.2=py37_0 171 | - winpty=0.4.3=4 172 | - wrapt=1.11.2=py37he774522_0 173 | - yaml=0.1.7=hc54c509_2 174 | - zeromq=4.3.1=h33f27b4_3 175 | - zipp=2.2.0=py_0 176 | - zlib=1.2.11=h62dcd97_3 177 | - zope=1.0=py37_1 178 | - zope.interface=4.7.1=py37he774522_0 179 | - pip: 180 | - mealpy==0.7.1 181 | - opfunu==0.4.3 182 | prefix: C:\Users\nguye\Miniconda3\envs\ai 183 | 184 | -------------------------------------------------------------------------------- /envs/readme_first.md: -------------------------------------------------------------------------------- 1 | ## Install Environments 2 | 3 | 1. Do it on your terminal (ubuntu) or bash shell (windows). Make sure you already have miniconda 4 | ```code 5 | Check this link for pre-installed package. Due to new version of tensorflow. Both windows and linux 6 | https://www.tensorflow.org/install/pip?lang=python3 7 | 8 | After that: 9 | 10 | First way: (Do it by yourself) 11 | conda --version 12 | conda update conda 13 | conda info --envs 14 | 15 | conda create -n ai python==3.7.6 16 | conda activate ai 17 | 18 | conda install pandas matplotlib scikit-learn scrapy seaborn 19 | conda install -c anaconda tensorflow 20 | conda install -c anaconda ipython-notebook 21 | conda install -c conda-forge statsmodels 22 | conda install keras 23 | pip install mealpy 24 | 25 | 26 | Second way: (create env by my env.yml file) 27 | 28 | conda ai create -f env.yml (the first line in that file is the name of the environment) 29 | conda activate ai 30 | pip install mealpy 31 | 32 | ``` 33 | 34 | 2. Useful command 35 | ```code 36 | 37 | 1) Activate, check and deactivate environment 38 | conda activate ai 39 | 40 | conda list (or) 41 | conda env list 42 | conda info --envs 43 | 44 | source deactivate 45 | 46 | 2) Check package inside the environment 47 | conda list -n ai (if ai hasn't activated) 48 | conda list (if ai already activated) 49 | 50 | 3) Export to .yml for other usage. 51 | source activate ai (access to environment) 52 | conda env export > env.yml 53 | 54 | 4) Delete environment 55 | conda remove --name ai --all (or) 56 | conda env remove --name ai 57 | 58 | conda info --envs (kiểm tra xem đã xóa chưa) 59 | ``` 60 | -------------------------------------------------------------------------------- /ga_elm_script.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 00:51, 29/03/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from os.path import splitext, basename, realpath 11 | from sklearn.model_selection import ParameterGrid 12 | from model.main.hybrid_elm import GaElm 13 | from utils.SettingPaper import * 14 | from utils.IOUtil import load_dataset 15 | from utils.SettingPaper import ga_elm_paras_final as param_grid 16 | 17 | if SP_RUN_TIMES == 1: 18 | all_model_file_name = SP_LOG_FILENAME 19 | else: # If runs with more than 1, like stability test --> name of the models ==> such as: rnn1hl.csv 20 | all_model_file_name = str(splitext(basename(realpath(__file__)))[0]) 21 | 22 | 23 | def train_model(item): 24 | root_base_paras = { 25 | "dataset": dataset, 26 | "feature_size": feature_size, 27 | "data_idx": SP_DATA_SPLIT_INDEX_2, 28 | "sliding": item["sliding"], 29 | "multi_output": multi_output, 30 | "output_idx": output_index, 31 | "method_statistic": SP_PREPROCESSING_METHOD, 32 | "log_filename": all_model_file_name, 33 | "n_runs": SP_RUN_TIMES, # 1 or others 34 | "path_save_result": SP_PATH_SAVE_BASE + SP_DATA_FILENAME[loop] + "/", 35 | "draw": SP_DRAW, 36 | "print_train": SP_PRINT_TRAIN, # 0: nothing, 1 : full detail, 2: short version 37 | } 38 | paras_name = "hs_{}-ep_{}-act_{}-pc_{}-pm_{}".format(item["hidden_size"], item["epoch"], item["activation"], item["pc"], item["pm"]) 39 | root_hybrid_paras = { 40 | "hidden_size": item["hidden_size"], "activation": item["activation"], "epoch": item["epoch"], "domain_range": item["domain_range"], 41 | "paras_name": paras_name 42 | } 43 | ga_paras = { 44 | "epoch": item["epoch"], "pop_size": item["pop_size"], "pc": item["pc"], "pm": item["pm"] 45 | } 46 | 47 | md = GaElm(root_base_paras=root_base_paras, root_hybrid_paras=root_hybrid_paras, ga_paras=ga_paras) 48 | md._running__() 49 | 50 | 51 | for _ in range(SP_RUN_TIMES): 52 | for loop in range(len(SP_DATA_FILENAME)): 53 | filename = SP_LOAD_DATA_FROM + SP_DATA_FILENAME[loop] 54 | dataset = load_dataset(filename, cols=SP_DATA_COLS[loop]) 55 | feature_size = len(SP_DATA_COLS[loop]) 56 | multi_output = SP_DATA_MULTI_OUTPUT[loop] 57 | output_index = SP_OUTPUT_INDEX[loop] 58 | # Create combination of params. 59 | for item in list(ParameterGrid(param_grid)): 60 | train_model(item) 61 | -------------------------------------------------------------------------------- /mlnn1hl_script.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 00:51, 29/03/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from os.path import splitext, basename, realpath 11 | from sklearn.model_selection import ParameterGrid 12 | from model.main.traditional_ffnn import Mlnn1HL 13 | from utils.SettingPaper import * 14 | from utils.IOUtil import load_dataset 15 | from utils.SettingPaper import mlnn1hl_paras_final as param_grid 16 | 17 | if SP_RUN_TIMES == 1: 18 | all_model_file_name = SP_LOG_FILENAME 19 | else: # If runs with more than 1, like stability test --> name of the models ==> such as: rnn1hl.csv 20 | all_model_file_name = str(splitext(basename(realpath(__file__)))[0]) 21 | 22 | 23 | def train_model(item): 24 | root_base_paras = { 25 | "dataset": dataset, 26 | "feature_size": feature_size, 27 | "data_idx": SP_DATA_SPLIT_INDEX, 28 | "sliding": item["sliding"], 29 | "multi_output": multi_output, 30 | "output_idx": output_index, 31 | "method_statistic": SP_PREPROCESSING_METHOD, 32 | "log_filename": all_model_file_name, 33 | "n_runs": SP_RUN_TIMES, # 1 or others 34 | "path_save_result": SP_PATH_SAVE_BASE + SP_DATA_FILENAME[loop] + "/", 35 | "draw": SP_DRAW, 36 | "print_train": SP_PRINT_TRAIN, # 0: nothing, 1 : full detail, 2: short version 37 | } 38 | paras_name = "hs_{}-ep_{}-bs_{}-lr_{}-ac_{}-op_{}-lo_{}".format(item["hidden_sizes"], item["epoch"], item["batch_size"], item["learning_rate"], 39 | item["activations"], item["optimizer"], item["loss"]) 40 | 41 | root_mlnn_paras = { 42 | "hidden_sizes": item["hidden_sizes"], "epoch": item["epoch"], "batch_size": item["batch_size"], "learning_rate": item["learning_rate"], 43 | "activations": item["activations"], "optimizer": item["optimizer"], "loss": item["loss"], "paras_name": paras_name 44 | } 45 | md = Mlnn1HL(root_base_paras=root_base_paras, root_mlnn_paras=root_mlnn_paras) 46 | md._running__() 47 | 48 | 49 | for _ in range(SP_RUN_TIMES): 50 | for loop in range(len(SP_DATA_FILENAME)): 51 | filename = SP_LOAD_DATA_FROM + SP_DATA_FILENAME[loop] 52 | dataset = load_dataset(filename, cols=SP_DATA_COLS[loop]) 53 | feature_size = len(SP_DATA_COLS[loop]) 54 | multi_output = SP_DATA_MULTI_OUTPUT[loop] 55 | output_index = SP_OUTPUT_INDEX[loop] 56 | # Create combination of params. 57 | for item in list(ParameterGrid(param_grid)): 58 | train_model(item) 59 | 60 | -------------------------------------------------------------------------------- /model/main/hybrid_elm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 03:51, 29/03/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from model.root.hybrid.root_hybrid_elm import RootHybridElm 11 | from mealpy.evolutionary_based import GA, DE 12 | from mealpy.swarm_based import PSO, BFO 13 | from mealpy.physics_based import TWO 14 | from mealpy.human_based import QSA 15 | 16 | 17 | class GaElm(RootHybridElm): 18 | def __init__(self, root_base_paras=None, root_hybrid_paras=None, ga_paras=None): 19 | RootHybridElm.__init__(self, root_base_paras, root_hybrid_paras) 20 | self.epoch = ga_paras["epoch"] 21 | self.pop_size = ga_paras["pop_size"] 22 | self.pc = ga_paras["pc"] 23 | self.pm = ga_paras["pm"] 24 | self.filename = "GA_ELM-sliding_{}-{}".format(root_base_paras["sliding"], root_hybrid_paras["paras_name"]) 25 | 26 | def _training__(self): 27 | md = GA.BaseGA(self._objective_function__, self.problem_size, self.domain_range, self.print_train, self.epoch, self.pop_size, self.pc, self.pm) 28 | self.solution, self.best_fit, self.loss_train = md._train__() 29 | 30 | 31 | class DeElm(RootHybridElm): 32 | def __init__(self, root_base_paras=None, root_hybrid_paras=None, de_paras=None): 33 | RootHybridElm.__init__(self, root_base_paras, root_hybrid_paras) 34 | self.epoch = de_paras["epoch"] 35 | self.pop_size = de_paras["pop_size"] 36 | self.wf = de_paras["wf"] 37 | self.cr = de_paras["cr"] 38 | self.filename = "DE_ELM-sliding_{}-{}".format(root_base_paras["sliding"], root_hybrid_paras["paras_name"]) 39 | 40 | def _training__(self): 41 | md = DE.BaseDE(self._objective_function__, self.problem_size, self.domain_range, self.print_train, self.epoch, self.pop_size, self.wf, self.cr) 42 | self.solution, self.best_fit, self.loss_train = md._train__() 43 | 44 | 45 | class PsoElm(RootHybridElm): 46 | def __init__(self, root_base_paras=None, root_hybrid_paras=None, pso_paras=None): 47 | RootHybridElm.__init__(self, root_base_paras, root_hybrid_paras) 48 | self.epoch = pso_paras["epoch"] 49 | self.pop_size = pso_paras["pop_size"] 50 | self.c1 = pso_paras["c_minmax"][0] 51 | self.c2 = pso_paras["c_minmax"][1] 52 | self.w_min = pso_paras["w_minmax"][0] 53 | self.w_max = pso_paras["w_minmax"][1] 54 | self.filename = "PSO_ELM-sliding_{}-{}".format(root_base_paras["sliding"], root_hybrid_paras["paras_name"]) 55 | 56 | def _training__(self): 57 | md = PSO.BasePSO(self._objective_function__, self.problem_size, self.domain_range, self.print_train, 58 | self.epoch, self.pop_size, self.c1, self.c2, self.w_min, self.w_max) 59 | self.solution, self.best_fit, self.loss_train = md._train__() 60 | 61 | 62 | class BfoElm(RootHybridElm): 63 | def __init__(self, root_base_paras=None, root_hybrid_paras=None, bfo_paras=None): 64 | RootHybridElm.__init__(self, root_base_paras, root_hybrid_paras) 65 | self.pop_size = bfo_paras["pop_size"] 66 | self.Ci = bfo_paras["Ci"] 67 | self.Ped = bfo_paras["Ped"] 68 | self.Ns = bfo_paras["Ns"] 69 | self.Ned = bfo_paras["Ned"] 70 | self.Nre = bfo_paras["Nre"] 71 | self.Nc = bfo_paras["Nc"] 72 | self.attract_repels = bfo_paras["attract_repels"] 73 | self.filename = "BFO_ELM-sliding_{}-{}".format(root_base_paras["sliding"], root_hybrid_paras["paras_name"]) 74 | 75 | def _training__(self): 76 | md = BFO.BaseBFO(self._objective_function__, self.problem_size, self.domain_range, self.print_train, 77 | self.pop_size, self.Ci, self.Ped, self.Ns, self.Ned, self.Nre, self.Nc, self.attract_repels) 78 | self.solution, self.best_fit, self.loss_train = md._train__() 79 | 80 | 81 | class ABfoLSElm(RootHybridElm): 82 | def __init__(self, root_base_paras=None, root_hybrid_paras=None, abfols_paras=None): 83 | RootHybridElm.__init__(self, root_base_paras, root_hybrid_paras) 84 | self.epoch = abfols_paras["epoch"] 85 | self.pop_size = abfols_paras["pop_size"] 86 | self.Ci = abfols_paras["Ci"] 87 | self.Ped = abfols_paras["Ped"] 88 | self.Ns = abfols_paras["Ns"] 89 | self.N_minmax = abfols_paras["N_minmax"] 90 | self.filename = "ABFOLS_ELM-sliding_{}-{}".format(root_base_paras["sliding"], root_hybrid_paras["paras_name"]) 91 | 92 | def _training__(self): 93 | md = BFO.ABFOLS(self._objective_function__, self.problem_size, self.domain_range, self.print_train, 94 | self.epoch, self.pop_size, self.Ci, self.Ped, self.Ns, self.N_minmax) 95 | self.solution, self.best_fit, self.loss_train = md._train__() 96 | 97 | 98 | class QsaElm(RootHybridElm): 99 | def __init__(self, root_base_paras=None, root_hybrid_paras=None, qsa_paras=None): 100 | RootHybridElm.__init__(self, root_base_paras, root_hybrid_paras) 101 | self.epoch = qsa_paras["epoch"] 102 | self.pop_size = qsa_paras["pop_size"] 103 | self.filename = "QSA_ELM-sliding_{}-{}".format(root_base_paras["sliding"], root_hybrid_paras["paras_name"]) 104 | 105 | def _training__(self): 106 | md = QSA.BaseQSA(self._objective_function__, self.problem_size, self.domain_range, self.print_train, self.epoch, self.pop_size) 107 | self.solution, self.best_fit, self.loss_train = md._train__() 108 | 109 | 110 | class TwoElm(RootHybridElm): 111 | def __init__(self, root_base_paras=None, root_hybrid_paras=None, two_paras=None): 112 | RootHybridElm.__init__(self, root_base_paras, root_hybrid_paras) 113 | self.epoch = two_paras["epoch"] 114 | self.pop_size = two_paras["pop_size"] 115 | self.filename = "Two_ELM-sliding_{}-{}".format(root_base_paras["sliding"], root_hybrid_paras["paras_name"]) 116 | 117 | def _training__(self): 118 | md = TWO.BaseTWO(self._objective_function__, self.problem_size, self.domain_range, self.print_train, self.epoch, self.pop_size) 119 | self.solution, self.best_fit, self.loss_train = md._train__() 120 | 121 | 122 | class OTwoElm(RootHybridElm): 123 | def __init__(self, root_base_paras=None, root_hybrid_paras=None, two_paras=None): 124 | RootHybridElm.__init__(self, root_base_paras, root_hybrid_paras) 125 | self.epoch = two_paras["epoch"] 126 | self.pop_size = two_paras["pop_size"] 127 | self.filename = "OppoTwo_ELM-sliding_{}-{}".format(root_base_paras["sliding"], root_hybrid_paras["paras_name"]) 128 | 129 | def _training__(self): 130 | md = TWO.OppoTWO(self._objective_function__, self.problem_size, self.domain_range, self.print_train, self.epoch, self.pop_size) 131 | self.solution, self.best_fit, self.loss_train = md._train__() 132 | -------------------------------------------------------------------------------- /model/main/traditional_elm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 00:51, 29/03/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from model.root.traditional.root_elm import RootElm 11 | import numpy as np 12 | 13 | 14 | class Elm(RootElm): 15 | """ 16 | Amazing tutorial: https://www.kaggle.com/robertbm/extreme-learning-machine-example 17 | """ 18 | def __init__(self, root_base_paras=None, root_elm_paras=None): 19 | RootElm.__init__(self, root_base_paras, root_elm_paras) 20 | self.filename = "ELM-sliding_{}-{}".format(root_base_paras["sliding"], root_elm_paras["paras_name"]) 21 | 22 | def _training__(self): 23 | """ 24 | 1. Random weights between input and hidden layer 25 | 2. Calculate output of hidden layer 26 | 3. Calculate weights between hidden and output layer based on matrix multiplication 27 | """ 28 | self.input_size, self.output_size = self.X_train.shape[1], self.y_train.shape[1] 29 | w1 = np.random.uniform(size=[self.input_size, self.hidden_size]) 30 | b = np.random.uniform(size=[1, self.hidden_size]) 31 | H = self._activation__(np.add(np.matmul(self.X_train, w1), b)) 32 | w2 = np.dot(np.linalg.pinv(H), self.y_train) 33 | self.model = {"w1": w1, "b": b, "w2": w2} 34 | 35 | def _forecasting__(self): 36 | hidd = self._activation__(np.add(np.matmul(self.X_test, self.model["w1"]), self.model["b"])) 37 | y_pred = np.matmul(hidd, self.model["w2"]) 38 | real_inverse = self.scaler.inverse_transform(self.y_test) 39 | pred_inverse = self.scaler.inverse_transform(np.reshape(y_pred, self.y_test.shape)) 40 | return real_inverse, pred_inverse, self.y_test, y_pred 41 | -------------------------------------------------------------------------------- /model/main/traditional_ffnn.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 01:51, 29/03/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from keras.models import Sequential 11 | from keras.layers import Dense 12 | from model.root.traditional.root_mlnn import RootMlnn 13 | 14 | 15 | class Mlnn1HL(RootMlnn): 16 | def __init__(self, root_base_paras=None, root_mlnn_paras=None): 17 | RootMlnn.__init__(self, root_base_paras, root_mlnn_paras) 18 | self.filename = "MLNN-1H-sliding_{}-{}".format(root_base_paras["sliding"], root_mlnn_paras["paras_name"]) 19 | 20 | def _training__(self): 21 | self.model = Sequential() 22 | self.model.add(Dense(units=self.hidden_sizes[0], input_dim=self.X_train.shape[1], activation=self.activations[0])) 23 | self.model.add(Dense(1, activation=self.activations[1])) 24 | self.model.compile(loss=self.loss, optimizer=self.optimizer) 25 | ml = self.model.fit(self.X_train, self.y_train, epochs=self.epoch, batch_size=self.batch_size, verbose=self.print_train) 26 | self.loss_train = ml.history["loss"] 27 | 28 | 29 | class Mlnn2HL(RootMlnn): 30 | def __init__(self, root_base_paras=None, root_mlnn_paras=None): 31 | RootMlnn.__init__(self, root_base_paras, root_mlnn_paras) 32 | self.filename = "MLNN-2H-sliding_{}-{}".format(root_base_paras["sliding"], root_mlnn_paras["paras_name"]) 33 | 34 | def _training__(self): 35 | self.model = Sequential() 36 | self.model.add(Dense(self.hidden_sizes[0], input_dim=self.X_train.shape[1], activation=self.activations[0])) 37 | self.model.add(Dense(self.hidden_sizes[1], activation=self.activations[1])) 38 | self.model.add(Dense(1, activation=self.activations[2])) 39 | self.model.compile(loss=self.loss, optimizer=self.optimizer) 40 | ml = self.model.fit(self.X_train, self.y_train, epochs=self.epoch, batch_size=self.batch_size, verbose=self.print_train) 41 | self.loss_train = ml.history["loss"] 42 | 43 | -------------------------------------------------------------------------------- /model/main/traditional_rnn.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 02:51, 29/03/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from keras.models import Sequential 11 | from keras.layers import Dense, LSTM, GRU, Dropout 12 | from model.root.traditional.root_rnn import RootRnn 13 | 14 | 15 | class Rnn1HL(RootRnn): 16 | def __init__(self, root_base_paras=None, root_rnn_paras=None): 17 | RootRnn.__init__(self, root_base_paras, root_rnn_paras) 18 | self.filename = "RNN-1HL-sliding_{}-{}".format(root_base_paras["sliding"], root_rnn_paras["paras_name"]) 19 | 20 | def _training__(self): 21 | # The RNN architecture 22 | self.model = Sequential() 23 | self.model.add(LSTM(units=self.hidden_sizes[0], activation=self.activations[0], input_shape=(self.X_train.shape[1], 1))) 24 | self.model.add(Dropout(self.dropouts[0])) 25 | self.model.add(Dense(units=1, activation=self.activations[1])) 26 | self.model.compile(loss=self.loss, optimizer=self.optimizer) 27 | ml = self.model.fit(self.X_train, self.y_train, epochs=self.epoch, batch_size=self.batch_size, verbose=self.print_train) 28 | self.loss_train = ml.history["loss"] 29 | 30 | 31 | class Rnn2HL(RootRnn): 32 | def __init__(self, root_base_paras=None, root_rnn_paras=None): 33 | RootRnn.__init__(self, root_base_paras, root_rnn_paras) 34 | self.filename = "RNN-2HL-sliding_{}-{}".format(root_base_paras["sliding"], root_rnn_paras["paras_name"]) 35 | 36 | def _training__(self): 37 | # The RNN architecture 38 | self.model = Sequential() 39 | self.model.add(LSTM(units=self.hidden_sizes[0], return_sequences=True, input_shape=(self.X_train.shape[1], 1), activation=self.activations[0])) 40 | self.model.add(Dropout(self.dropouts[0])) 41 | self.model.add(LSTM(units=self.hidden_sizes[1], activation=self.activations[1])) 42 | self.model.add(Dropout(self.dropouts[1])) 43 | self.model.add(Dense(units=1, activation=self.activations[2])) 44 | self.model.compile(loss=self.loss, optimizer=self.optimizer) 45 | ml = self.model.fit(self.X_train, self.y_train, epochs=self.epoch, batch_size=self.batch_size, verbose=self.print_train) 46 | self.loss_train = ml.history["loss"] 47 | 48 | 49 | class Lstm1HL(RootRnn): 50 | def __init__(self, root_base_paras=None, root_rnn_paras=None): 51 | RootRnn.__init__(self, root_base_paras, root_rnn_paras) 52 | self.filename = "LSTM-1HL-sliding_{}-{}".format(root_base_paras["sliding"], root_rnn_paras["paras_name"]) 53 | def _training__(self): 54 | # The LSTM architecture 55 | self.model = Sequential() 56 | self.model.add(LSTM(units=self.hidden_sizes[0], input_shape=(None, 1), activation=self.activations[0])) 57 | self.model.add(Dense(units=1, activation=self.activations[1])) 58 | self.model.compile(loss=self.loss, optimizer=self.optimizer) 59 | ml = self.model.fit(self.X_train, self.y_train, epochs=self.epoch, batch_size=self.batch_size, verbose=self.print_train) 60 | self.loss_train = ml.history["loss"] 61 | 62 | 63 | class Lstm2HL(RootRnn): 64 | def __init__(self, root_base_paras=None, root_rnn_paras=None): 65 | RootRnn.__init__(self, root_base_paras, root_rnn_paras) 66 | self.filename = "LSTM-2HL-sliding_{}-{}".format(root_base_paras["sliding"], root_rnn_paras["paras_name"]) 67 | def _training__(self): 68 | # The LSTM architecture 69 | self.model = Sequential() 70 | self.model.add(LSTM(units=self.hidden_sizes[0], return_sequences=True, input_shape=(None, 1), activation=self.activations[0])) 71 | self.model.add(LSTM(units=self.hidden_sizes[1], activation=self.activations[1])) 72 | self.model.add(Dense(units=1, activation=self.activations[2])) 73 | self.model.compile(loss=self.loss, optimizer=self.optimizer) 74 | ml = self.model.fit(self.X_train, self.y_train, epochs=self.epoch, batch_size=self.batch_size, verbose=self.print_train) 75 | self.loss_train = ml.history["loss"] 76 | 77 | 78 | class Gru1HL(RootRnn): 79 | def __init__(self, root_base_paras=None, root_rnn_paras=None): 80 | RootRnn.__init__(self, root_base_paras, root_rnn_paras) 81 | self.filename = "GRU-1HL-sliding_{}-{}".format(root_base_paras["sliding"], root_rnn_paras["paras_name"]) 82 | def _training__(self): 83 | # The GRU architecture 84 | self.model = Sequential() 85 | self.model.add(GRU(units=self.hidden_sizes[0], input_shape=(self.X_train.shape[1], 1), activation=self.activations[0])) 86 | self.model.add(Dropout(self.dropouts[0])) 87 | self.model.add(Dense(units=1, activation=self.activations[1])) 88 | self.model.compile(loss=self.loss, optimizer=self.optimizer) 89 | ml = self.model.fit(self.X_train, self.y_train, epochs=self.epoch, batch_size=self.batch_size, verbose=self.print_train) 90 | self.loss_train = ml.history["loss"] 91 | 92 | 93 | class Gru2HL(RootRnn): 94 | def __init__(self, root_base_paras=None, root_rnn_paras=None): 95 | RootRnn.__init__(self, root_base_paras, root_rnn_paras) 96 | self.filename = "GRU-2HL-sliding_{}-{}".format(root_base_paras["sliding"], root_rnn_paras["paras_name"]) 97 | 98 | def _training__(self): 99 | # The GRU architecture 100 | self.model = Sequential() 101 | self.model.add(GRU(units=self.hidden_sizes[0], return_sequences=True, input_shape=(self.X_train.shape[1], 1), activation=self.activations[0])) 102 | self.model.add(Dropout(self.dropouts[0])) 103 | self.model.add(GRU(units=self.hidden_sizes[1], activation=self.activations[1])) 104 | self.model.add(Dropout(self.dropouts[1])) 105 | self.model.add(Dense(units=1, activation=self.activations[2])) 106 | self.model.compile(loss=self.loss, optimizer=self.optimizer) 107 | ml = self.model.fit(self.X_train, self.y_train, epochs=self.epoch, batch_size=self.batch_size, verbose=self.print_train) 108 | self.loss_train = ml.history["loss"] 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /model/root/hybrid/root_hybrid_elm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 18:22, 06/04/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from sklearn.metrics import mean_squared_error 11 | import numpy as np 12 | import time 13 | from model.root.root_base import RootBase 14 | import utils.MathUtil as my_math 15 | 16 | 17 | class RootHybridElm(RootBase): 18 | """ 19 | This is root of all hybrid models which include Extreme Learning Machine and Optimization Algorithms. 20 | """ 21 | def __init__(self, root_base_paras=None, root_hybrid_paras=None): 22 | RootBase.__init__(self, root_base_paras) 23 | self.activation = root_hybrid_paras["activation"] 24 | self.domain_range = root_hybrid_paras["domain_range"] 25 | if root_hybrid_paras["hidden_size"][1]: 26 | self.hidden_size = root_hybrid_paras["hidden_size"][0] 27 | else: 28 | self.hidden_size = 2*(root_base_paras["sliding"]*root_base_paras["feature_size"])**2 + 1 29 | self._activation__ = getattr(my_math, self.activation) 30 | self.epoch = None 31 | 32 | def _setting__(self): 33 | self.input_size, self.output_size = self.X_train.shape[1], self.y_train.shape[1] 34 | self.w1_size = self.input_size * self.hidden_size 35 | self.b_size = self.hidden_size 36 | self.w2_size = self.hidden_size * self.output_size 37 | self.problem_size = self.w1_size + self.b_size 38 | 39 | def _forecasting__(self): 40 | hidd = self._activation__(np.add(np.matmul(self.X_test, self.model["w1"]), self.model["b"])) 41 | y_pred = np.matmul(hidd, self.model["w2"]) 42 | real_inverse = self.scaler.inverse_transform(self.y_test) 43 | pred_inverse = self.scaler.inverse_transform(np.reshape(y_pred, self.y_test.shape)) 44 | return real_inverse, pred_inverse, self.y_test, y_pred 45 | 46 | def _running__(self): 47 | self.time_system = time.time() 48 | self._preprocessing_2d__() 49 | self._setting__() 50 | self.time_total_train = time.time() 51 | self._training__() 52 | self.model = self._get_model__(self.solution) 53 | self.time_total_train = round(time.time() - self.time_total_train, 4) 54 | self.time_epoch = round(self.time_total_train / self.epoch, 4) 55 | self.time_predict = time.time() 56 | y_true_unscaled, y_pred_unscaled, y_true_scaled, y_pred_scaled = self._forecasting__() 57 | self.time_predict = round(time.time() - self.time_predict, 8) 58 | self.time_system = round(time.time() - self.time_system, 4) 59 | self._save_results__(y_true_unscaled, y_pred_unscaled, y_true_scaled, y_pred_scaled, self.loss_train, self.n_runs) 60 | 61 | ## Helper functions 62 | def _get_model__(self, solution=None): 63 | X_train, y_train = self.X_train, self.y_train 64 | if self.X_valid is not None: 65 | X_train = np.concatenate((self.X_train, self.X_valid), axis=0) 66 | y_train = np.concatenate((self.y_train, self.y_valid), axis=0) 67 | w1 = np.reshape(solution[:self.w1_size], (self.input_size, self.hidden_size)) 68 | b = np.reshape(solution[self.w1_size:self.w1_size + self.b_size], (-1, self.hidden_size)) 69 | H = self._activation__(np.add(np.matmul(X_train, w1), b)) 70 | w2 = np.dot(np.linalg.pinv(H), y_train) # calculate weights between hidden and output layer 71 | return {"w1": w1, "b": b, "w2": w2} 72 | 73 | def _objective_function__(self, solution=None): 74 | X_train, y_train = self.X_train, self.y_train 75 | if self.X_valid is not None: 76 | X_train = np.concatenate((self.X_train, self.X_valid), axis=0) 77 | y_train = np.concatenate((self.y_train, self.y_valid), axis=0) 78 | w1 = np.reshape(solution[:self.w1_size], (self.input_size, self.hidden_size)) 79 | b = np.reshape(solution[self.w1_size:self.w1_size + self.b_size], (-1, self.hidden_size)) 80 | H = self._activation__(np.add(np.matmul(X_train, w1), b)) 81 | H_pinv = np.linalg.pinv(H) # compute a pseudo-inverse of H 82 | w2 = np.dot(H_pinv, y_train) # calculate weights between hidden and output layer 83 | y_pred = np.matmul(H, w2) 84 | return mean_squared_error(y_pred, y_train) 85 | -------------------------------------------------------------------------------- /model/root/root_base.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 18:10, 06/04/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from sklearn.preprocessing import MinMaxScaler 11 | from utils.PreprocessingUtil import TimeSeries 12 | from utils.MeasureUtil import MeasureTimeSeries 13 | from utils.IOUtil import save_all_models_to_csv, save_prediction_to_csv, save_loss_train_to_csv 14 | from utils.GraphUtil import draw_predict_with_error 15 | 16 | 17 | class RootBase: 18 | """ 19 | This is root of all networks. 20 | """ 21 | def __init__(self, root_base_paras=None): 22 | self.dataset = root_base_paras["dataset"] 23 | self.data_idx = root_base_paras["data_idx"] 24 | self.sliding = root_base_paras["sliding"] 25 | self.output_idx = root_base_paras["output_idx"] 26 | self.method_statistic = root_base_paras["method_statistic"] 27 | self.scaler = MinMaxScaler() 28 | 29 | self.n_runs = root_base_paras["n_runs"] 30 | self.path_save_result = root_base_paras["path_save_result"] 31 | self.log_filename = root_base_paras["log_filename"] 32 | self.multi_output = root_base_paras["multi_output"] 33 | self.draw = root_base_paras["draw"] 34 | self.print_train = root_base_paras["print_train"] 35 | 36 | self.model, self.solution, self.loss_train, self.filename = None, None, [], None 37 | self.X_train, self.y_train, self.X_valid, self.y_valid, self.X_test, self.y_test = None, None, None, None, None, None 38 | self.time_total_train, self.time_epoch, self.time_predict, self.time_system = None, None, None, None 39 | 40 | def _preprocessing_2d__(self): 41 | ts = TimeSeries(self.dataset, self.data_idx, self.sliding, self.output_idx, self.method_statistic, self.scaler) 42 | self.X_train, self.y_train, self.X_valid, self.y_valid, self.X_test, self.y_test, self.scaler = ts._preprocessing_2d__() 43 | 44 | def _preprocessing_3d__(self): 45 | ts = TimeSeries(self.dataset, self.data_idx, self.sliding, self.output_idx, self.method_statistic, self.scaler) 46 | self.X_train, self.y_train, self.X_valid, self.y_valid, self.X_test, self.y_test, self.scaler = ts._preprocessing_3d__() 47 | 48 | def _save_results__(self, y_true=None, y_pred=None, y_true_scaled=None, y_pred_scaled=None, loss_train=None, n_runs=1): 49 | if self.multi_output: 50 | measure_scaled = MeasureTimeSeries(y_true_scaled, y_pred_scaled, "raw_values", number_rounding=4) 51 | measure_scaled._fit__() 52 | data1 = "CPU_" 53 | data2 = "RAM_" 54 | item = {'model_name': self.filename, 'total_time_train': self.time_total_train, 'time_epoch': self.time_epoch, 55 | 'time_predict': self.time_predict, 'time_system': self.time_system, 56 | data1 + 'scaled_EV': measure_scaled.score_ev[0], data1 + 'scaled_MSLE': measure_scaled.score_msle[0], 57 | data1 + 'scaled_R2': measure_scaled.score_r2[0], data1 + 'scaled_MAE': measure_scaled.score_mae[0], 58 | data1 + 'scaled_MSE': measure_scaled.score_mse[0], data1 + 'scaled_RMSE': measure_scaled.score_rmse[0], 59 | data1 + 'scaled_MAPE': measure_scaled.score_mape[0], data1 + 'scaled_SMAPE': measure_scaled.score_smape[0], 60 | 61 | data2 + 'scaled_EV': measure_scaled.score_ev[1], data2 + 'scaled_MSLE': measure_scaled.score_msle[1], 62 | data2 + 'scaled_R2': measure_scaled.score_r2[1], data2 + 'scaled_MAE': measure_scaled.score_mae[1], 63 | data2 + 'scaled_MSE': measure_scaled.score_mse[1], data2 + 'scaled_RMSE': measure_scaled.score_rmse[1], 64 | data2 + 'scaled_MAPE': measure_scaled.score_mape[1], data2 + 'scaled_SMAPE': measure_scaled.score_smape[1]} 65 | 66 | if n_runs == 1: 67 | save_prediction_to_csv(y_true[:, 0:1], y_pred[:, 0:1], self.filename, self.path_save_result + data1) 68 | save_prediction_to_csv(y_true[:, 1:2], y_pred[:, 1:2], self.filename, self.path_save_result + data2) 69 | save_loss_train_to_csv(loss_train, self.filename, self.path_save_result + "Error-") 70 | 71 | if self.draw: 72 | draw_predict_with_error(1, [y_true[:, 0:1], y_pred[:, 0:1]], [measure_scaled.score_rmse[0], measure_scaled.score_mae[0]], self.filename, 73 | self.path_save_result + data1) 74 | draw_predict_with_error(2, [y_true[:, 1:2], y_pred[:, 1:2]], [measure_scaled.score_rmse[1], measure_scaled.score_mae[1]], self.filename, 75 | self.path_save_result + data2) 76 | if self.print_train: 77 | print('Predict DONE - CPU - RMSE: %f, RAM - RMSE: %f' % (measure_scaled.score_rmse[0], measure_scaled.score_rmse[1])) 78 | save_all_models_to_csv(item, self.log_filename, self.path_save_result) 79 | 80 | else: 81 | measure_scaled = MeasureTimeSeries(y_true_scaled, y_pred_scaled, None, number_rounding=4) 82 | measure_scaled._fit__() 83 | measure_unscaled = MeasureTimeSeries(y_true, y_pred, None, number_rounding=4) 84 | measure_unscaled._fit__() 85 | 86 | item = {'model_name': self.filename, 'total_time_train': self.time_total_train, 'time_epoch': self.time_epoch, 87 | 'time_predict': self.time_predict, 'time_system': self.time_system, 88 | 'scaled_EV': measure_scaled.score_ev, 'scaled_MSLE': measure_scaled.score_msle, 'scaled_R2': measure_scaled.score_r2, 89 | 'scaled_MAE': measure_scaled.score_mae, 'scaled_MSE': measure_scaled.score_mse, 'scaled_RMSE': measure_scaled.score_rmse, 90 | 'scaled_MAPE': measure_scaled.score_mape, 'scaled_SMAPE': measure_scaled.score_smape, 91 | 'unscaled_EV': measure_unscaled.score_ev, 'unscaled_MSLE': measure_unscaled.score_msle, 'unscaled_R2': measure_unscaled.score_r2, 92 | 'unscaled_MAE': measure_unscaled.score_mae, 'unscaled_MSE': measure_unscaled.score_mse, 'unscaled_RMSE': measure_unscaled.score_rmse, 93 | 'unscaled_MAPE': measure_unscaled.score_mape, 'unscaled_SMAPE': measure_unscaled.score_smape} 94 | 95 | if n_runs == 1: 96 | save_prediction_to_csv(y_true, y_pred, self.filename, self.path_save_result) 97 | save_loss_train_to_csv(loss_train, self.filename, self.path_save_result + "Error-") 98 | if self.draw: 99 | draw_predict_with_error([y_true, y_pred], [measure_unscaled.score_rmse, measure_unscaled.score_mae], self.filename, self.path_save_result) 100 | if self.print_train: 101 | print('Predict DONE - RMSE: %f, MAE: %f' % (measure_unscaled.score_rmse, measure_unscaled.score_mae)) 102 | 103 | save_all_models_to_csv(item, self.log_filename, self.path_save_result) 104 | 105 | def _forecasting__(self): 106 | pass 107 | 108 | def _training__(self): 109 | pass 110 | 111 | def _running__(self): 112 | pass 113 | -------------------------------------------------------------------------------- /model/root/traditional/root_elm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 18:21, 06/04/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | import time 11 | from model.root.root_base import RootBase 12 | import utils.MathUtil as my_math 13 | 14 | 15 | class RootElm(RootBase): 16 | def __init__(self, root_base_paras=None, root_elm_paras=None): 17 | RootBase.__init__(self, root_base_paras) 18 | self.activation = root_elm_paras["activation"] 19 | if root_elm_paras["hidden_size"][1]: 20 | self.hidden_size = root_elm_paras["hidden_size"][0] 21 | else: 22 | self.hidden_size = 2*root_base_paras["sliding"]*root_base_paras["feature_size"] + 1 23 | ## New discovery 24 | self._activation__ = getattr(my_math, self.activation) 25 | 26 | def _running__(self): 27 | self.time_system = time.time() 28 | self._preprocessing_2d__() 29 | self.time_total_train = time.time() 30 | self._training__() 31 | self.time_total_train = round(time.time() - self.time_total_train, 4) 32 | self.time_epoch = None 33 | self.time_predict = time.time() 34 | y_true_unscaled, y_pred_unscaled, y_true_scaled, y_pred_scaled = self._forecasting__() 35 | self.time_predict = round(time.time() - self.time_predict, 8) 36 | self.time_system = round(time.time() - self.time_system, 4) 37 | self._save_results__(y_true_unscaled, y_pred_unscaled, y_true_scaled, y_pred_scaled, self.loss_train, self.n_runs) 38 | -------------------------------------------------------------------------------- /model/root/traditional/root_mlnn.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 18:15, 06/04/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from model.root.root_base import RootBase 11 | import time 12 | 13 | class RootMlnn(RootBase): 14 | def __init__(self, root_base_paras=None, root_mlnn_paras=None): 15 | RootBase.__init__(self, root_base_paras) 16 | self.epoch = root_mlnn_paras["epoch"] 17 | self.batch_size = root_mlnn_paras["batch_size"] 18 | self.learning_rate = root_mlnn_paras["learning_rate"] 19 | self.activations = root_mlnn_paras["activations"] 20 | self.optimizer = root_mlnn_paras["optimizer"] 21 | self.loss = root_mlnn_paras["loss"] 22 | if root_mlnn_paras["hidden_sizes"][-1]: 23 | self.hidden_sizes = root_mlnn_paras["hidden_sizes"][:-1] 24 | else: 25 | num_hid = len(root_mlnn_paras["hidden_sizes"]) - 1 26 | self.hidden_sizes = [(num_hid - i) * root_base_paras["sliding"] * root_base_paras["feature_size"] + 1 for i in range(num_hid)] 27 | 28 | def _forecasting__(self): 29 | # Evaluate models on the test set 30 | y_pred = self.model.predict(self.X_test) 31 | pred_inverse = self.scaler.inverse_transform(y_pred) 32 | real_inverse = self.scaler.inverse_transform(self.y_test) 33 | return real_inverse, pred_inverse, self.y_test, y_pred 34 | 35 | def _running__(self): 36 | self.time_system = time.time() 37 | self._preprocessing_2d__() 38 | self.time_total_train = time.time() 39 | self._training__() 40 | self.time_total_train = round(time.time() - self.time_total_train, 4) 41 | self.time_epoch = round(self.time_total_train / self.epoch, 4) 42 | self.time_predict = time.time() 43 | y_true_unscaled, y_pred_unscaled, y_true_scaled, y_pred_scaled = self._forecasting__() 44 | self.time_predict = round(time.time() - self.time_predict, 8) 45 | self.time_system = round(time.time() - self.time_system, 4) 46 | self._save_results__(y_true_unscaled, y_pred_unscaled, y_true_scaled, y_pred_scaled, self.loss_train, self.n_runs) 47 | 48 | 49 | -------------------------------------------------------------------------------- /model/root/traditional/root_rnn.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 18:23, 06/04/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from model.root.root_base import RootBase 11 | import time 12 | 13 | class RootRnn(RootBase): 14 | def __init__(self, root_base_paras=None, root_rnn_paras=None): 15 | RootBase.__init__(self, root_base_paras) 16 | self.epoch = root_rnn_paras["epoch"] 17 | self.batch_size = root_rnn_paras["batch_size"] 18 | self.learning_rate = root_rnn_paras["learning_rate"] 19 | self.activations = root_rnn_paras["activations"] 20 | self.optimizer = root_rnn_paras["optimizer"] 21 | self.loss = root_rnn_paras["loss"] 22 | self.dropouts = root_rnn_paras["dropouts"] 23 | if root_rnn_paras["hidden_sizes"][-1]: 24 | self.hidden_sizes = root_rnn_paras["hidden_size"][:-1] 25 | else: 26 | num_hid = len(root_rnn_paras["hidden_size"]) - 1 27 | self.hidden_sizes = [(num_hid - i) * root_base_paras["sliding"] * root_base_paras["feature_size"] + 1 for i in range(num_hid)] 28 | 29 | def _forecasting__(self): 30 | y_pred = self.model.predict(self.X_test) 31 | pred_inverse = self.scaler.inverse_transform(y_pred) 32 | real_inverse = self.scaler.inverse_transform(self.y_test) 33 | return real_inverse, pred_inverse, self.y_test, y_pred 34 | 35 | def _running__(self): 36 | self.time_system = time.time() 37 | self._preprocessing_3d__() 38 | self.time_total_train = time.time() 39 | self._training__() 40 | self.time_total_train = round(time.time() - self.time_total_train, 4) 41 | self.time_epoch = round(self.time_total_train / self.epoch, 4) 42 | self.time_predict = time.time() 43 | y_true_unscaled, y_pred_unscaled, y_true_scaled, y_pred_scaled = self._forecasting__() 44 | self.time_predict = round(time.time() - self.time_predict, 8) 45 | self.time_system = round(time.time() - self.time_system, 4) 46 | self._save_results__(y_true_unscaled, y_pred_unscaled, y_true_scaled, y_pred_scaled, self.loss_train, self.n_runs) 47 | -------------------------------------------------------------------------------- /otwo_elm_script.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 00:51, 29/03/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from os.path import splitext, basename, realpath 11 | from sklearn.model_selection import ParameterGrid 12 | from model.main.hybrid_elm import OTwoElm 13 | from utils.SettingPaper import two_elm_paras_final as param_grid 14 | from utils.SettingPaper import * 15 | from utils.IOUtil import load_dataset 16 | 17 | if SP_RUN_TIMES == 1: 18 | all_model_file_name = SP_LOG_FILENAME 19 | else: # If runs with more than 1, like stability test --> name of the models ==> such as: rnn1hl.csv 20 | all_model_file_name = str(splitext(basename(realpath(__file__)))[0]) 21 | 22 | 23 | def train_model(item): 24 | root_base_paras = { 25 | "dataset": dataset, 26 | "feature_size": feature_size, 27 | "data_idx": SP_DATA_SPLIT_INDEX_2, 28 | "sliding": item["sliding"], 29 | "multi_output": multi_output, 30 | "output_idx": output_index, 31 | "method_statistic": SP_PREPROCESSING_METHOD, 32 | "log_filename": all_model_file_name, 33 | "n_runs": SP_RUN_TIMES, # 1 or others 34 | "path_save_result": SP_PATH_SAVE_BASE + SP_DATA_FILENAME[loop] + "/", 35 | "draw": SP_DRAW, 36 | "print_train": SP_PRINT_TRAIN, # 0: nothing, 1 : full detail, 2: short version 37 | } 38 | paras_name = "hs_{}-ep_{}-act_{}".format(item["hidden_size"], item["epoch"], item["activation"]) 39 | root_hybrid_paras = { 40 | "hidden_size": item["hidden_size"], "activation": item["activation"], "epoch": item["epoch"], "domain_range": item["domain_range"], 41 | "paras_name": paras_name 42 | } 43 | two_paras = { 44 | "epoch": item["epoch"], "pop_size": item["pop_size"] 45 | } 46 | md = OTwoElm(root_base_paras=root_base_paras, root_hybrid_paras=root_hybrid_paras, two_paras=two_paras) 47 | md._running__() 48 | 49 | 50 | for _ in range(SP_RUN_TIMES): 51 | for loop in range(len(SP_DATA_FILENAME)): 52 | filename = SP_LOAD_DATA_FROM + SP_DATA_FILENAME[loop] 53 | dataset = load_dataset(filename, cols=SP_DATA_COLS[loop]) 54 | feature_size = len(SP_DATA_COLS[loop]) 55 | multi_output = SP_DATA_MULTI_OUTPUT[loop] 56 | output_index = SP_OUTPUT_INDEX[loop] 57 | # Create combination of params. 58 | for item in list(ParameterGrid(param_grid)): 59 | train_model(item) 60 | 61 | -------------------------------------------------------------------------------- /project_note.md: -------------------------------------------------------------------------------- 1 | # Links: 2 | ```code 3 | 1. code: https://github.com/chasebk/code_OTWO_ELM 4 | 2. paper: https://github.com/chasebk/paper_OTWO_ELM 5 | ``` 6 | 7 | # Model comparison (normal and stability) 8 | 1. MLNN 9 | 2. ELM 10 | 3. GA-ELM 11 | 4. PSO-ELM 12 | 5. TWO-ELM 13 | 6. OTWO-ELM 14 | 15 | 16 | # Project structure 17 | 1. General view class 18 | ![Our model](drafts/images/code/all_code_wrapper.png) 19 | 20 | 2. Details view class 21 | * root files 22 | 23 | ![](drafts/images/code/root_ann.png) ![](drafts/images/code/root_rnn.png) ![](drafts/images/code/root_hybrid_mlnn.png) 24 | 25 | * algorithm files 26 | 27 | ![](drafts/images/code/GA.png) ![](drafts/images/code/DE.png) ![](drafts/images/code/PSO.png) 28 | 29 | ![](drafts/images/code/CRO.png) ![](drafts/images/code/BFO.png) 30 | 31 | * main files 32 | 33 | ![Our model](drafts/images/code/hybrid_mlnn.png) 34 | 35 | ![Our model](drafts/images/code/neural_network.png) 36 | 37 | 38 | 39 | 40 | ## Optimized the number of hidden neuron in hidden layer 41 | ```code 42 | https://iopscience.iop.org/article/10.1088/1757-899X/261/1/012002/pdf 43 | https://sci-hub.tw/10.1016/j.neucom.2011.12.062 44 | https://arxiv.org/pdf/1501.06115.pdf 45 | https://www.researchgate.net/publication/271201213_A_detailed_analysis_on_extreme_learning_machine_and_novel_approaches_based_on_ELM 46 | https://www.researchgate.net/post/Can_anyone_help_with_Training_Extreme_Learning_Machines_neural_network_on_very_Large_Datasets 47 | https://www.sciencedirect.com/science/article/pii/S2212671612002181 48 | http://www3.ntu.edu.sg/home/ASAHTan/Papers/2008/ELM%20NEUCOM%2008.pdf 49 | http://or.nsfc.gov.cn/bitstream/00001903-5/112878/1/1000004116461.pdf 50 | 51 | ``` 52 | 53 | 54 | ## Server Errors 55 | ```code 56 | 1. Maybe multi-threading error between numpy and openBlas 57 | - We should check what is the core-backend of numpy in server: blas or mkl 58 | python 59 | import numpy 60 | numpy.__config__.show() 61 | 62 | https://stackoverflow.com/questions/17053671/python-how-do-you-stop-numpy-from-multithreading 63 | https://stackoverflow.com/questions/19257070/unintented-multithreading-in-python-scikit-learn 64 | 65 | - Numpy will consume so much time when running multi-thread because the time for exchanging data among cores. 66 | So we should prevent numpy running multi-thread on server. 67 | 68 | Adding to the file: ~/.bashrc or ~/.bash_profile: 69 | export OPENBLAS_NUM_THREADS=1 (If OpenBlas) 70 | export MKL_NUM_THREADS=1 (If MKL) 71 | 72 | export OPENBLAS_NUM_THREADS=1 73 | export MKL_NUM_THREADS=1 74 | 75 | source ~/.bashrc 76 | 77 | 2. Cannot share object related to matplotlib on server 78 | sudo apt update 79 | sudo apt install libgl1-mesa-glx 80 | ``` 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /pso_elm_script.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 00:51, 29/03/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from os.path import splitext, basename, realpath 11 | from sklearn.model_selection import ParameterGrid 12 | from model.main.hybrid_elm import PsoElm 13 | from utils.SettingPaper import pso_elm_paras_final as param_grid 14 | from utils.SettingPaper import * 15 | from utils.IOUtil import load_dataset 16 | 17 | if SP_RUN_TIMES == 1: 18 | all_model_file_name = SP_LOG_FILENAME 19 | else: # If runs with more than 1, like stability test --> name of the models ==> such as: rnn1hl.csv 20 | all_model_file_name = str(splitext(basename(realpath(__file__)))[0]) 21 | 22 | 23 | def train_model(item): 24 | root_base_paras = { 25 | "dataset": dataset, 26 | "feature_size": feature_size, 27 | "data_idx": SP_DATA_SPLIT_INDEX_2, 28 | "sliding": item["sliding"], 29 | "multi_output": multi_output, 30 | "output_idx": output_index, 31 | "method_statistic": SP_PREPROCESSING_METHOD, 32 | "log_filename": all_model_file_name, 33 | "n_runs": SP_RUN_TIMES, # 1 or others 34 | "path_save_result": SP_PATH_SAVE_BASE + SP_DATA_FILENAME[loop] + "/", 35 | "draw": SP_DRAW, 36 | "print_train": SP_PRINT_TRAIN, # 0: nothing, 1 : full detail, 2: short version 37 | } 38 | paras_name = "hs_{}-ep_{}-act_{}-pc_{}-pm_{}".format(item["hidden_size"], item["epoch"], item["activation"], item["c_minmax"], item["w_minmax"]) 39 | root_hybrid_paras = { 40 | "hidden_size": item["hidden_size"], "activation": item["activation"], "epoch": item["epoch"], "domain_range": item["domain_range"], 41 | "paras_name": paras_name 42 | } 43 | pso_paras = { 44 | "epoch": item["epoch"], "pop_size": item["pop_size"], "c_minmax": item["c_minmax"], "w_minmax": item["w_minmax"] 45 | } 46 | md = PsoElm(root_base_paras=root_base_paras, root_hybrid_paras=root_hybrid_paras, pso_paras=pso_paras) 47 | md._running__() 48 | 49 | 50 | for _ in range(SP_RUN_TIMES): 51 | for loop in range(len(SP_DATA_FILENAME)): 52 | filename = SP_LOAD_DATA_FROM + SP_DATA_FILENAME[loop] 53 | dataset = load_dataset(filename, cols=SP_DATA_COLS[loop]) 54 | feature_size = len(SP_DATA_COLS[loop]) 55 | multi_output = SP_DATA_MULTI_OUTPUT[loop] 56 | output_index = SP_OUTPUT_INDEX[loop] 57 | # Create combination of params. 58 | for item in list(ParameterGrid(param_grid)): 59 | train_model(item) 60 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # A Novel Workload Prediction Model Using ELM with Opposition-based Tug of War Optimization 2 | [![GitHub release](https://img.shields.io/badge/release-2.0.0-yellow.svg)]() 3 | [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3626114.svg)](https://doi.org/10.5281/zenodo.3626114) 4 | [![License](https://img.shields.io/packagist/l/doctrine/orm.svg)]() 5 | 6 | ## Dear friends and followers 7 | * I updated to repository to the newest version, which is very easy to read and reproduce. 8 | * All of our optimizer (meta-heuristics) now deleted and taken the new one from my newest library: 9 | 10 | https://pypi.org/project/mealpy/ 11 | 12 | * If you use my code or library in your project, I would appreciate the cites: 13 | * Nguyen, T., Nguyen, T., Nguyen, B. M., & Nguyen, G. (2019). Efficient Time-Series Forecasting Using Neural Network and Opposition-Based Coral Reefs Optimization. International Journal of Computational Intelligence Systems, 12(2), 1144-1161. 14 | 15 | * Nguyen, T., Nguyen, B. M., & Nguyen, G. (2019, April). Building Resource Auto-scaler with Functional-Link Neural Network and Adaptive Bacterial Foraging Optimization. In International Conference on Theory and Applications of Models of Computation (pp. 501-517). Springer, Cham. 16 | 17 | * Nguyen, T., Tran, N., Nguyen, B. M., & Nguyen, G. (2018, November). A Resource Usage Prediction System Using Functional-Link and Genetic Algorithm Neural Network for Multivariate Cloud Metrics. In 2018 IEEE 11th Conference on Service-Oriented Computing and Applications (SOCA) (pp. 49-56). IEEE. 18 | 19 | * If you want to know more about code, or want a pdf of both above paper, contact me: nguyenthieu2102@gmail.com 20 | 21 | ## How to read my repository 22 | 1. data: include raw and formatted data 23 | 2. envs: include conda environment and how to install conda environment 24 | 3. utils: Helped functions such as IO, Draw, Math, Settings (for all model and parameters), Preprocessing... 25 | 4. model: (2 folders) 26 | * root: (want to understand the code, read this classes first) 27 | * root_base.py: root for all models (traditional, hybrid and variants...) 28 | * traditional: root for all traditional models (inherit: root_base) 29 | * hybrid: root for all hybrid models (inherit: root_base) 30 | * main: (final models) 31 | * this classes will use those optimizer above and those root (traditional, hybrid) above 32 | * the running files (outside with the downloaded folder) will call this classes 33 | * the traditional models will use single file such as: traditional_elm, traditional_rnn,... 34 | * the hybrid models will use 2 files, example: hybrid_elm.py and GA.py (optimizer files) 35 | 6. special files 36 | * *_scipt.py: running files (*: represent model) such as ga_elm_script.py => GA + ELM 37 | 38 | 39 | ## Notes 40 | 41 | 1. To improve the speed of Pycharm when opening (because Pycharm will indexing when opening), you should right click to 42 | paper and data folder => Mark Directory As => Excluded 43 | 44 | 2. How to run models? 45 | ```code 46 | 1. Before runs the models, make sure you clone this repository in your laptop: 47 | https://github.com/chasebk/code_OTWO_ELM 48 | 49 | 2. Then open it in your editor like Pycharm or Spider... 50 | 51 | 3. Now you need to create python environment using conda (assumpted that you have already had it). Open terminal 52 | conda your_environment_name create -f envs/env.yml (go to the root project folder and create new environment from my file in: envs/env.yml) 53 | 54 | 4. Now you can activate your environment and run the models 55 | conda activate your_environment_name # First, activate your environment to get the needed libraries. 56 | python model_name 57 | 58 | For example: 59 | conda ai_env create -f envs/env.yml 60 | conda activate ai_env 61 | python elm_script.py 62 | 63 | 5. My model name: 64 | 65 | 1. MLNN (1 HL) => mlnn1hl_script.py 66 | 2. ELM => elm_script.py 67 | 3. GA-ELM => ga_elm_script.py 68 | 4. PSO-ELM => pso_elm_script.py 69 | 5. ABFOLS-ELM => abfols_elm_script.py 70 | 6. DE-ELM => de_elm_script.py 71 | 7. TWO-ELM => two_elm_script.py 72 | 8. OTWO-ELM => otwo_elm_script.py 73 | ``` 74 | 75 | ### How to change model's parameters? 76 | ```code 77 | You can change the model's parameters in file: utils/SettingPaper.py 78 | 79 | For example: 80 | 81 | +) For traditional models: MLNN, ELM 82 | 83 | ####: MLNN-1HL 84 | mlnn1hl_paras_final = { 85 | "sliding": [2, 5, 10], 86 | "hidden_sizes" : [[5] ], 87 | "activations": [("elu", "elu")], # 0: elu, 1:relu, 2:tanh, 3:sigmoid 88 | "learning_rate": [0.0001], 89 | "epoch": [5000], 90 | "batch_size": [128], 91 | "optimizer": ["adam"], # GradientDescentOptimizer, AdamOptimizer, AdagradOptimizer, AdadeltaOptimizer 92 | "loss": ["mse"] 93 | } 94 | 95 | - If you want to tune the parameters, you can adding more value in each parameters like this: 96 | 97 | - sliding: [1, 2, 3, 4] or you want just 1 parameter: [12] 98 | - hidden_sizes: [ [5], [10], [100] ] or [ [14] ] 99 | - activations: [ ("elu", "relu"), ("elu", "tanh") ] or just: [ ("elu", "elu") ] 100 | - learning_rate: [0.1, 0.01, 0.001] or just: [0.1] 101 | .... 102 | 103 | 104 | + For hybrid models: GA_ELM, PSO_ELM, ABFOLS-ELM, TWO-ELM, OTWO-ELM 105 | 106 | #### : GA-ELM 107 | ga_elm_paras_final = { 108 | "sliding": [2, 3, 5], 109 | "hidden_size" : [(5, False)], 110 | "activation": ["elu"], 111 | "train_valid_rate": [(0.6, 0.4)], 112 | 113 | "epoch": [100], 114 | "pop_size": [20], # 100 -> 900 115 | "pc": [0.95], # 0.85 -> 0.97 116 | "pm": [0.025], # 0.005 -> 0.10 117 | "domain_range": [(-1, 1)] # lower and upper bound 118 | } 119 | 120 | - Same as traditional models. 121 | ``` 122 | 123 | ### Where is the results folder? 124 | ```code 125 | - Look at the running file, for example: ga_elm_script.py 126 | 127 | +) For 1-time runs (Only run 1 time for each model). 128 | _There are 3 type of results file include: model_name.csv file, model_name.png file and Error-model_name.csv file 129 | _model_name.csv included: y_true and y_predict 130 | _model_name.png is visualized of: y_true and y_predict (test dataset) 131 | _Error-model_name.csv included errors of training dataset after epoch. 1st, 2nd column are: MSE errors 132 | 133 | => All 3 type of files above is automatically generated in folder which you can set in SettingPaper 134 | 135 | +) For stability runs (Run each model n-time with same parameters). 136 | Because in this test, we don't need to visualize the y_true and y_predict and also don't need to save y_true and y_predict 137 | So I just save n-time running in the same csv files in folder 138 | 139 | - Noted: 140 | 141 | + In the training set we use MSE. But for the testing set, we can use so much more error like: R2, MAPE, ... 142 | You can find the function code described it in file: 143 | model/root/root_base.py 144 | + _save_results__: 145 | ``` 146 | 147 | * Take a look at project_structure.md file. Describe how the project was built. 148 | -------------------------------------------------------------------------------- /two_elm_script.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 00:51, 29/03/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | from os.path import splitext, basename, realpath 11 | from sklearn.model_selection import ParameterGrid 12 | from model.main.hybrid_elm import TwoElm 13 | from utils.SettingPaper import two_elm_paras_final as param_grid 14 | from utils.SettingPaper import * 15 | from utils.IOUtil import load_dataset 16 | 17 | if SP_RUN_TIMES == 1: 18 | all_model_file_name = SP_LOG_FILENAME 19 | else: # If runs with more than 1, like stability test --> name of the models ==> such as: rnn1hl.csv 20 | all_model_file_name = str(splitext(basename(realpath(__file__)))[0]) 21 | 22 | 23 | def train_model(item): 24 | root_base_paras = { 25 | "dataset": dataset, 26 | "feature_size": feature_size, 27 | "data_idx": SP_DATA_SPLIT_INDEX_2, 28 | "sliding": item["sliding"], 29 | "multi_output": multi_output, 30 | "output_idx": output_index, 31 | "method_statistic": SP_PREPROCESSING_METHOD, 32 | "log_filename": all_model_file_name, 33 | "n_runs": SP_RUN_TIMES, # 1 or others 34 | "path_save_result": SP_PATH_SAVE_BASE + SP_DATA_FILENAME[loop] + "/", 35 | "draw": SP_DRAW, 36 | "print_train": SP_PRINT_TRAIN, # 0: nothing, 1 : full detail, 2: short version 37 | } 38 | paras_name = "hs_{}-ep_{}-act_{}".format(item["hidden_size"], item["epoch"], item["activation"]) 39 | root_hybrid_paras = { 40 | "hidden_size": item["hidden_size"], "activation": item["activation"], "epoch": item["epoch"], "domain_range": item["domain_range"], 41 | "paras_name": paras_name 42 | } 43 | two_paras = { 44 | "epoch": item["epoch"], "pop_size": item["pop_size"] 45 | } 46 | md = TwoElm(root_base_paras=root_base_paras, root_hybrid_paras=root_hybrid_paras, two_paras=two_paras) 47 | md._running__() 48 | 49 | 50 | for _ in range(SP_RUN_TIMES): 51 | for loop in range(len(SP_DATA_FILENAME)): 52 | filename = SP_LOAD_DATA_FROM + SP_DATA_FILENAME[loop] 53 | dataset = load_dataset(filename, cols=SP_DATA_COLS[loop]) 54 | feature_size = len(SP_DATA_COLS[loop]) 55 | multi_output = SP_DATA_MULTI_OUTPUT[loop] 56 | output_index = SP_OUTPUT_INDEX[loop] 57 | # Create combination of params. 58 | for item in list(ParameterGrid(param_grid)): 59 | train_model(item) 60 | -------------------------------------------------------------------------------- /utils/GraphUtil.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | """ 4 | Created on Sun Apr 15 09:05:56 2018 5 | @author: thieunv 6 | """ 7 | #import matplotlib as mpl 8 | #mpl.use('Agg') 9 | import matplotlib.pyplot as plt 10 | 11 | def draw_predict(y_test=None, y_pred=None, filename=None, pathsave=None): 12 | plt.plot(y_test) 13 | plt.plot(y_pred) 14 | plt.ylabel('CPU') 15 | plt.xlabel('Timestamp') 16 | plt.legend(['Actual', 'Predict'], loc='upper right') 17 | plt.savefig(pathsave + filename + ".png") 18 | plt.close() 19 | return None 20 | 21 | def draw_predict_with_error(data=None, error=None, filename=None, pathsave=None): 22 | plt.plot(data[0]) 23 | plt.plot(data[1]) 24 | plt.ylabel('Real value') 25 | plt.xlabel('Point') 26 | plt.legend(['Predict y... RMSE= ' + str(error[0]), 'Test y... MAE= ' + str(error[1])], loc='upper right') 27 | plt.savefig(pathsave + filename + ".png") 28 | plt.close() 29 | return None 30 | 31 | def draw_raw_time_series_data(data=None, label=None, title=None, filename=None, pathsave=None): 32 | plt.plot(data) 33 | plt.xlabel(label["y"]) 34 | plt.ylabel(label["x"]) 35 | plt.title(title, fontsize=8) 36 | plt.savefig(pathsave + filename + ".pdf") 37 | plt.close() 38 | return None 39 | 40 | def draw_raw_time_series_data_and_show(data=None, label=None, title=None): 41 | plt.plot(data) 42 | plt.xlabel(label["y"]) 43 | plt.ylabel(label["x"]) 44 | plt.title(title, fontsize=8) 45 | plt.show() 46 | return None 47 | 48 | -------------------------------------------------------------------------------- /utils/IOUtil.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # ------------------------------------------------------------------------------------------------------% 3 | # Created by "Thieu Nguyen" at 00:51, 29/03/2020 % 4 | # % 5 | # Email: nguyenthieu2102@gmail.com % 6 | # Homepage: https://www.researchgate.net/profile/Thieu_Nguyen6 % 7 | # Github: https://github.com/thieunguyen5991 % 8 | # -------------------------------------------------------------------------------------------------------% 9 | 10 | import numpy as np 11 | import pandas as pd 12 | from csv import DictWriter 13 | from os import getcwd, path, makedirs 14 | 15 | 16 | def save_all_models_to_csv(item=None, log_filename=None, pathsave=None): 17 | check_directory = getcwd() + "/" + pathsave 18 | if not path.exists(check_directory): 19 | makedirs(check_directory) 20 | with open(pathsave + log_filename + ".csv", 'a') as file: 21 | w = DictWriter(file, delimiter=',', lineterminator='\n', fieldnames=item.keys()) 22 | if file.tell() == 0: 23 | w.writeheader() 24 | w.writerow(item) 25 | 26 | 27 | def save_prediction_to_csv(y_test=None, y_pred=None, filename=None, pathsave=None): 28 | check_directory = getcwd() + "/" + pathsave 29 | if not path.exists(check_directory): 30 | makedirs(check_directory) 31 | 32 | temp = np.concatenate((y_test, y_pred), axis=1) 33 | np.savetxt(pathsave + filename + ".csv", temp, delimiter=",") 34 | return None 35 | 36 | 37 | def save_loss_train_to_csv(error=None, filename=None, pathsave=None): 38 | np.savetxt(pathsave + filename + ".csv", np.array(error), delimiter=",") 39 | return None 40 | 41 | 42 | def load_dataset(path_to_data=None, cols=None): 43 | df = pd.read_csv(path_to_data + ".csv", usecols=cols) 44 | return df.values 45 | 46 | 47 | 48 | 49 | 50 | def save_run_test(num_run_test=None, data=None, filepath=None): 51 | t0 = np.reshape(data, (num_run_test, -1)) 52 | np.savetxt(filepath, t0, delimiter=",") 53 | 54 | def load_prediction_results(pathfile=None, delimiter=",", header=None): 55 | df = pd.read_csv(pathfile, sep=delimiter, header=header) 56 | return df.values[:, 0:1], df.values[:, 1:2] 57 | 58 | def save_number_of_vms(data=None, pathfile=None): 59 | t0 = np.reshape(data, (-1, 1)) 60 | np.savetxt(pathfile, t0, delimiter=",") 61 | 62 | def load_number_of_vms(pathfile=None, delimiter=",", header=None): 63 | df = pd.read_csv(pathfile, sep=delimiter, header=header) 64 | return df.values[:, 0:1] 65 | 66 | 67 | 68 | def save_scaling_results_to_csv(data=None, path_file=None): 69 | np.savetxt(path_file + ".csv", np.array(data), delimiter=",") 70 | return None 71 | 72 | def read_dataset_file(filepath=None, usecols=None, header=0, index_col=False, inplace=True): 73 | df = pd.read_csv(filepath, usecols=usecols, header=header, index_col=index_col) 74 | df.dropna(inplace=inplace) 75 | return df.values 76 | 77 | def save_formatted_data_csv(dataset=None, filename=None, pathsave=None): 78 | np.savetxt(pathsave + filename + ".csv", dataset, delimiter=",") 79 | return None -------------------------------------------------------------------------------- /utils/MathUtil.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python2 2 | # -*- coding: utf-8 -*- 3 | """ 4 | Created on Sun Apr 15 10:13:13 2018 5 | @author: thieunv 6 | 7 | Link : http://sci-hub.tw/10.1109/iccat.2013.6521977 8 | https://en.wikipedia.org/wiki/Laguerre_polynomials 9 | 10 | """ 11 | 12 | import numpy as np 13 | 14 | def itself(x): 15 | return x 16 | def elu(x, alpha=1): 17 | return np.where(x < 0, alpha * (np.exp(x) - 1), x) 18 | def relu(x): 19 | return np.maximum(0, x) 20 | def tanh(x): 21 | return np.tanh(x) 22 | def sigmoid(x): 23 | return 1.0 / (1.0 + np.exp(-x)) 24 | 25 | def derivative_self(x): 26 | return 1 27 | def derivative_elu(x, alpha=1): 28 | return np.where(x < 0, x + alpha, 1) 29 | def derivative_relu(x): 30 | return np.where(x < 0, 0, 1) 31 | def derivative_tanh(x): 32 | return 1 - np.power(x, 2) 33 | def derivative_sigmoid(x): 34 | return np.multiply(x, 1-x) 35 | 36 | 37 | def expand_chebyshev(x): 38 | x1 = x 39 | x2 = 2 * np.power(x, 2) - 1 40 | x3 = 4 * np.power(x, 3) - 3 * x 41 | x4 = 8 * np.power(x, 4) - 8 * np.power(x, 2) + 1 42 | x5 = 16 * np.power(x, 5) - 20 * np.power(x, 3) + 5 * x 43 | return np.concatenate( (x1, x2, x3, x4, x5), axis=1 ) 44 | 45 | def expand_legendre(x): 46 | x1 = x 47 | x2 = 1/2 * ( 3 * np.power(x, 2) - 1 ) 48 | x3 = 1/2 * (5 * np.power(x, 3) - 3 * x) 49 | x4 = 1/8 * ( 35 * np.power(x, 4) - 30 * np.power(x, 2) + 3 ) 50 | x5 = 1/40 * ( 9 * np.power(x, 5) - 350 * np.power(x, 3) + 75 * x ) 51 | return np.concatenate((x1, x2, x3, x4, x5), axis=1 ) 52 | 53 | def expand_laguerre(x): 54 | x1 = -x + 1 55 | x2 = 1/2 * ( np.power(x, 2) - 4 * x + 2) 56 | x3 = 1/6 * (-np.power(x, 3) + 9 * np.power(x, 2) - 18 * x + 6) 57 | x4 = 1/24 * (np.power(x, 4) - 16 * np.power(x, 3) + 72 * np.power(x, 2) - 96*x + 24) 58 | x5 = 1/120 * (-np.power(x, 5) + 25 * np.power(x, 4) - 200 * np.power(x, 3) + 600 * np.power(x, 2) - 600 * x + 120) 59 | return np.concatenate((x1, x2, x3, x4, x5), axis=1 ) 60 | 61 | def expand_power(x): 62 | x1 = x 63 | x2 = x1 + np.power(x, 2) 64 | x3 = x2 + np.power(x, 3) 65 | x4 = x3 + np.power(x, 4) 66 | x5 = x4 + np.power(x, 5) 67 | return np.concatenate((x1, x2, x3, x4, x5), axis=1) 68 | 69 | def expand_trigonometric(x): 70 | x1 = x 71 | x2 = np.sin(np.pi * x) + np.cos(np.pi * x) 72 | x3 = np.sin(2 * np.pi * x) + np.cos(2 * np.pi * x) 73 | x4 = np.sin(3 * np.pi * x) + np.cos(3 * np.pi * x) 74 | x5 = np.sin(4 * np.pi * x) + np.cos(4 * np.pi * x) 75 | return np.concatenate((x1, x2, x3, x4, x5), axis=1) -------------------------------------------------------------------------------- /utils/MeasureUtil.py: -------------------------------------------------------------------------------- 1 | from sklearn.metrics import explained_variance_score, mean_absolute_error, mean_squared_error, mean_squared_log_error, median_absolute_error, r2_score 2 | import numpy as np 3 | 4 | 5 | class MeasureTimeSeries(object): 6 | def __init__(self, y_true, y_pred, multi_output=None, number_rounding=3): 7 | """ 8 | :param y_true: 9 | :param y_pred: 10 | :param multi_output: string in [‘raw_values’, ‘uniform_average’, ‘variance_weighted’] or array-like of shape (n_outputs) 11 | :param number_rounding: 12 | """ 13 | self.y_true = y_true 14 | self.y_pred = y_pred 15 | self.multi_output = multi_output 16 | self.number_rounding = number_rounding 17 | self.score_ev, self.score_mae, self.score_mse, self.score_msle, self.score_meae = None, None, None, None, None 18 | self.score_r2, self.score_rmse, self.score_mape, self.score_smape = None, None, None, None 19 | 20 | def explained_variance_score(self): 21 | temp = explained_variance_score(self.y_true, self.y_pred, multioutput=self.multi_output) 22 | self.score_ev = np.round(temp, self.number_rounding) 23 | 24 | def mean_absolute_error(self): 25 | temp = mean_absolute_error(self.y_true, self.y_pred, multioutput=self.multi_output) 26 | self.score_mae = np.round(temp, self.number_rounding) 27 | 28 | def mean_squared_error(self): 29 | temp = mean_squared_error(self.y_true, self.y_pred, multioutput=self.multi_output) 30 | self.score_mse = np.round(temp, self.number_rounding) 31 | 32 | def mean_squared_log_error(self): 33 | y_true = np.where(self.y_true < 0, 0, self.y_true) 34 | y_pred = np.where(self.y_pred < 0, 0, self.y_pred) 35 | temp = mean_squared_log_error(y_true, y_pred, multioutput=self.multi_output) 36 | self.score_msle = np.round(temp, self.number_rounding) 37 | 38 | def median_absolute_error(self): 39 | if self.multi_output is not None: 40 | print("Median absolute error is not supported for multi output") 41 | return None 42 | temp = median_absolute_error(self.y_true, self.y_pred) 43 | self.score_meae = np.round(temp, self.number_rounding) 44 | 45 | def r2_score_error(self): 46 | temp = r2_score(self.y_true, self.y_pred, multioutput=self.multi_output) 47 | self.score_r2 = np.round(temp, self.number_rounding) 48 | 49 | def root_mean_squared_error(self): 50 | temp = np.sqrt(mean_squared_error(self.y_true, self.y_pred, multioutput=self.multi_output)) 51 | self.score_rmse = np.round(temp, self.number_rounding) 52 | 53 | def mean_absolute_percentage_error(self): 54 | temp = np.mean(np.abs((self.y_true - self.y_pred) / self.y_true), axis=0) * 100 55 | self.score_mape = np.round(temp, self.number_rounding) 56 | 57 | def symmetric_mean_absolute_percentage_error(self): 58 | temp = np.mean(2*np.abs(self.y_pred - self.y_true) / (np.abs(self.y_true) + np.abs(self.y_pred)), axis=0) * 100 59 | self.score_smape = np.round(temp, self.number_rounding) 60 | 61 | def _fit__(self): 62 | self.explained_variance_score() 63 | self.mean_absolute_error() 64 | self.mean_squared_error() 65 | self.mean_squared_log_error() 66 | self.r2_score_error() 67 | self.root_mean_squared_error() 68 | self.mean_absolute_percentage_error() 69 | self.symmetric_mean_absolute_percentage_error() -------------------------------------------------------------------------------- /utils/PreprocessingUtil.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from copy import deepcopy 3 | 4 | 5 | class TimeSeries(object): 6 | def __init__(self, dataset=None, data_idx=None, sliding=None, output_index=None, 7 | method_statistic=0, minmax_scaler=None): 8 | ''' 9 | :param data_idx: 10 | :param sliding: 11 | :param output_index: 12 | :param method_statistic: 13 | :param minmax_scaler: 14 | ''' 15 | self.original_dataset = dataset 16 | self.dimension = dataset.shape[1] # The real number of features 17 | self.original_dataset_len = len(dataset) 18 | self.dataset_len = self.original_dataset_len - sliding 19 | 20 | self.train_idx = int(data_idx[0] * self.dataset_len) 21 | self.train_len = self.train_idx 22 | self.valid_idx = self.train_idx + int(data_idx[1] * self.dataset_len) 23 | self.valid_len = self.valid_idx - self.train_idx 24 | self.test_idx = self.dataset_len 25 | self.test_len = self.dataset_len - self.train_len - self.valid_len 26 | self.sliding = sliding 27 | self.output_index = output_index 28 | self.method_statistic = method_statistic 29 | self.minmax_scaler = minmax_scaler 30 | 31 | def __get_dataset_X__(self, list_transform=None): 32 | """ 33 | :param list_transform: [ x1 | t1 ] => Make a window slides 34 | :return: dataset_sliding = [ x1 | x2 | x3| t1 | t2 | t3 | ... ] 35 | """ 36 | dataset_sliding = np.zeros(shape=(self.test_idx, 1)) #[ 0 | x1 | x2 | x3| t1 | t2 | t3 | ... ] 37 | for i in range(self.dimension): 38 | for j in range(self.sliding): 39 | temp = np.array(list_transform[j: self.test_idx + j, i:i + 1]) 40 | dataset_sliding = np.concatenate((dataset_sliding, temp), axis=1) 41 | dataset_sliding = dataset_sliding[:, 1:] #[ x1 | x2 | x3| t1 | t2 | t3 | ... ] 42 | 43 | ## Find the dataset_X by using different statistic method on above window slides 44 | if self.method_statistic == 0: # default 45 | dataset_X = deepcopy(dataset_sliding) 46 | else: 47 | dataset_X = np.zeros(shape=(self.test_idx, 1)) 48 | if self.method_statistic == 1: 49 | """ 50 | mean(x1, x2, x3, ...), mean(t1, t2, t3,...) 51 | """ 52 | for i in range(self.dimension): 53 | meanx = np.reshape(np.mean(dataset_sliding[:, i * self.sliding:(i + 1) * self.sliding], axis=1), (-1, 1)) 54 | dataset_X = np.concatenate((dataset_X, meanx), axis=1) 55 | 56 | if self.method_statistic == 2: 57 | """ 58 | min(x1, x2, x3, ...), mean(x1, x2, x3, ...), max(x1, x2, x3, ....) 59 | """ 60 | for i in range(self.dimension): 61 | minx = np.reshape(np.amin(dataset_sliding[:, i * self.sliding:(i + 1) * self.sliding], axis=1), (-1, 1)) 62 | meanx = np.reshape(np.mean(dataset_sliding[:, i * self.sliding:(i + 1) * self.sliding], axis=1), (-1, 1)) 63 | maxx = np.reshape(np.amax(dataset_sliding[:, i * self.sliding:(i + 1) * self.sliding], axis=1), (-1, 1)) 64 | dataset_X = np.concatenate((dataset_X, minx, meanx, maxx), axis=1) 65 | 66 | if self.method_statistic == 3: 67 | """ 68 | min(x1, x2, x3, ...), median(x1, x2, x3, ...), max(x1, x2, x3, ....), min(t1, t2, t3, ...), median(t1, t2, t3, ...), max(t1, t2, t3, ....) 69 | """ 70 | for i in range(self.dimension): 71 | minx = np.reshape(np.amin(dataset_sliding[:, i * self.sliding:(i + 1) * self.sliding], axis=1), (-1, 1)) 72 | medix = np.reshape(np.median(dataset_sliding[:, i * self.sliding:(i + 1) * self.sliding], axis=1), (-1, 1)) 73 | maxx = np.reshape(np.amax(dataset_sliding[:, i * self.sliding:(i + 1) * self.sliding], axis=1), (-1, 1)) 74 | dataset_X = np.concatenate((dataset_X, minx, medix, maxx), axis=1) 75 | dataset_X = dataset_X[:, 1:] 76 | return dataset_X 77 | 78 | def _preprocessing_2d__(self): 79 | """ 80 | output_index = None 81 | + single input => single output 82 | + multiple input => multiple output 83 | 84 | output_index = number (index) 85 | + single input => single output index 86 | + multiple input => single output index 87 | 88 | valid_idx = 0 ==> No validate data || cpu(t), cpu(t-1), ..., ram(t), ram(t-1),... 89 | """ 90 | 91 | if self.output_index is None: 92 | list_transform = self.minmax_scaler.fit_transform(self.original_dataset) 93 | # print(preprocessing.MinMaxScaler().data_max_) 94 | dataset_y = deepcopy(list_transform[self.sliding:]) # Now we need to find dataset_X 95 | else: 96 | # Example : data [0, 1, 2, 3] 97 | # output_index = 2 ==> Loop scale through 3, 0, 1, 2 98 | # [ cpu, ram, disk_io, disk_space ] 99 | # list_transform: [ 0, disk_space, cpu, ram, disk_io ] 100 | # Cut list_transform: [ disk_space, cpu, ram, disk_io ] 101 | # Dataset y = list_transform[-1] 102 | 103 | list_transform = np.zeros(shape=(self.original_dataset_len, 1)) 104 | for i in range(0, self.dimension): 105 | t = self.output_index - (self.dimension - 1) + i 106 | d1 = self.minmax_scaler.fit_transform( 107 | self.original_dataset[:self.original_dataset_len, t].reshape(-1, 1)) 108 | list_transform = np.concatenate((list_transform, d1), axis=1) 109 | # print(minmax_scaler.data_max_) 110 | list_transform = list_transform[:, 1:] 111 | dataset_y = deepcopy(list_transform[self.sliding:, -1:]) # Now we need to find dataset_X 112 | 113 | dataset_X = self.__get_dataset_X__(list_transform) 114 | 115 | ## Split data to set train and set test 116 | if self.valid_len == 0: 117 | X_train, y_train = dataset_X[0:self.train_idx], dataset_y[0:self.train_idx] 118 | X_test, y_test = dataset_X[self.train_idx:self.test_idx], dataset_y[self.train_idx:self.test_idx] 119 | # print("Processing data done!!!") 120 | return X_train, y_train, None, None, X_test, y_test, self.minmax_scaler 121 | else: 122 | X_train, y_train = dataset_X[0:self.train_idx], dataset_y[0:self.train_idx] 123 | X_valid, y_valid = dataset_X[self.train_idx:self.valid_idx], dataset_y[self.train_idx:self.valid_idx] 124 | X_test, y_test = dataset_X[self.valid_idx:self.test_idx], dataset_y[self.valid_idx:self.test_idx] 125 | # print("Processing data done!!!") 126 | return X_train, y_train, X_valid, y_valid, X_test, y_test, self.minmax_scaler 127 | 128 | def _preprocessing_3d__(self): 129 | if self.output_index is None: 130 | list_transform = self.minmax_scaler.fit_transform(self.original_dataset) 131 | dataset_y = deepcopy(list_transform[self.sliding:]) # Now we need to find dataset_X 132 | else: 133 | list_transform = np.zeros(shape=(self.original_dataset_len, 1)) 134 | for i in range(0, self.dimension): 135 | t = self.output_index - (self.dimension - 1) + i 136 | d1 = self.minmax_scaler.fit_transform( 137 | self.original_dataset[:self.original_dataset_len, t].reshape(-1, 1)) 138 | list_transform = np.concatenate((list_transform, d1), axis=1) 139 | list_transform = list_transform[:, 1:] 140 | dataset_y = deepcopy(list_transform[self.sliding:, -1:]) # Now we need to find dataset_X 141 | dataset_X = self.__get_dataset_X__(list_transform) 142 | ## Split data to set train and set test 143 | if self.valid_len == 0: 144 | X_train, y_train = dataset_X[0:self.train_idx], dataset_y[0:self.train_idx] 145 | X_valid, y_valid = None, None 146 | X_test, y_test = dataset_X[self.train_idx:self.test_idx], dataset_y[self.train_idx:self.test_idx] 147 | 148 | X_train = np.reshape(X_train, (X_train.shape[0], X_train.shape[1], 1 )) 149 | X_test = np.reshape(X_test, (X_test.shape[0], X_test.shape[1], 1)) 150 | # y_train = y_train.flatten() 151 | # y_test = y_test.flatten() 152 | else: 153 | X_train, y_train = dataset_X[0:self.train_idx], dataset_y[0:self.train_idx] 154 | X_valid, y_valid = dataset_X[self.train_idx:self.valid_idx], dataset_y[self.train_idx:self.valid_idx] 155 | X_test, y_test = dataset_X[self.valid_idx:self.test_idx], dataset_y[self.valid_idx:self.test_idx] 156 | 157 | X_train = np.reshape(X_train, (X_train.shape[0], X_train.shape[1], 1)) 158 | X_valid = np.reshape(X_valid, (X_valid.shape[0], X_valid.shape[1], 1)) 159 | X_test = np.reshape(X_test, (X_test.shape[0], X_test.shape[1], 1)) 160 | # y_train = y_train.flatten() 161 | # y_valid = y_valid.flatten() 162 | # y_test = y_test.flatten() 163 | return X_train, y_train, X_valid, y_valid, X_test, y_test, self.minmax_scaler 164 | -------------------------------------------------------------------------------- /utils/SettingPaper.py: -------------------------------------------------------------------------------- 1 | ###### Config for test 2 | 3 | SP_RUN_TIMES = 3 4 | SP_LOG_FILENAME = "LOG_MODELS" 5 | SP_PATH_SAVE_BASE = "history/results/" 6 | SP_DRAW = True 7 | SP_PRINT_TRAIN = 2 # 0: nothing, 1 : full detail, 2: short version 8 | SP_PREPROCESSING_METHOD = 0 # 0: sliding window, 1: mean, 2: min-mean-max, 3: min-median-max 9 | 10 | SP_DATA_SPLIT_INDEX = (0.8, 0, 0.2) 11 | SP_DATA_SPLIT_INDEX_2 = (0.75, 0.15, 0.15) 12 | 13 | SP_LOAD_DATA_FROM = "data/formatted/" 14 | SP_DATA_FILENAME = ["it_eu_5m", "it_uk_5m", "worldcup98_5m"] 15 | SP_DATA_COLS = [[4], [2], [2]] 16 | SP_DATA_MULTI_OUTPUT = [False, False, False] 17 | SP_OUTPUT_INDEX = [None, None, None] 18 | 19 | 20 | ### Full avaiable dataset 21 | # SP_DATA_FILENAME = ["it_eu_5m", "it_uk_5m", "worldcup98_5m", "gg_cpu", "gg_ram", "gg_multi_cpu", "gg_multi_ram"] 22 | # SP_DATA_COLS = [[4], [2], [2], [1], [2], [1, 2], [1, 2]] 23 | # SP_DATA_MULTI_OUTPUT = [False, False, False, False, False, False, False] 24 | # SP_OUTPUT_INDEX = [None, None, None, None, None, 0, 1] 25 | 26 | 27 | 28 | ######################## Paras according to the paper 29 | 30 | ####: MLNN-1HL 31 | mlnn1hl_paras_final = { 32 | "sliding": [2, 3, 5], 33 | "hidden_sizes": [[20, True] ], 34 | "activations": [("elu", "elu")], # 0: elu, 1:relu, 2:tanh, 3:sigmoid 35 | "learning_rate": [0.001], 36 | "epoch": [1000], 37 | "batch_size": [128], 38 | "optimizer": ["adam"], # GradientDescentOptimizer, AdamOptimizer, AdagradOptimizer, AdadeltaOptimizer 39 | "loss": ["mse"] 40 | } 41 | 42 | #### : ELM 43 | elm_paras_final = { 44 | "sliding": [2, 3, 5], 45 | "hidden_size": [(10, False), (50, False), (200, False), (500, False), (1000, False), (5000, False)], 46 | "activation": ["elu"] # elu, relu, tanh, sigmoid 47 | } 48 | 49 | 50 | # ========================= ELM ============================== 51 | 52 | #### : GA-ELM 53 | ga_elm_paras_final = { 54 | "sliding": [2, 3, 5], 55 | "hidden_size": [(5, False)], 56 | "activation": ["elu"], 57 | "train_valid_rate": [(0.6, 0.4)], 58 | 59 | "epoch": [100], 60 | "pop_size": [20], # 100 -> 900 61 | "pc": [0.95], # 0.85 -> 0.97 62 | "pm": [0.025], # 0.005 -> 0.10 63 | "domain_range": [(-1, 1)] # lower and upper bound 64 | } 65 | 66 | #### : DE-ELM 67 | de_elm_paras_final = { 68 | "sliding": [2, 3, 5], 69 | "hidden_size": [(5, False) ], 70 | "activation": ["elu"], # 0: elu, 1:relu, 2:tanh, 3:sigmoid 71 | "train_valid_rate": [(0.6, 0.4)], 72 | 73 | "epoch": [100], 74 | "pop_size": [20], # 10 * problem_size 75 | "wf": [0.8], # Weighting factor 76 | "cr": [0.9], # Crossover rate 77 | "domain_range": [(-1, 1)] # lower and upper bound 78 | } 79 | 80 | #### : PSO-ELM 81 | pso_elm_paras_final = { 82 | "sliding": [2, 3, 5], 83 | "hidden_size": [(5, False) ], 84 | "activation": ["elu"], # 0: elu, 1:relu, 2:tanh, 3:sigmoid 85 | "train_valid_rate": [(0.6, 0.4)], 86 | 87 | "epoch": [100], 88 | "pop_size": [20], # 100 -> 900 89 | "w_minmax": [(0.4, 0.9)], # [0-1] -> [0.4-0.9] Trong luong cua con chim 90 | "c_minmax": [(1.2, 1.2)], # [(1.2, 1.2), (0.8, 2.0), (1.6, 0.6)] # [0-2] Muc do anh huong cua local va global 91 | # r1, r2 : random theo tung vong lap 92 | # delta(t) = 1 (do do: x(sau) = x(truoc) + van_toc 93 | "domain_range": [(-1, 1)] # lower and upper bound 94 | } 95 | 96 | #### : ABFOLS-ELM 97 | abfols_elm_paras_final = { 98 | "sliding": [2, 3, 5], 99 | "hidden_size": [(5, False)], 100 | "activation": ["elu"], # 0: elu, 1:relu, 2:tanh, 3:sigmoid 101 | "train_valid_rate": [(0.6, 0.4)], 102 | 103 | "epoch": [100], 104 | "pop_size": [20], # 100 -> 900 105 | "Ci": [(0.1, 0.00001)], # C_s (start), C_e (end) -=> step size # step size in BFO 106 | "Ped": [0.25], # p_eliminate 107 | "Ns": [4], # swim_length 108 | "N_minmax": [(3, 40)], # (Dead threshold value, split threshold value) -> N_adapt, N_split 109 | 110 | "domain_range": [(-1, 1)] # lower and upper bound 111 | } 112 | 113 | #### : TWO-ELM, OppTWO-ELM, LevyTWO-ELM, ITWO-ELM 114 | two_elm_paras_final = { 115 | "sliding": [2, 3, 5], 116 | "hidden_size": [(5, False)], 117 | "activation": ["elu"], # 0: elu, 1:relu, 2:tanh, 3:sigmoid 118 | "train_valid_rate": [(0.6, 0.4)], 119 | 120 | "epoch": [100], 121 | "pop_size": [20], # 100 -> 900 122 | "domain_range": [(-1, 1)] # lower and upper bound 123 | } 124 | 125 | 126 | # ============================= Drafts ===================================================== 127 | 128 | ####: MLNN-1HL 129 | mlnn2hl_paras_final = { 130 | "sliding": [2, 3, 5], 131 | "hidden_sizes": [[5, 3, True]], 132 | "activations": [("elu", "elu", "elu")], # 0: elu, 1:relu, 2:tanh, 3:sigmoid 133 | "learning_rate": [0.0001], 134 | "epoch": [2000], 135 | "batch_size": [128], 136 | "optimizer": ["adam"], # GradientDescentOptimizer, AdamOptimizer, AdagradOptimizer, AdadeltaOptimizer 137 | "loss": ["mse"] 138 | } 139 | 140 | ####: RNN-1HL 141 | rnn1hl_paras_final = { 142 | "sliding": [2, 3, 5], 143 | "hidden_sizes": [[5, True]], 144 | "activations": [("elu", "elu")], # 0: elu, 1:relu, 2:tanh, 3:sigmoid 145 | "learning_rate": [0.0001], 146 | "epoch": [1000], 147 | "batch_size": [128], 148 | "optimizer": ["adam"], # GradientDescentOptimizer, AdamOptimizer, AdagradOptimizer, AdadeltaOptimizer 149 | "loss": ["mse"], 150 | "dropouts": [[0.2]] 151 | } 152 | 153 | #### : BFO-ELM 154 | bfo_elm_paras_final = { 155 | "sliding": [2, 3, 5], 156 | "hidden_size": [(5, False)], 157 | "activation": [0], # 0: elu, 1:relu, 2:tanh, 3:sigmoid 158 | "train_valid_rate": [(0.6, 0.4)], 159 | 160 | "pop_size": [20], # 100 -> 900 161 | "Ci": [0.05], # step_size 162 | "Ped": [0.25], # p_eliminate 163 | "Ns": [4], # swim_length 164 | "Ned": [5], # elim_disp_steps 165 | "Nre": [2], # repro_steps 166 | "Nc": [10], # chem_steps 167 | "attract_repel": [(0.1, 0.2, 0.1, 10)], # [ d_attr, w_attr, h_repel, w_repel ] 168 | 169 | "domain_range": [(-1, 1)] # lower and upper bound 170 | } 171 | 172 | #### : QSO-ELM, OQSO-ELM, LQSO-ELM, IQSO-ELM 173 | qso_elm_paras_final = { 174 | "sliding": [2, 3, 5], 175 | "hidden_size": [(5, False)], 176 | "activation": [0], # 0: elu, 1:relu, 2:tanh, 3:sigmoid 177 | "train_valid_rate": [(0.6, 0.4)], 178 | 179 | "epoch": [100], 180 | "pop_size": [20], # 100 -> 900 181 | "domain_range": [(-1, 1)] # lower and upper bound 182 | } 183 | --------------------------------------------------------------------------------