original_docstring:  Train the classifier on the given data sample
          
              It is assumed that the class_label parameter
              contains information about the true class the data belongs to.
  
              :param data:  A new sample for the training set.
              :type  data:  FeatureVector
              :param class_label:    The label of the new sample.
              :type  class_label:    str.
          
docstring: Train the classifier on the given data sample
  It is assumed that the class_label parameter
  contains information about the true class the data belongs to.
docstring_tokens: Train the classifier on the given data sample It is assumed that the class_label parameter contains information about the true class the data belongs to .
code: def _train_sample(self, data, class_label):
          """ Train the classifier on the given data sample
          
              It is assumed that the class_label parameter
              contains information about the true class the data belongs to.
  
              :param data:  A new sample for the training set.
              :type  data:  FeatureVector
              :param class_label:    The label of the new sample.
              :type  class_label:    str.
          """
          if self.feature_names is None:
              try:
                  self.feature_names = data.feature_names
              except AttributeError as e:
                  warnings.warn("Use a feature generator node before a " +
                                "classification node.")
                  raise e
              if self.dim is None:
                  self.dim = data.shape[1]
              if self.samples is None:
                  self.samples = []
                  # self.decision is by default set to empty list
                  if self.add_type == "UNSUPERVISED_PROB":
                      self.decisions = []
              if self.labels is None:
                  self.labels = []
              if self.discard_type == "INC_BATCH":
                  self.future_samples = []
                  self.future_labels = []
          if class_label not in self.classes and "REST" not in self.classes and \
                  not self.regression:
              warnings.warn(
                  "Please give the expected classes to the classifier! " +
                  "%s unknown. " % class_label +
                  "Therefore define the variable 'class_labels' in " +
                  "your spec file, where you use your classifier. " +
                  "For further info look at the node documentation.")
              if self.multinomial or not(len(self.classes) == 2):
                  self.classes.append(class_label)
                  self.set_permanent_attributes(classes=self.classes)
          # main step of appending data to the list *self.samples*
          if class_label in self.classes or self.regression:
              self.append_sample(data)
          
          if not self.regression and class_label in self.classes:
              self.labels.append(self.classes.index(class_label))
          elif not self.regression and "REST" in self.classes:
              self.labels.append(self.classes.index("REST"))
          elif self.regression:  # regression!
              try:
                  self.labels.append(float(class_label))
              except ValueError:  # one-class-classification is regression-like
                  self.labels.append(1)
          else:  # case, where data is irrelevant
              pass
code_tokens: def _train_sample ( self , data , class_label ) : if self . feature_names is None : try : self . feature_names = data . feature_names except AttributeError as e : warnings . warn ( "Use a feature generator node before a " + "classification node." ) raise e if self . dim is None : self . dim = data . shape [ 1 ] if self . samples is None : self . samples = [ ] if self . add_type == "UNSUPERVISED_PROB" : self . decisions = [ ] if self . labels is None : self . labels = [ ] if self . discard_type == "INC_BATCH" : self . future_samples = [ ] self . future_labels = [ ] if class_label not in self . classes and "REST" not in self . classes and not self . regression : warnings . warn ( "Please give the expected classes to the classifier! " + "%s unknown. " % class_label + "Therefore define the variable 'class_labels' in " + "your spec file, where you use your classifier. " + "For further info look at the node documentation." ) if self . multinomial or not ( len ( self . classes ) == 2 ) : self . classes . append ( class_label ) self . set_permanent_attributes ( classes = self . classes ) if class_label in self . classes or self . regression : self . append_sample ( data ) if not self . regression and class_label in self . classes : self . labels . append ( self . classes . index ( class_label ) ) elif not self . regression and "REST" in self . classes : self . labels . append ( self . classes . index ( "REST" ) ) elif self . regression : try : self . labels . append ( float ( class_label ) ) except ValueError : self . labels . append ( 1 ) else : pass
short_docstring: Train the classifier on the given data sample
  It is assumed that the class_label parameter
  contains information about the true class the data belongs to.
short_docstring_tokens: Train the classifier on the given data sample It is assumed that the class_label parameter contains information about the true class the data belongs to .
comment: """ Train the classifier on the given data sample
          
              It is assumed that the class_label parameter
              contains information about the true class the data belongs to.
  
              :param data:  A new sample for the training set.
              :type  data:  FeatureVector
              :param class_label:    The label of the new sample.
              :type  class_label:    str.
          """$SEP$# self.decision is by default set to empty list$SEP$# main step of appending data to the list *self.samples*$SEP$# regression!$SEP$# one-class-classification is regression-like$SEP$# case, where data is irrelevant