parameters: (self, X, random_state)
docstring: Initialize the model parameters.
  
          Parameters
          ----------
          X : array-like, shape  (n_samples, n_features)
  
          random_state : RandomState
              A random number generator instance.
docstring_summary: Initialize the model parameters.
docstring_tokens: Initialize the model parameters .
function: def _initialize_parameters(self, X, random_state):
          """Initialize the model parameters.
  
          Parameters
          ----------
          X : array-like, shape  (n_samples, n_features)
  
          random_state : RandomState
              A random number generator instance.
          """
          n_samples, _ = X.shape
  
          if self.init_params == 'kmeans':
              resp = np.zeros((n_samples, self.n_components))
              label = cluster.KMeans(n_clusters=self.n_components, n_init=1,
                                     random_state=random_state).fit(X).labels_
              resp[np.arange(n_samples), label] = 1
          elif self.init_params == 'random':
              resp = random_state.rand(n_samples, self.n_components)
              resp /= resp.sum(axis=1)[:, np.newaxis]
          else:
              raise ValueError("Unimplemented initialization method '%s'"
                               % self.init_params)
  
          self._initialize(X, resp)
function_tokens: def _initialize_parameters ( self , X , random_state ) : n_samples , _ = X . shape if self . init_params == 'kmeans' : resp = np . zeros ( ( n_samples , self . n_components ) ) label = cluster . KMeans ( n_clusters = self . n_components , n_init = 1 , random_state = random_state ) . fit ( X ) . labels_ resp [ np . arange ( n_samples ) , label ] = 1 elif self . init_params == 'random' : resp = random_state . rand ( n_samples , self . n_components ) resp /= resp . sum ( axis = 1 ) [ : , np . newaxis ] else : raise ValueError ( "Unimplemented initialization method '%s'" % self . init_params ) self . _initialize ( X , resp )