def _seqcombination(cst, dyn, direction, grp):
"""Generate combi for forward/backward/exhaustive sequence.
cst : list containing the index of all the features
dyn : features to add or remove
direction : direction of the sequence
grp : group features
"""
if direction == 'forward':
combi = [cst + [y]
for y in dyn if not list(set(cst).intersection([y]))]
elif direction == 'backward':
combi = [list(set(cst).difference([x])) for x in dyn]
elif direction == 'exhaustive':
combi = [list(k) for i in range(1, len(cst)+1)
for k in combinations(cst, i)]
return [[j for i in k for j in grp['g'+str(i)]] for k in combi]
评论列表
文章目录