Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_split_model_IDs():
delete_model(model1)
delete_model(model2)
connect_model_IDs(model1, model2)
split_model_IDs(model1, model2)
c_time = time.time()
opt = Hyperactive(X, y, memory="long")
opt.search(search_config1, n_iter=1000)
diff_time_0 = time.time() - c_time
c_time = time.time()
opt = Hyperactive(X, y, memory="long")
opt.search(search_config2, n_iter=1000)
diff_time_1 = time.time() - c_time
assert diff_time_0 / 2 < diff_time_1
def test_connect_model_IDs():
delete_model(model1)
delete_model(model2)
connect_model_IDs(model1, model2)
c_time = time.time()
opt = Hyperactive(X, y, memory="long")
opt.search(search_config1, n_iter=1000)
diff_time_0 = time.time() - c_time
c_time = time.time()
opt = Hyperactive(X, y, memory="long")
opt.search(search_config2, n_iter=1000)
diff_time_1 = time.time() - c_time
assert diff_time_0 / 2 > diff_time_1
def test_connect_model_IDs():
delete_model(model1)
delete_model(model2)
connect_model_IDs(model1, model2)
c_time = time.time()
opt = Hyperactive(X, y, memory="long")
opt.search(search_config1, n_iter=1000)
diff_time_0 = time.time() - c_time
c_time = time.time()
opt = Hyperactive(X, y, memory="long")
opt.search(search_config2, n_iter=1000)
diff_time_1 = time.time() - c_time
assert diff_time_0 / 2 > diff_time_1
def test_delete_model():
delete_model(model)
opt = Hyperactive(X, y, memory="long")
opt.search(search_config)
delete_model(model)
def test_split_model_IDs():
delete_model(model1)
delete_model(model2)
connect_model_IDs(model1, model2)
split_model_IDs(model1, model2)
c_time = time.time()
opt = Hyperactive(X, y, memory="long")
opt.search(search_config1, n_iter=1000)
diff_time_0 = time.time() - c_time
c_time = time.time()
opt = Hyperactive(X, y, memory="long")
opt.search(search_config2, n_iter=1000)
diff_time_1 = time.time() - c_time
def test_long_term_memory_times():
def _model_(para, X_train, y_train):
model = DecisionTreeClassifier(max_depth=para["max_depth"])
scores = cross_val_score(model, X_train, y_train, cv=2)
return scores.mean()
search_config = {_model_: {"max_depth": range(2, 500)}}
delete_model(_model_)
c_time = time.time()
opt = Hyperactive(X, y, memory="long")
opt.search(search_config, n_iter=1000)
diff_time_0 = time.time() - c_time
c_time = time.time()
opt = Hyperactive(X, y, memory="long")
opt.search(search_config, n_iter=1000)
diff_time_1 = time.time() - c_time
assert diff_time_0 / 2 > diff_time_1