Esempio n. 1
0
def test_unique():
    from EvoDAG import RootGP
    mock = MagicMock(side_effect=RuntimeError('Mock'))
    ui = RootGP.unique_individual
    RootGP.unique_individual = mock
    gp = RootGP(generations=np.inf,
                tournament_size=2,
                unique_individuals=True,
                early_stopping_rounds=-1,
                seed=0,
                popsize=100)
    try:
        gp.fit(X, cl)
    except RuntimeError:
        pass
    RootGP.unique_individual = ui
Esempio n. 2
0
def test_unique():
    from EvoDAG import RootGP
    mock = MagicMock(side_effect=RuntimeError('Mock'))
    ui = RootGP.unique_individual
    RootGP.unique_individual = mock
    gp = RootGP(generations=np.inf,
                tournament_size=2,
                unique_individuals=True,
                multiple_outputs=True,
                early_stopping_rounds=-1,
                seed=0,
                popsize=100)
    try:
        gp.fit(X, cl)
    except RuntimeError:
        pass
    RootGP.unique_individual = ui
Esempio n. 3
0
def test_population_as_parameter():
    class Mock(object):
        def __init__(self, *args, **kwargs):
            raise RuntimeError('Mock')
    from EvoDAG import RootGP
    mock = Mock
    gp = RootGP(generations=np.inf,
                population_class=mock,
                tournament_size=2,
                unique_individuals=True,
                early_stopping_rounds=-1,
                seed=0,
                popsize=100)
    try:
        gp.fit(X, cl)
        assert False
    except RuntimeError:
        pass
Esempio n. 4
0
def test_population_as_parameter():
    class Mock(object):
        def __init__(self, *args, **kwargs):
            raise RuntimeError('Mock')
    from EvoDAG import RootGP
    mock = Mock
    gp = RootGP(generations=np.inf,
                population_class=mock,
                tournament_size=2,
                multiple_outputs=True,
                unique_individuals=True,
                early_stopping_rounds=-1,
                seed=0,
                popsize=100)
    try:
        gp.fit(X, cl)
        assert False
    except RuntimeError:
        pass