(self, label_index, unlabel_index)
return unlabel_index[ask_id]
Select one unlabel-sample at a time.
        Parameters
        ----------
        label_index: {list, np.ndarray, IndexCollection}
            The indexes of labeled 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.

        unlabel_index: {list, np.ndarray, IndexCollection}
            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.
        Returns
        -------
        selected_ind: int
            The selected index.
Select one unlabel-sample at a time.
        Parameters
        ----------
        label_index: {list, np.ndarray, IndexCollection}
            The indexes of labeled 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.
Select one unlabel - sample at a time . Parameters ---------- label_index : { list np . ndarray IndexCollection } The indexes of labeled 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 .
def sequential_select(self, label_index, unlabel_index):
        """
            Select one unlabel-sample at a time.
        Parameters
        ----------
        label_index: {list, np.ndarray, IndexCollection}
            The indexes of labeled 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.

        unlabel_index: {list, np.ndarray, IndexCollection}
            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.
        Returns
        -------
        selected_ind: int
            The selected index.
        """
        if isinstance(label_index, (list, np.ndarray)):
            label_index = IndexCollection(label_index)
        elif isinstance(label_index, MultiLabelIndexCollection):
            label_index = IndexCollection(label_index.get_unbroken_instances())
        elif not isinstance(label_index,IndexCollection):
            raise TypeError("index type error")
        if isinstance(unlabel_index, (list, np.ndarray)):
            unlabel_index = IndexCollection(unlabel_index)
        elif isinstance(unlabel_index, MultiLabelIndexCollection):
            unlabel_index = IndexCollection(unlabel_index.get_unbroken_instances())
        elif not isinstance(unlabel_index,IndexCollection):
            raise TypeError("index type error")
        
        if len(unlabel_index) <= 1:
            return list(unlabel_index)

        labeled_pool = self.X[label_index]
        X_pool = self.X[unlabel_index]

        br = _BinaryRelevance(self.br_base)
        br.train(self.X[label_index], self.y[label_index])

        trnf = br.predict_proba(labeled_pool)
        poolf = br.predict_proba(X_pool)
        f = poolf * 2 - 1

        trnf = np.sort(trnf, axis=1)[:, ::-1]
        trnf /= np.tile(trnf.sum(axis=1).reshape(-1, 1), (1, trnf.shape[1]))
        if len(np.unique(self.y.sum(axis=1))) == 1:
            lr = DummyClf()
        else:
            lr = self.logistic_regression_
        lr.fit(trnf, self.y[label_index].sum(axis=1))

        idx_poolf = np.argsort(poolf, axis=1)[:, ::-1]
        poolf = np.sort(poolf, axis=1)[:, ::-1]
        poolf /= np.tile(poolf.sum(axis=1).reshape(-1, 1), (1, poolf.shape[1]))
        pred_num_lbl = lr.predict(poolf).astype(int)

        yhat = -1 * np.ones((len(X_pool), self.n_labels), dtype=int)
        for i, p in enumerate(pred_num_lbl):
            yhat[i, idx_poolf[i, :p]] = 1

        score = ((1 - yhat * f) / 2).sum(axis=1)
        ask_id = self.random_state_.choice(np.where(score == np.max(score))[0])

        return unlabel_index[ask_id]
def sequential_select ( self , label_index , unlabel_index ) : if isinstance ( label_index , ( list , np . ndarray ) ) : label_index = IndexCollection ( label_index ) elif isinstance ( label_index , MultiLabelIndexCollection ) : label_index = IndexCollection ( label_index . get_unbroken_instances ( ) ) elif not isinstance ( label_index , IndexCollection ) : raise TypeError ( "index type error" ) if isinstance ( unlabel_index , ( list , np . ndarray ) ) : unlabel_index = IndexCollection ( unlabel_index ) elif isinstance ( unlabel_index , MultiLabelIndexCollection ) : unlabel_index = IndexCollection ( unlabel_index . get_unbroken_instances ( ) ) elif not isinstance ( unlabel_index , IndexCollection ) : raise TypeError ( "index type error" ) if len ( unlabel_index ) <= 1 : return list ( unlabel_index ) labeled_pool = self . X [ label_index ] X_pool = self . X [ unlabel_index ] br = _BinaryRelevance ( self . br_base ) br . train ( self . X [ label_index ] , self . y [ label_index ] ) trnf = br . predict_proba ( labeled_pool ) poolf = br . predict_proba ( X_pool ) f = poolf * 2 - 1 trnf = np . sort ( trnf , axis = 1 ) [ : , : : - 1 ] trnf /= np . tile ( trnf . sum ( axis = 1 ) . reshape ( - 1 , 1 ) , ( 1 , trnf . shape [ 1 ] ) ) if len ( np . unique ( self . y . sum ( axis = 1 ) ) ) == 1 : lr = DummyClf ( ) else : lr = self . logistic_regression_ lr . fit ( trnf , self . y [ label_index ] . sum ( axis = 1 ) ) idx_poolf = np . argsort ( poolf , axis = 1 ) [ : , : : - 1 ] poolf = np . sort ( poolf , axis = 1 ) [ : , : : - 1 ] poolf /= np . tile ( poolf . sum ( axis = 1 ) . reshape ( - 1 , 1 ) , ( 1 , poolf . shape [ 1 ] ) ) pred_num_lbl = lr . predict ( poolf ) . astype ( int ) yhat = - 1 * np . ones ( ( len ( X_pool ) , self . n_labels ) , dtype = int ) for i , p in enumerate ( pred_num_lbl ) : yhat [ i , idx_poolf [ i , : p ] ] = 1 score = ( ( 1 - yhat * f ) / 2 ) . sum ( axis = 1 ) ask_id = self . random_state_ . choice ( np . where ( score == np . max ( score ) ) [ 0 ] ) return unlabel_index [ ask_id ]