вы можете использовать itertools.combinations
и itertools.product
:
from itertools import product, combinations
from itertools import chain
models = set(chain.from_iterable((v.values() for v in Estimators.values())))
result = []
for i in range(2, len(models) + 1):
for n in combinations(models, i):
result.extend(list(product(*n)))
result
выход:
[(1, 'x'),
(1, 'y'),
(2, 'x'),
(2, 'y'),
(1, 'a'),
(1, 'b'),
(2, 'a'),
(2, 'b'),
('x', 'a'),
('x', 'b'),
('y', 'a'),
('y', 'b'),
(1, 'x', 'a'),
(1, 'x', 'b'),
(1, 'y', 'a'),
(1, 'y', 'b'),
(2, 'x', 'a'),
(2, 'x', 'b'),
(2, 'y', 'a'),
(2, 'y', 'b')]