parameters: (self, images, labels)
docstring: Train eigenfaces
docstring_summary: Train eigenfaces
docstring_tokens: Train eigenfaces
function: def train(self, images, labels):
          """
          Train eigenfaces
          """
          print "Train...",
          #copy labels
          self._labels = labels;
  
          #transform the numpe vector to shogun structure
          features = sg.RealFeatures(images)
          #PCA
          self.pca = sg.PCA()
          #set dimension
          self.pca.set_target_dim(self._num_components);
          #compute PCA
          self.pca.init(features)
  
          for sampleIdx in range(features.get_num_vectors()):
              v = features.get_feature_vector(sampleIdx);
              p = self.pca.apply_to_feature_vector(v);
              self._projections.insert(sampleIdx, p);
  
          print "ok!"
function_tokens: def train ( self , images , labels ) : print "Train..." , #copy labels self . _labels = labels #transform the numpe vector to shogun structure features = sg . RealFeatures ( images ) #PCA self . pca = sg . PCA ( ) #set dimension self . pca . set_target_dim ( self . _num_components ) #compute PCA self . pca . init ( features ) for sampleIdx in range ( features . get_num_vectors ( ) ) : v = features . get_feature_vector ( sampleIdx ) p = self . pca . apply_to_feature_vector ( v ) self . _projections . insert ( sampleIdx , p ) print "ok!"