コード例 #1
0
ファイル: test_root.py プロジェクト: mgraffg/EvoDAG
def test_fit_stopping_criteria_gens():
    from EvoDAG import RootGP
    from EvoDAG.node import Add
    Add.nargs = 2
    gp = RootGP(generations=2,
                early_stopping_rounds=None,
                tournament_size=2,
                seed=1,
                popsize=4)
    gp.X = X
    y = cl.copy()
    mask = y == 0
    y[mask] = 1
    y[~mask] = -1
    gp.y = y
    gp.create_population()
    for i in range(gp.popsize):
        assert not gp.stopping_criteria()
        a = gp.random_offspring()
        gp.population.replace(a)
    assert gp.stopping_criteria()
コード例 #2
0
ファイル: test_root.py プロジェクト: pombredanne/EvoDAG
def test_fit_stopping_criteria_gens():
    from EvoDAG import RootGP
    from EvoDAG.node import Add
    Add.nargs = 2
    gp = RootGP(generations=2,
                early_stopping_rounds=None,
                tournament_size=2,
                classifier=False,
                seed=1,
                popsize=4)
    gp.X = X
    y = cl.copy()
    mask = y == 0
    y[mask] = 1
    y[~mask] = -1
    gp.y = y
    gp.create_population()
    for i in range(gp.popsize):
        assert not gp.stopping_criteria()
        a = gp.random_offspring()
        gp.population.replace(a)
    assert gp.stopping_criteria()
コード例 #3
0
ファイル: test_root.py プロジェクト: mgraffg/EvoDAG
def test_fit_stopping_criteria_estopping():
    from EvoDAG import RootGP
    gp = RootGP(generations=np.inf,
                tournament_size=2,
                early_stopping_rounds=4,
                seed=0,
                popsize=4)
    gp.X = X
    y = cl.copy()
    mask = y == 0
    y[mask] = 1
    y[~mask] = -1
    gp.y = y
    gp.create_population()
    while not gp.stopping_criteria():
        a = gp.random_offspring()
        gp.population.replace(a)
    print(len(gp.population.hist) - gp.population.estopping.position)
    assert (len(gp.population.hist) - gp.population.estopping.position) <= 9
コード例 #4
0
ファイル: test_root.py プロジェクト: pombredanne/EvoDAG
def test_fit_stopping_criteria_estopping():
    from EvoDAG import RootGP
    gp = RootGP(generations=np.inf,
                tournament_size=2,
                early_stopping_rounds=4,
                classifier=False,
                seed=0,
                popsize=4)
    gp.X = X
    y = cl.copy()
    mask = y == 0
    y[mask] = 1
    y[~mask] = -1
    gp.y = y
    gp.create_population()
    while not gp.stopping_criteria():
        a = gp.random_offspring()
        gp.population.replace(a)
    print(len(gp.population.hist) - gp.population.estopping.position)
    assert (len(gp.population.hist) - gp.population.estopping.position) <= 9