(work_mode: str, k=1, tree_num=10, host_list=None, complete_secure=True)
return tree_plan
Args:
        work_mode:
        k: k is needed when work_mode is 'layered'
        tree_num: decision tree number
        host_list: need to specify host idx when under multi-host scenario, default is None
        complete_secure:
    Returns: tree plan: (work mode, host id) host id -1 is default value
Args:
        work_mode:
        k: k is needed when work_mode is 'layered'
        tree_num: decision tree number
        host_list: need to specify host idx when under multi-host scenario, default is None
        complete_secure:
    Returns: tree plan: (work mode, host id) host id -1 is default value
Args : work_mode : k : k is needed when work_mode is layered tree_num : decision tree number host_list : need to specify host idx when under multi - host scenario default is None complete_secure : Returns : tree plan : ( work mode host id ) host id - 1 is default value
def create_tree_plan(work_mode: str, k=1, tree_num=10, host_list=None, complete_secure=True):

    """
    Args:
        work_mode:
        k: k is needed when work_mode is 'layered'
        tree_num: decision tree number
        host_list: need to specify host idx when under multi-host scenario, default is None
        complete_secure:
    Returns: tree plan: (work mode, host id) host id -1 is default value
    """

    LOGGER.info('boosting_core trees work mode is {}'.format(work_mode))
    tree_plan = []

    if work_mode == consts.MIX_TREE:
        assert k > 0
        assert len(host_list) > 0

        one_round = [(tree_type_dict['guest_feat_only'], -1)] * k
        for host_idx, host_id in enumerate(host_list):
            one_round += [(tree_type_dict['host_feat_only'], host_id)] * k

        round_num = (tree_num // (2*k)) + 1
        tree_plan = (one_round * round_num)[0:tree_num]

    elif work_mode == consts.LAYERED_TREE:
        tree_plan = [(tree_type_dict['layered_tree'], -1) for i in range(tree_num)]
        if complete_secure:
            tree_plan[0] = (tree_type_dict['guest_feat_only'], -1)

    return tree_plan
def create_tree_plan ( work_mode : str , k = 1 , tree_num = 10 , host_list = None , complete_secure = True ) : LOGGER . info ( 'boosting_core trees work mode is {}' . format ( work_mode ) ) tree_plan = [ ] if work_mode == consts . MIX_TREE : assert k > 0 assert len ( host_list ) > 0 one_round = [ ( tree_type_dict [ 'guest_feat_only' ] , - 1 ) ] * k for host_idx , host_id in enumerate ( host_list ) : one_round += [ ( tree_type_dict [ 'host_feat_only' ] , host_id ) ] * k round_num = ( tree_num // ( 2 * k ) ) + 1 tree_plan = ( one_round * round_num ) [ 0 : tree_num ] elif work_mode == consts . LAYERED_TREE : tree_plan = [ ( tree_type_dict [ 'layered_tree' ] , - 1 ) for i in range ( tree_num ) ] if complete_secure : tree_plan [ 0 ] = ( tree_type_dict [ 'guest_feat_only' ] , - 1 ) return tree_plan