original_docstring:  Relabel the training set according to the current decision function.
          
docstring: Relabel the training set according to the current decision function.
docstring_tokens: Relabel the training set according to the current decision function .
code: def relabel_training_set(self):
          """ Relabel the training set according to the current decision function.
          """
          iterations = 1
          while self.relabel:
              changed = False
              # relabel all training samples according to
              # current decision function
              for i in numpy.arange(len(self.samples)):
                  predictionVec = self._execute(numpy.atleast_2d(self.samples[i]))
                  if self.labels[i] != self.classes.index(predictionVec.label):
                      changed = True
                      self.labels[i] = self.classes.index(predictionVec.label)
                      # only relevant for SOR classification (outsourcing?)
                      if "version" in self.__dict__:
                          for i in range(self.num_samples):
                              if self.version == "matrix":
                                  self.M[-1, i] *= -1
                                  self.M[i, -1] *= -1
                              # modified from *calculate_weigts_and_class_factors*
                              if self.version in ["samples", "matrix"]:
                                  self.bi[i] *= -1
                                  self.ci[i] = self.complexity * \
                                      self.weight[self.labels[i]]
                  if i < len(self.decisions):
                      self.decisions[i] = predictionVec.prediction
                  else:
                      self.decisions.append(predictionVec.prediction)
              if not changed:
                  break
              else: # Retrain the svm with the relabeled training set
                  self.retrain_SVM()
              if not self.relabel == "conv" or iterations >= 10:
                  break
              iterations += 1
code_tokens: def relabel_training_set ( self ) : iterations = 1 while self . relabel : changed = False for i in numpy . arange ( len ( self . samples ) ) : predictionVec = self . _execute ( numpy . atleast_2d ( self . samples [ i ] ) ) if self . labels [ i ] != self . classes . index ( predictionVec . label ) : changed = True self . labels [ i ] = self . classes . index ( predictionVec . label ) if "version" in self . __dict__ : for i in range ( self . num_samples ) : if self . version == "matrix" : self . M [ - 1 , i ] *= - 1 self . M [ i , - 1 ] *= - 1 if self . version in [ "samples" , "matrix" ] : self . bi [ i ] *= - 1 self . ci [ i ] = self . complexity * self . weight [ self . labels [ i ] ] if i < len ( self . decisions ) : self . decisions [ i ] = predictionVec . prediction else : self . decisions . append ( predictionVec . prediction ) if not changed : break else : self . retrain_SVM ( ) if not self . relabel == "conv" or iterations >= 10 : break iterations += 1
short_docstring: Relabel the training set according to the current decision function.
short_docstring_tokens: Relabel the training set according to the current decision function .
comment: """ Relabel the training set according to the current decision function.
          """$SEP$# relabel all training samples according to$SEP$# current decision function$SEP$# only relevant for SOR classification (outsourcing?)$SEP$# modified from *calculate_weigts_and_class_factors*$SEP$# Retrain the svm with the relabeled training set