def test_HillClimbingOptimizer(): from hyperactive import HillClimbingOptimizer opt0 = HillClimbingOptimizer( search_config, n_iter_0, random_state=random_state, verbosity=1, cv=cv, n_jobs=1, warm_start=warm_start, ) opt0.fit(X, y) opt1 = HillClimbingOptimizer( search_config, n_iter_1, random_state=random_state, verbosity=1, cv=cv, n_jobs=n_jobs, warm_start=warm_start, ) opt1.fit(X, y) assert opt0.score_best < opt1.score_best
def test_keras(): from hyperactive import HillClimbingOptimizer opt = HillClimbingOptimizer(search_config, 1) opt.fit(X, y) opt.predict(X) opt.score(X, y)
def test_keras_warm_start(): from hyperactive import HillClimbingOptimizer warm_start = { "keras.compile.0": { "loss": ["binary_crossentropy"], "optimizer": ["adam"] }, "keras.fit.0": { "epochs": [1], "batch_size": [300], "verbose": [0] }, "keras.layers.Dense.1": { "units": [1], "activation": ["softmax"] }, } warm_start_list = [None, warm_start] for warm_start in warm_start_list: opt = HillClimbingOptimizer(search_config, 1, warm_start=warm_start) opt.fit(X, y) opt.predict(X) opt.score(X, y)
def test_keras_n_jobs(): from hyperactive import HillClimbingOptimizer n_jobs_list = [1, 2] for n_jobs in n_jobs_list: opt = HillClimbingOptimizer(search_config, 1, n_jobs=n_jobs) opt.fit(X, y) opt.predict(X) opt.score(X, y)
def test_keras_memory(): from hyperactive import HillClimbingOptimizer memory_list = [False, True] for memory in memory_list: opt = HillClimbingOptimizer(search_config, 1, memory=memory) opt.fit(X, y) opt.predict(X) opt.score(X, y)
def test_keras_verbosity(): from hyperactive import HillClimbingOptimizer verbosity_list = [0, 1] for verbosity in verbosity_list: opt = HillClimbingOptimizer(search_config, 1, verbosity=verbosity) opt.fit(X, y) opt.predict(X) opt.score(X, y)
def test_keras_cv(): from hyperactive import HillClimbingOptimizer cv_list = [0.1, 0.5, 0.9, 2] for cv in cv_list: opt = HillClimbingOptimizer(search_config, 1, cv=cv) opt.fit(X, y) opt.predict(X) opt.score(X, y)
def test_keras_n_iter(): from hyperactive import HillClimbingOptimizer n_iter_list = [0, 1, 2] for n_iter in n_iter_list: opt = HillClimbingOptimizer(search_config, n_iter) opt.fit(X, y) opt.predict(X) opt.score(X, y)
def test_keras_scatter_init(): from hyperactive import HillClimbingOptimizer scatter_init_list = [False, 2] for scatter_init in scatter_init_list: opt = HillClimbingOptimizer(search_config, 1, scatter_init=scatter_init) opt.fit(X, y) opt.predict(X) opt.score(X, y)
def test_keras_random_state(): from hyperactive import HillClimbingOptimizer random_state_list = [None, 0, 1] for random_state in random_state_list: opt = HillClimbingOptimizer(search_config, 1, random_state=random_state) opt.fit(X, y) opt.predict(X) opt.score(X, y)
def test_data(): from hyperactive import HillClimbingOptimizer opt0 = HillClimbingOptimizer( search_config, n_iter_0, random_state=random_state, verbosity=0, cv=cv, n_jobs=1 ) opt0.fit(X_np, y_np) opt1 = HillClimbingOptimizer( search_config, n_iter_0, random_state=random_state, verbosity=0, cv=cv, n_jobs=1 ) opt1.fit(X_pd, y_pd)
def test_HillClimbingOptimizer_args(): from hyperactive import HillClimbingOptimizer opt = HillClimbingOptimizer(search_config, 3, eps=2) opt.fit(X, y)