def test_process_params(): from EvoDAG.utils import RandomParameterSearch from EvoDAG import EvoDAG rs = RandomParameterSearch(npoints=1) args = [x for x in rs][0] evo = EvoDAG(**rs.process_params(args)) params = evo.get_params() for k, v in args.items(): if k in params: print(v, params[k]) if hasattr(params[k], '__name__'): assert v == params[k].__name__ else: assert v == params[k]
def test_HGeneration_pr_variable(): import json from EvoDAG.utils import RandomParameterSearch from EvoDAG import EvoDAG get_remote_data() params = json.loads(open('evodag.params').read()) params['population_class'] = 'HGenerational' params['pr_variable'] = 1.0 kw = RandomParameterSearch.process_params(params) y = cl.copy() try: EvoDAG(**kw).fit(X, y) except AssertionError: return assert False
def test_HGeneration(): import json import gzip import pickle from EvoDAG.utils import RandomParameterSearch from EvoDAG import EvoDAG get_remote_data() params = json.loads(open('evodag.params').read()) try: with gzip.open('train.sp') as fpt: X = pickle.load(fpt) y = pickle.load(fpt) except ValueError: return params['population_class'] = 'HGenerational' kw = RandomParameterSearch.process_params(params) gp = EvoDAG(**kw).fit(X, y) assert gp
def test_process_params(): from EvoDAG.utils import RandomParameterSearch from EvoDAG import EvoDAG rs = RandomParameterSearch(npoints=1) args = [x for x in rs][0] evo = EvoDAG(**rs.process_params(args)) params = evo.get_params() for k, v in args.items(): if k in params: if k == 'generations': v = np.inf print(k, v, params[k]) if isinstance(v, list): for a, b in zip(v, params[k]): assert a == b.__name__ elif hasattr(params[k], '__name__'): assert v == params[k].__name__ else: assert v == params[k]