original_docstring: Randomly select an initial training dataset.
docstring: Randomly select an initial training dataset.
docstring_tokens: Randomly select an initial training dataset .
code: def _random_initialization(self, X=None, y=None, initial_selection=None):
      """Randomly select an initial training dataset."""
      if initial_selection is not None:
          labeled_pool = initial_selection
      else:
          rng = np.random.RandomState(self.random_state)
          labeled_pool = np.zeros(shape=(X.shape[0])).astype(bool)
          ids = rng.choice(np.arange(X.shape[0]), self.n_init_, replace=False)
          if np.unique(y[ids]).shape[0] == 1:
              ids[-1] = rng.choice(
                  np.arange(X.shape[0])[y != y[ids][0]], 1, replace=False
              )
          labeled_pool[ids] = True
      return labeled_pool
code_tokens: def _random_initialization ( self , X = None , y = None , initial_selection = None ) : if initial_selection is not None : labeled_pool = initial_selection else : rng = np . random . RandomState ( self . random_state ) labeled_pool = np . zeros ( shape = ( X . shape [ 0 ] ) ) . astype ( bool ) ids = rng . choice ( np . arange ( X . shape [ 0 ] ) , self . n_init_ , replace = False ) if np . unique ( y [ ids ] ) . shape [ 0 ] == 1 : ids [ - 1 ] = rng . choice ( np . arange ( X . shape [ 0 ] ) [ y != y [ ids ] [ 0 ] ] , 1 , replace = False ) labeled_pool [ ids ] = True return labeled_pool
short_docstring: Randomly select an initial training dataset.
short_docstring_tokens: Randomly select an initial training dataset .
comment: """Randomly select an initial training dataset."""