(self, label_index, unlabel_index, model=None, batch_size=1, n_jobs=None)
return unlabel_index[nlargestarg(score, batch_size)]
Select indexes from the unlabel_index for querying.

        Parameters
        ----------
        label_index: {list, np.ndarray, IndexCollection}
            The indexes of labeled samples.

        unlabel_index: {list, np.ndarray, IndexCollection}
            The indexes of unlabeled samples.

        model: object, optional (default=None)
            Current classification model, should have the 'predict_proba' method for probabilistic output.
            If not provided, LogisticRegression with default parameters implemented by sklearn will be used.

        batch_size: int, optional (default=1)
            Selection batch size.

        n_jobs: int, optional (default=None)
            How many threads will be used in training bagging.

        Returns
        -------
        selected_idx: list
            The selected indexes which is a subset of unlabel_index.
Select indexes from the unlabel_index for querying.
Select indexes from the unlabel_index for querying .
def select(self, label_index, unlabel_index, model=None, batch_size=1, n_jobs=None):
        """Select indexes from the unlabel_index for querying.

        Parameters
        ----------
        label_index: {list, np.ndarray, IndexCollection}
            The indexes of labeled samples.

        unlabel_index: {list, np.ndarray, IndexCollection}
            The indexes of unlabeled samples.

        model: object, optional (default=None)
            Current classification model, should have the 'predict_proba' method for probabilistic output.
            If not provided, LogisticRegression with default parameters implemented by sklearn will be used.

        batch_size: int, optional (default=1)
            Selection batch size.

        n_jobs: int, optional (default=None)
            How many threads will be used in training bagging.

        Returns
        -------
        selected_idx: list
            The selected indexes which is a subset of unlabel_index.
        """
        assert (batch_size > 0)
        assert (isinstance(unlabel_index, collections.Iterable))
        assert (isinstance(label_index, collections.Iterable))
        unlabel_index = np.asarray(unlabel_index)
        label_index = np.asarray(label_index)
        if len(unlabel_index) <= batch_size:
            return unlabel_index

        # get unlabel_x
        if self.X is None or self.y is None:
            raise Exception('Data matrix is not provided, use select_by_prediction_mat() instead.')
        if model is None:
            model = LogisticRegression(solver='liblinear')
            model.fit(self.X[label_index],
                      self.y[label_index])

        unlabel_x = self.X[unlabel_index]
        label_x = self.X[label_index]
        label_y = self.y[label_index]
        #####################################

        # bagging
        if n_jobs is None:
            bagging = BaggingClassifier(model)
        else:
            bagging = BaggingClassifier(model, n_jobs=n_jobs)
        with warnings.catch_warnings():
            warnings.simplefilter("ignore")
            bagging.fit(label_x, label_y)
        est_arr = bagging.estimators_

        # calc score
        if self._disagreement == 'vote_entropy':
            score = self.calc_vote_entropy([estimator.predict(unlabel_x) for estimator in est_arr])
        else:
            score = self.calc_avg_KL_divergence([estimator.predict_proba(unlabel_x) for estimator in est_arr])
        return unlabel_index[nlargestarg(score, batch_size)]
def select ( self , label_index , unlabel_index , model = None , batch_size = 1 , n_jobs = None ) : assert ( batch_size > 0 ) assert ( isinstance ( unlabel_index , collections . Iterable ) ) assert ( isinstance ( label_index , collections . Iterable ) ) unlabel_index = np . asarray ( unlabel_index ) label_index = np . asarray ( label_index ) if len ( unlabel_index ) <= batch_size : return unlabel_index # get unlabel_x if self . X is None or self . y is None : raise Exception ( 'Data matrix is not provided, use select_by_prediction_mat() instead.' ) if model is None : model = LogisticRegression ( solver = 'liblinear' ) model . fit ( self . X [ label_index ] , self . y [ label_index ] ) unlabel_x = self . X [ unlabel_index ] label_x = self . X [ label_index ] label_y = self . y [ label_index ] ##################################### # bagging if n_jobs is None : bagging = BaggingClassifier ( model ) else : bagging = BaggingClassifier ( model , n_jobs = n_jobs ) with warnings . catch_warnings ( ) : warnings . simplefilter ( "ignore" ) bagging . fit ( label_x , label_y ) est_arr = bagging . estimators_ # calc score if self . _disagreement == 'vote_entropy' : score = self . calc_vote_entropy ( [ estimator . predict ( unlabel_x ) for estimator in est_arr ] ) else : score = self . calc_avg_KL_divergence ( [ estimator . predict_proba ( unlabel_x ) for estimator in est_arr ] ) return unlabel_index [ nlargestarg ( score , batch_size ) ]