Skip to content

Commit 4e1b5da

Browse files
committed
Fix to get Test and Train Fitness for final solution of Mult-objective Optimization. Fixes PonyGE#166
1 parent f337171 commit 4e1b5da

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/stats/stats.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def get_moo_stats(individuals, end):
240240
stdout.flush()
241241

242242
# Generate test fitness on regression problems
243-
if hasattr(params['FITNESS_FUNCTION'], "training_test") and end:
243+
if params["DATASET_TEST"] and end:
244244

245245
for ind in trackers.best_ever:
246246
# Iterate over all individuals in the first front.
@@ -249,7 +249,10 @@ def get_moo_stats(individuals, end):
249249
ind.training_fitness = copy(ind.fitness)
250250

251251
# Evaluate test fitness.
252-
ind.test_fitness = params['FITNESS_FUNCTION'](ind, dist='test')
252+
ind.test_fitness = [
253+
func(ind, dist="test")
254+
for func in params["FITNESS_FUNCTION"].fitness_functions
255+
]
253256

254257
# Set main fitness as training fitness.
255258
ind.fitness = ind.training_fitness

0 commit comments

Comments
 (0)