Skip to content

Commit

Permalink
Merge 253c6f5 into 985784f
Browse files Browse the repository at this point in the history
  • Loading branch information
mgraffg committed Dec 19, 2020
2 parents 985784f + 253c6f5 commit 343b041
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion EvoDAG/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@

from .base import EvoDAG, RGP, RootGP
__all__ = ["EvoDAG", "RGP", "RootGP"]
__version__ = '0.16.4'
__version__ = '0.17.0'
8 changes: 8 additions & 0 deletions EvoDAG/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,15 @@ def fit(X_y_evodag):
except KeyError:
pass
try:
max_training_size = evodag.get("max_training_size", None)
evodag = EvoDAG(**evodag)
if max_training_size is not None:
X = np.atleast_2d(X)
y = np.atleast_1d(y)
index = np.arange(X.shape[0])
np.random.shuffle(index)
X = X[index[:max_training_size]]
y = y[index[:max_training_size]]
evodag.fit(X, y, test_set=test_set)
except RuntimeError:
return None
Expand Down
16 changes: 16 additions & 0 deletions EvoDAG/tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,3 +411,19 @@ def test_regression_multiple_outputs():
y = [SparseArray.fromlist(cl), SparseArray.fromlist(cl*-1), SparseArray.fromlist(cl*-1 + 0.5)]
m = EvoDAGE(time_limit=4, multiple_outputs=True, classifier=False).fit(X, y)
assert m


def test_max_training_size():
from EvoDAG.model import EvoDAGE
import time
local = time.time()
try:
EvoDAGE(n_estimators=30, n_jobs=2, time_limit=4,
max_training_size="hola").fit(X, cl)
except TypeError:
default_nargs()
t = time.time() - local
print(t)
assert t <= 6
return
assert False
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.16.4
0.17.0
2 changes: 1 addition & 1 deletion conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package:
name: evodag
version: "0.16.4"
version: "0.17.0"

requirements:
build:
Expand Down

0 comments on commit 343b041

Please sign in to comment.