_sequence.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:brainpipe 作者: EtienneCmb 项目源码 文件源码
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]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号