Commit 5e687062 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[experiment] Improve loop algorithms crosschecking

The current technique use had a flaw. With algorithm containing
a different number of groups, it would truncate the to the shortest
as explained in the zip function documentation.

Now itertools.zip_longest is used to ensure that the iteration is
done on the longest input.
parent 4f8d705f
Pipeline #33259 canceled with stage
in 73 minutes and 51 seconds
......@@ -44,6 +44,7 @@ Validation for experiments
import os
import collections
import itertools
import simplejson as json
from . import utils
......@@ -977,15 +978,21 @@ class Experiment(object):
groups_count = [
len(algo_groups["inputs"]) + len(evaluator_algo_groups["inputs"]),
len(algo_groups["outputs"]) + len(evaluator_algo_groups["outputs"]),
for algo_groups, evaluator_algo_groups in zip(
algo_groups_list, evaluator_algo_groups_list
groups_count = []
for algo_groups, evaluator_algo_groups in itertools.zip_longest(
algo_groups_list, evaluator_algo_groups_list
inputs = 0
outputs = 0
if algo_groups:
inputs = len(algo_groups["inputs"])
outputs = len(algo_groups.get("outputs", []))
if evaluator_algo_groups:
inputs += len(evaluator_algo_groups["inputs"])
outputs += len(evaluator_algo_groups.get("outputs", []))
groups_count.append((inputs, outputs))
if collections.Counter(chain_groups_count) != collections.Counter(
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment