notice

This is unreleased documentation for Rasa Open Source Documentation Master/Unreleased version.
For the latest released documentation, see the latest version (2.0.x).

Version: Master/Unreleased

rasa.nlu.classifiers.sklearn_intent_classifier

SklearnIntentClassifier Objects

class SklearnIntentClassifier(IntentClassifier)

Intent classifier using the sklearn framework

__init__

| __init__(component_config: Optional[Dict[Text, Any]] = None, clf: "sklearn.model_selection.GridSearchCV" = None, le: Optional["sklearn.preprocessing.LabelEncoder"] = None) -> None

Construct a new intent classifier using the sklearn framework.

transform_labels_str2num

| transform_labels_str2num(labels: List[Text]) -> np.ndarray

Transforms a list of strings into numeric label representation.

Arguments:

  • labels: List of labels to convert to numeric representation

transform_labels_num2str

| transform_labels_num2str(y: np.ndarray) -> np.ndarray

Transforms a list of strings into numeric label representation.

Arguments:

  • y: List of labels to convert to numeric representation

train

| train(training_data: TrainingData, config: Optional[RasaNLUModelConfig] = None, **kwargs: Any, ,) -> None

Train the intent classifier on a data set.

process

| process(message: Message, **kwargs: Any) -> None

Return the most likely intent and its probability for a message.

predict_prob

| predict_prob(X: np.ndarray) -> np.ndarray

Given a bow vector of an input text, predict the intent label.

Return probabilities for all labels.

Arguments:

  • X: bow of input text

Returns:

vector of probabilities containing one entry for each label

predict

| predict(X: np.ndarray) -> Tuple[np.ndarray, np.ndarray]

Given a bow vector of an input text, predict most probable label.

Return only the most likely label.

Arguments:

  • X: bow of input text

Returns:

tuple of first, the most probable label and second, its probability.

persist

| persist(file_name: Text, model_dir: Text) -> Optional[Dict[Text, Any]]

Persist this model into the passed directory.