def test_29_load(self): global auto_lmgpip_regressor, auto_lmgpip_basic_regressor auto_lmgpip_regressor = AutoAdvanced( **auto_lmgpip_regressor_params).load() auto_lmgpip_basic_regressor = AutoBasic( **auto_lmgpip_regressor_params).load() self.assertIsInstance(auto_lmgpip_regressor, AutoAdvanced, "Load failed") self.assertIsInstance(auto_lmgpip_basic_regressor, AutoBasic, "Load failed")
def test_23_load(self): global auto_lmgpip_nn, auto_lmgpip_basic_nn auto_lmgpip_nn = AutoAdvanced(**auto_lmgpip_params).load() auto_lmgpip_basic_nn = AutoBasic(**auto_lmgpip_params).load() self.assertIsInstance(auto_lmgpip_nn, AutoAdvanced, "Load failed") self.assertIsInstance(auto_lmgpip_basic_nn, AutoBasic, "Load failed")
def test_11_load(self): global auto_mushroom_nn, auto_mushroom_basic_nn auto_mushroom_nn = AutoAdvanced(**auto_mushroom_params).load() auto_mushroom_basic_nn = AutoBasic(**auto_mushroom_params).load() self.assertIsInstance(auto_mushroom_nn, AutoAdvanced, "Load failed") self.assertIsInstance(auto_mushroom_basic_nn, AutoBasic, "Load failed")
def test_04_load(self): global nn, basic_nn nn = AutoAdvanced(**base_params).load() basic_nn = AutoBasic(**base_params).load() self.assertIsInstance(nn, AutoAdvanced, "Load failed") self.assertIsInstance(basic_nn, AutoBasic, "Load failed")
from Util.Util import DataUtil from _Dist.NeuralNetworks.b_TraditionalML.SVM import AutoLinearSVM from _Dist.NeuralNetworks.f_AutoNN.NN import AutoBasic, AutoAdvanced from _Dist.NeuralNetworks._Tests._UnitTests.UnitTestUtil import clear_cache base_params = { "name": "UnitTest", "data_info": {}, "model_param_settings": { "n_epoch": 1, "max_epoch": 2 } } nn = AutoAdvanced(**copy.deepcopy(base_params)) basic_nn = AutoBasic(**copy.deepcopy(base_params)) linear_svm = AutoLinearSVM(**copy.deepcopy(base_params)) train_set, cv_set, test_set = DataUtil.gen_special_linear(1000, 2, 2, 2, one_hot=False) auto_mushroom_params = copy.deepcopy(base_params) auto_mushroom_params["name"] = "mushroom" auto_mushroom_params["data_info"]["file_type"] = "txt" auto_mushroom_params["data_info"]["data_folder"] = "../_Data" mushroom_labels = {"p", "e"} mushroom_file = "../_Data/mushroom" auto_mushroom_nn = AutoAdvanced(**copy.deepcopy(auto_mushroom_params)) auto_mushroom_basic_nn = AutoBasic(**copy.deepcopy(auto_mushroom_params))
import os import sys root_path = os.path.abspath("../../../../") if root_path not in sys.path: sys.path.append(root_path) from _Dist.NeuralNetworks._Tests.TestUtil import draw_acc from _Dist.NeuralNetworks.f_AutoNN.NN import AutoBasic, AutoAdvanced from _Dist.NeuralNetworks._Tests.Madelon.MadelonUtil import get_madelon x, y, x_test, y_test = get_madelon() base_params = { "name": "Madelon", "model_param_settings": {"n_epoch": 200, "metric": "acc"}, "model_structure_settings": {"hidden_units": [152, 153]} } basic = AutoBasic(**base_params).fit(x, y, x_test, y_test, snapshot_ratio=0) advanced = AutoAdvanced(**base_params).fit(x, y, x_test, y_test, snapshot_ratio=0) draw_acc(basic, advanced, ylim=(0.5, 1.05))