> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Machine Learning Engine

<Badge icon="arrow-left" color="gray">[Back to NLP Topics](/ai-for-service/automation/natural-language/nlp-topics)</Badge>

The ML engine maps user utterances to intents using example-based training. It supports supervised and unsupervised learning, with a range of network types for different use cases.

***

## How the ML Engine Works

**Intent detection pipeline:**

1. User utterance is preprocessed (tokenization, stop word removal, lemmatization, n-grams).
2. The ML model classifies the utterance as a probable or definitive match against trained intents.
3. Results are passed to Ranking and Resolver.

**Entity extraction:** After intent is identified, the engine extracts entity values from the utterance using NER (Named Entity Recognition) trained annotations.

**Supervised vs. unsupervised learning:**

* **Unsupervised** (auto-expand): The assistant learns from all successful interactions automatically.
* **Supervised** (recommended): Developers monitor interaction logs, tune NLP settings for failures, and retrain.

***

## Add ML Utterances

1. Go to **Natural Language > Training > Intents**.
2. Select an intent and add sample utterances.
3. Click **Train** to update the model.

**Utterance guidelines:**

* Utterances do not need to be full sentences; phrases work too.
* For distinct intents (e.g., "Find Flight" vs. "Book Hotel"): 200-300 utterances each.
* For similar intents (e.g., "Change Seat" vs. "Change Flight"): 1000+ utterances each.
* For Deep Neural Networks: larger datasets (data-hungry models) produce better results.

***

## ML Network Types

Configure under **Natural Language > NLU Config > Engine Tuning > ML**.

| Network Type                                   | Description                                                                         |
| ---------------------------------------------- | ----------------------------------------------------------------------------------- |
| **Standard** (default)                         | Bag-of-words classification. Suitable for most use cases.                           |
| **MLP-BOW**                                    | Multi-layer perceptron with bag-of-words features.                                  |
| **MLP-WordEmbeddings**                         | MLP with pre-trained word embeddings.                                               |
| **LSTM**                                       | Recurrent neural network. Captures sequential context.                              |
| **CNN**                                        | Convolutional neural network. Captures local n-gram patterns.                       |
| **Transformer**                                | Transformer-based model. High accuracy for English.                                 |
| **KAEN**                                       | Kore.ai custom model. Improved accuracy for English.                                |
| **Zero-shot Model**                            | No training required; uses semantic similarity. Requires NLP V3.                    |
| **Few-shot Model (Kore.ai Hosted Embeddings)** | LLM-based semantic similarity. Reduces training data requirements. Requires NLP V3. |

***

## Thresholds and Configuration

Go to **Natural Language > NLU Config > Engine Tuning > Machine Learning**.

| Setting            | Description                                                            |
| ------------------ | ---------------------------------------------------------------------- |
| **ML Threshold**   | Minimum confidence score for a probable match (default: 0.3).          |
| **Auto Training**  | Automatically retrain the model when utterances are added or modified. |
| **Network Type**   | Select the ML model architecture.                                      |
| **Stop Words**     | Enable/disable stop word removal during training.                      |
| **Synonyms in ML** | Include bot synonyms in ML training.                                   |

***

## Synonyms and Concepts for ML

**Bot Synonyms:** Go to **Training > Bot Synonyms**. Add synonyms for words in task and entity names. Synonyms are app-wide.

* To add: click **New Synonym**, enter the keyword and its synonyms (press Enter after each).
* Parallel editing is supported — multiple users can add/delete synonyms concurrently without data conflicts.

**Entity Synonyms:** Go to **Training > Entities**. Add synonyms per entity node.

**Concepts:** Custom concept groups prefixed with `~`. Define in **Training > Concepts**. Used in patterns and entity detection.

***

## App Substitutions

Define domain-specific word replacements using the `~bot_substitutions` concept:

```
Chevy|Chevrolet    → replaces "Chevy" with "Chevrolet"
?_km|kilometers    → replaces "5 km" with "5 kilometers"
```

Syntax: `original_word|replacement` (case-insensitive match, case-sensitive replacement).

***

## App Word Aliases

Define alternate spellings or STT transcription corrections using Bot Synonyms with a `+` prefix.

Example: `+Alpha Romeo` as an alias for `Alfa Romeo` — corrects speech-to-text transcription errors.

* Aliases do not change the original utterance.
* They normalize values returned for Custom Concept entities.

***

## Homophones

Handle words that sound the same but have different spellings. Define using a concept with `|` separator:

```
write|right|rite
```

The engine considers all homophones during POS tagging and replaces the word if a homophone is a better grammatical fit.

**To define:** **Training > Concepts > New Concept** — enter homophones separated by `|`.

***

## Emoji Support

Import default emoji mappings into system concepts to handle emoji inputs:

1. Go to **Natural Language > Training > Intents > ⋯ > Import Emojis into Concepts**.
2. Emojis are added to system concepts (e.g., `~emohappy`, `~emohello`).
3. Review and remove unwanted emojis after import.

***

## Patterns for Intents and Entities

See [NLP Guidelines — Patterns](/ai-for-service/automation/natural-language/nlp-guidelines#patterns) for operators, syntax, and examples.

**Add intent pattern:**

1. **Training > Intents** → click **Patterns / +Pattern** for an intent.
2. Enter patterns; press Enter between each.

**Add entity pattern:**

1. **Training > Entities** → click the edit icon for an entity.
2. Select the **Patterns** tab → enter patterns.

**Add intent rules:**

1. **Training > Intents** → click **Rules / +Rule** for an intent.
2. Enter Trait or context tag conditions using AND/OR operators.

**Negative patterns:**

1. Enable at **NLU Config > Ranking and Resolver Engine > Negative Patterns**.
2. Per intent: **Training > Intents** → select intent → **Negative Patterns** tab → add patterns.

***

## NLU Config — FM Engine Tuning

| Setting                                    | Description                                                                                                                                                                  |
| ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Intent Detection using Task Name Words** | When disabled, intent is detected only if input starts/ends with the exact task name. Useful for tasks with shared words (e.g., multiple "order" tasks). Enabled by default. |
| **FM Threshold**                           | Max % above the top-scoring intent allowed for other intents to be considered (0-20%; default 2%). Supported for English, Spanish, French, German.                           |
