(self, label_index, unlabel_index, oracle=None, cost=None, budget=40, **kwargs)
return [tuple(i) for i in list(instance_pair)]
Randomly selects a batch of instance-label pairs under the 
        constraints of meeting the budget conditions.

        Parameters
        ----------
        label_index: ignore
            
        unlabel_index: {list, np.ndarray, MultiLabelIndexCollection}
            The indexes of unlabeled samples. It should be a 1d array of indexes (column major, start from 0) or
            MultiLabelIndexCollection or a list of tuples with 2 elements, in which,
            the 1st element is the index of instance and the 2nd element is the index of labels.

        oracle: Oracle,(default=None)
            Oracle indicate the cost for each label.
            Oracle in active learning whose role is to label the given query.And it can also give the cost of 
            each corresponding label.The Oracle includes the label and cost information at least.
            Oracle(labels=labels, cost=cost)

        cost: np.array, (default=None), shape [1, n_classes] or [n_classes]
            The costs of querying each class.if not provide,it will all be 1. 

        budget: int, optional (default=40)
            The budget of the select cost.If cost for eatch labels is 1,will degenerate into the batch_size.

        Returns
        -------
        selected_ins_lab_pair: MultiLabelIndexCollection
            The selected instance label pair.
Randomly selects a batch of instance-label pairs under the 
        constraints of meeting the budget conditions.
Randomly selects a batch of instance - label pairs under the constraints of meeting the budget conditions .
def select(self, label_index, unlabel_index, oracle=None, cost=None, budget=40, **kwargs):
        """Randomly selects a batch of instance-label pairs under the 
        constraints of meeting the budget conditions.

        Parameters
        ----------
        label_index: ignore
            
        unlabel_index: {list, np.ndarray, MultiLabelIndexCollection}
            The indexes of unlabeled samples. It should be a 1d array of indexes (column major, start from 0) or
            MultiLabelIndexCollection or a list of tuples with 2 elements, in which,
            the 1st element is the index of instance and the 2nd element is the index of labels.

        oracle: Oracle,(default=None)
            Oracle indicate the cost for each label.
            Oracle in active learning whose role is to label the given query.And it can also give the cost of 
            each corresponding label.The Oracle includes the label and cost information at least.
            Oracle(labels=labels, cost=cost)

        cost: np.array, (default=None), shape [1, n_classes] or [n_classes]
            The costs of querying each class.if not provide,it will all be 1. 

        budget: int, optional (default=40)
            The budget of the select cost.If cost for eatch labels is 1,will degenerate into the batch_size.

        Returns
        -------
        selected_ins_lab_pair: MultiLabelIndexCollection
            The selected instance label pair.    
        """
        unlabel_index = self._check_multi_label_ind(unlabel_index)
        n_classes = unlabel_index._label_size

        if cost is not None:
            cost = np.asarray(cost).flatten()
            assert(len(cost) == n_classes)

        if oracle is None and cost is None:
            cost = [1]*n_classes
        if oracle:
            _, costs = oracle.query_by_index(range(n_classes))
        else:
            costs = cost

        instance_pair = MultiLabelIndexCollection(label_size=n_classes)
        un_ind = copy.deepcopy(unlabel_index)
        current_cost = 0.
        while True:
            rand = np.random.choice(len(un_ind))
            i_j = flattern_multilabel_index(un_ind.index)[rand]
            j_class = i_j[1]
            current_cost += costs[j_class]
            if current_cost > budget:
                break
            instance_pair.update(i_j)
            un_ind.difference_update(i_j)
        # return instance_pair
        return [tuple(i) for i in list(instance_pair)]
def select ( self , label_index , unlabel_index , oracle = None , cost = None , budget = 40 , * * kwargs ) : unlabel_index = self . _check_multi_label_ind ( unlabel_index ) n_classes = unlabel_index . _label_size if cost is not None : cost = np . asarray ( cost ) . flatten ( ) assert ( len ( cost ) == n_classes ) if oracle is None and cost is None : cost = [ 1 ] * n_classes if oracle : _ , costs = oracle . query_by_index ( range ( n_classes ) ) else : costs = cost instance_pair = MultiLabelIndexCollection ( label_size = n_classes ) un_ind = copy . deepcopy ( unlabel_index ) current_cost = 0. while True : rand = np . random . choice ( len ( un_ind ) ) i_j = flattern_multilabel_index ( un_ind . index ) [ rand ] j_class = i_j [ 1 ] current_cost += costs [ j_class ] if current_cost > budget : break instance_pair . update ( i_j ) un_ind . difference_update ( i_j ) # return instance_pair return [ tuple ( i ) for i in list ( instance_pair ) ]