Skip to content

Commit 82eadb5

Browse files
authored
Reduce max_trials in Python tests (#206)
1 parent cec0120 commit 82eadb5

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Changes:
55
* Add `clean` parameter to wipe existing population to `json_read` ([#202](https://github.com/xcsf-dev/xcsf/pull/202))
66
* Add Ruff linting and formatting for Python ([#196](https://github.com/xcsf-dev/xcsf/pull/196))
77
* Fix Python `json_read` crashing when the new population is empty ([#205](https://github.com/xcsf-dev/xcsf/pull/205))
8+
* Reduce `max_trials` in Python tests for speed
89

910
## Version 1.4.7 (Aug 19, 2024)
1011

test/python/test_xcsf.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def test_deterministic_prediction(data, prediction):
139139
y_dim=data.y_dim,
140140
n_actions=1,
141141
pop_size=200,
142-
max_trials=1000,
142+
max_trials=100,
143143
random_state=SEED,
144144
prediction=prediction,
145145
)
@@ -329,7 +329,7 @@ def _test_pop_replace(
329329
X = np.random.random((n, dx))
330330
y = np.random.randn(n, 1)
331331

332-
xcs = xcsf.XCS(x_dim=dx, pop_size=5, max_trials=1000, pop_init=pop_init)
332+
xcs = xcsf.XCS(x_dim=dx, pop_size=5, max_trials=100, pop_init=pop_init)
333333
xcs.fit(X, y, verbose=False)
334334

335335
# Initial, “too large” population.
@@ -388,7 +388,7 @@ def test_pop_replace(
388388
def test_pop_replace_empty(tmp_path):
389389
# Init'ing the pop and overwriting it with an empty one using the clean
390390
# option should result in an empty pop.
391-
xcs = xcsf.XCS(pop_size=100, max_trials=1000, pop_init=True)
391+
xcs = xcsf.XCS(pop_size=100, max_trials=100, pop_init=True)
392392

393393
assert xcs.pset_size() == 100
394394

@@ -401,7 +401,7 @@ def test_pop_replace_empty(tmp_path):
401401

402402
# Not init'ing the pop and overwriting it with an empty one using the clean
403403
# option should keep the pop empty.
404-
xcs = xcsf.XCS(pop_size=100, max_trials=1000, pop_init=False)
404+
xcs = xcsf.XCS(pop_size=100, max_trials=100, pop_init=False)
405405

406406
assert xcs.pset_size() == 0
407407

@@ -414,7 +414,7 @@ def test_pop_replace_empty(tmp_path):
414414

415415
# Init'ing the pop and overwriting it with an empty one but without using
416416
# the clean option should not empty the pop.
417-
xcs = xcsf.XCS(pop_size=100, max_trials=1000, pop_init=True)
417+
xcs = xcsf.XCS(pop_size=100, max_trials=100, pop_init=True)
418418

419419
assert xcs.pset_size() == 100
420420

0 commit comments

Comments
 (0)