rasa_nlu/classifiers/sklearn_intent_classifier.py
def train(self, training_data, cfg, **kwargs):
        # type: (TrainingData, RasaNLUModelConfig, **Any) -> None
        """Train the intent classifier on a data set."""

        num_threads = kwargs.get("num_threads", 1)

        labels = [e.get("intent")
                  for e in training_data.intent_examples]

        if len(set(labels)) < 2:
            logger.warn("Can not train an intent classifier. "
                        "Need at least 2 different classes. "
                        "Skipping training of intent classifier.")
        else:
            y = self.transform_labels_str2num(labels)
            X = np.stack([example.get("text_features")
                          for example in training_data.intent_examples])

            self.clf = self._create_classifier(num_threads, y)

            self.clf.fit(X, y)
Train the intent classifier on a data set.
Train the intent classifier on a data set.
Train the intent classifier on a data set .
def train(self, training_data, cfg, **kwargs):
        num_threads = kwargs.get("num_threads", 1)
        labels = [e.get("intent")
                  for e in training_data.intent_examples]
        if len(set(labels)) < 2:
            logger.warn("Can not train an intent classifier. "
                        "Need at least 2 different classes. "
                        "Skipping training of intent classifier.")
        else:
            y = self.transform_labels_str2num(labels)
            X = np.stack([example.get("text_features")
                          for example in training_data.intent_examples])
            self.clf = self._create_classifier(num_threads, y)
            self.clf.fit(X, y)
def train ( self , training_data , cfg , ** kwargs ) : num_threads = kwargs . get ( "num_threads" , 1 ) labels = [ e . get ( "intent" ) for e in training_data . intent_examples ] if len ( set ( labels ) ) < 2 : logger . warn ( "Can not train an intent classifier. " "Need at least 2 different classes. " "Skipping training of intent classifier." ) else : y = self . transform_labels_str2num ( labels ) X = np . stack ( [ example . get ( "text_features" ) for example in training_data . intent_examples ] ) self . clf = self . _create_classifier ( num_threads , y ) self . clf . fit ( X , y )
Train the intent classifier on a data set.
Train the intent classifier on a data set .
# type: (TrainingData, RasaNLUModelConfig, **Any) -> None """Train the intent classifier on a data set."""
self
training_data
cfg