(data_bin_with_table, sparse_bin_points)
return list(result_sum.items())
Add all label, so that become convenient to calculate woe and iv

        Parameters
        ----------
        data_bin_with_table : Table
            The input data, the Table is like:
            (id, {'x1': 1, 'x2': 5, 'x3': 2}, y)
            where y = [is_label_0, is_label_1, ...]  which is one-hot format array of label

        sparse_bin_points: dict
            Dict of sparse bin num
                {0: 2, 1: 3, 2:5 ... }

        Returns
        -------
            ['x1', [[label_0_sum, label_1_sum, ...], [label_0_sum, label_1_sum, ...] ... ],
             'x2', [[label_0_sum, label_1_sum, ...], [label_0_sum, label_1_sum, ...] ... ],
             ...
            ]
Add all label, so that become convenient to calculate woe and iv
Add all label so that become convenient to calculate woe and iv
def add_label_in_partition(data_bin_with_table, sparse_bin_points):
        """
        Add all label, so that become convenient to calculate woe and iv

        Parameters
        ----------
        data_bin_with_table : Table
            The input data, the Table is like:
            (id, {'x1': 1, 'x2': 5, 'x3': 2}, y)
            where y = [is_label_0, is_label_1, ...]  which is one-hot format array of label

        sparse_bin_points: dict
            Dict of sparse bin num
                {0: 2, 1: 3, 2:5 ... }

        Returns
        -------
            ['x1', [[label_0_sum, label_1_sum, ...], [label_0_sum, label_1_sum, ...] ... ],
             'x2', [[label_0_sum, label_1_sum, ...], [label_0_sum, label_1_sum, ...] ... ],
             ...
            ]

        """
        result_sum = {}
        for _, datas in data_bin_with_table:
            bin_idx_dict = datas[0]
            y = datas[1]
            for col_name, bin_idx in bin_idx_dict.items():
                result_sum.setdefault(col_name, [])
                col_sum = result_sum[col_name]
                while bin_idx >= len(col_sum):
                    if isinstance(y, PackingCipherTensor):
                        zero_y = np.zeros(y.dim)
                        col_sum.append(PackingCipherTensor(zero_y.tolist()))
                    else:
                        col_sum.append(np.zeros(len(y)))

                # if bin_idx == sparse_bin_points[col_name]:
                #     continue
                col_sum[bin_idx] = col_sum[bin_idx] + y
        return list(result_sum.items())
def add_label_in_partition ( data_bin_with_table , sparse_bin_points ) : result_sum = { } for _ , datas in data_bin_with_table : bin_idx_dict = datas [ 0 ] y = datas [ 1 ] for col_name , bin_idx in bin_idx_dict . items ( ) : result_sum . setdefault ( col_name , [ ] ) col_sum = result_sum [ col_name ] while bin_idx >= len ( col_sum ) : if isinstance ( y , PackingCipherTensor ) : zero_y = np . zeros ( y . dim ) col_sum . append ( PackingCipherTensor ( zero_y . tolist ( ) ) ) else : col_sum . append ( np . zeros ( len ( y ) ) ) # if bin_idx == sparse_bin_points[col_name]: #     continue col_sum [ bin_idx ] = col_sum [ bin_idx ] + y return list ( result_sum . items ( ) )