Skip to content

Commit

Permalink
update defaults & tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorstephens committed Aug 27, 2016
1 parent 445ed53 commit 65e0305
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions gplearn/genetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,10 +760,10 @@ class BaseSymbolic(six.with_metaclass(ABCMeta, BaseEstimator)):

@abstractmethod
def __init__(self,
population_size=500,
population_size=1000,
hall_of_fame=None,
n_components=None,
generations=10,
generations=20,
tournament_size=20,
stopping_criteria=0.0,
const_range=(-1., 1.),
Expand Down Expand Up @@ -1243,8 +1243,8 @@ class SymbolicRegressor(BaseSymbolic, RegressorMixin):
"""

def __init__(self,
population_size=500,
generations=10,
population_size=1000,
generations=20,
tournament_size=20,
stopping_criteria=0.0,
const_range=(-1., 1.),
Expand Down Expand Up @@ -1489,10 +1489,10 @@ class SymbolicTransformer(BaseSymbolic, TransformerMixin):
"""

def __init__(self,
population_size=500,
population_size=1000,
hall_of_fame=100,
n_components=10,
generations=10,
generations=20,
tournament_size=20,
stopping_criteria=1.0,
const_range=(-1., 1.),
Expand Down
14 changes: 7 additions & 7 deletions gplearn/tests/test_genetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,9 @@ def test_program_input_validation():
est.fit(boston.data, boston.target)

# Check hall_of_fame and n_components for transformer
est = SymbolicTransformer(hall_of_fame=1000)
est = SymbolicTransformer(hall_of_fame=2000)
assert_raises(ValueError, est.fit, boston.data, boston.target)
est = SymbolicTransformer(n_components=1000)
est = SymbolicTransformer(n_components=2000)
assert_raises(ValueError, est.fit, boston.data, boston.target)
est = SymbolicTransformer(hall_of_fame=0)
assert_raises(ValueError, est.fit, boston.data, boston.target)
Expand Down Expand Up @@ -579,7 +579,7 @@ def test_verbose_output():
assert_equal(true_header, header3)

n_lines = sum(1 for l in verbose_output.readlines())
assert_equal(10, n_lines)
assert_equal(20, n_lines)


def test_verbose_with_oob():
Expand All @@ -599,7 +599,7 @@ def test_verbose_with_oob():
header3 = verbose_output.readline().rstrip()

n_lines = sum(1 for l in verbose_output.readlines())
assert_equal(10, n_lines)
assert_equal(20, n_lines)


def test_more_verbose_output():
Expand All @@ -623,7 +623,7 @@ def test_more_verbose_output():
header3 = verbose_output.readline().rstrip()

n_lines = sum(1 for l in verbose_output.readlines())
assert_equal(10, n_lines)
assert_equal(20, n_lines)

joblib_output.seek(0)
n_lines = sum(1 for l in joblib_output.readlines())
Expand Down Expand Up @@ -801,8 +801,8 @@ def test_transformer_iterable():
y = random_state.uniform(size=5)
function_set = ['add', 'sub', 'mul', 'div', 'sqrt', 'log', 'abs', 'neg',
'inv', 'max', 'min']
est = SymbolicTransformer(generations=2, function_set=function_set,
random_state=0)
est = SymbolicTransformer(population_size=500, generations=2,
function_set=function_set, random_state=0)

# Check unfitted
unfitted_len = len(est)
Expand Down

0 comments on commit 65e0305

Please sign in to comment.