Chatbot Overview
Conversational Bots
Intents & Entities
Intelligent Bots
Kore.ai's Approach
Kore.ai Conversational Platform
Bot Concepts and Terminology
Natural Language Processing (NLP)
Bot Types
Bot Tasks
Starting with Kore.ai Platform
How to Access Bot Builder
Working with Kore.ai Bot Builder
Building your first Bot
Getting Started with Building Bots
Using the Dialog Builder Tool
Creating a Simple Bot
Release Notes
Latest Updates
Older Releases
Deprecations
Bot Builder
Creating a Bot
Design
Develop
Storyboard
Dialog Task
User Intent Node
Dialog Node
Entity Node
Supported Entity Types
Composite Entities
Supported Time Zones
Supported Colors
Supported Company Names
Form Node
Logic Node
Message Nodes
Confirmation Nodes
Service Node
Custom Authentication
2-way SSL for Service nodes
Script Node
Agent Transfer Node
WebHook Node
Grouping Nodes
Connections & Transitions
Managing Dialogs
User Prompts
Alert Tasks
Alert Tasks
Ignore Words and Field Memory
Digital Forms
Digital Views
Knowledge Graph
Terminology
Building
Generation
Importing and Exporting
Analysis
Knowledge Extraction
Small Talk
Action & Information Task
Action Tasks
Information Tasks
Establishing Flows
Natural Language
Overview
Machine Learning
ML Model
Fundamental Meaning
NLP Settings and Guidelines
Knowledge Graph Training
Traits
Ranking and Resolver
NLP Detection
Advanced NLP Configurations
Bot Intelligence
Overview
Context Management
Session and Context Variables
Context Object
Dialog Management
Sub-Intents
Amend Entity
Multi-Intent Detection
Sentiment Management
Tone Analysis
Sentiment Management
Default Conversations
Default Standard Responses
Channel Enablement
Test & Debug
Talk to Bot
Utterance Testing
Batch Testing
Record Conversations
Publishing your Bot
Analyzing your Bot
Overview
Dashboard
Custom Dashboard
Conversation Flows
Bot Metrics
Advanced Topics
Bot Authorization
Language Management
Collaborative Development
IVR Integration
Data Table
Universal Bots
Defining
Creating
Training
Customizing
Enabling Languages
Smart Bots
Defining
Sample Bots
Github
Asana
Travel Planning
Flight Search
Event Based Bot Actions
koreUtil Libraries
Bot Settings
Bot Functions
General Settings
PII Settings
Customizing Error Messages
Manage Sessions
Bot Management
Bot Versioning
Using Bot Variables
API Guide
API Overview
API List
API Collection
SDKs
SDK Overview
SDK Security
SDK App Registration
Web SDK Tutorial
Message Formatting and Templates
Mobile SDK Push Notification
Widget SDK Tutorial
Widget SDK – Message Formatting and Templates
Web Socket Connect & RTM
Using the BotKit SDK
Installing
Configuring
Events
Functions
BotKit SDK Tutorial – Agent Transfer
BotKit SDK Tutorial – Flight Search Sample Bot
Using an External NLP Engine
Bot Administration
Bots Admin Console
Dashboard
User Management
Managing Users
Managing Groups
Managing Role
Bots Management
Enrollment
Inviting Users
Bulk Invites
Importing Users
Synchronizing Users from AD
Security & Compliance
Using Single Sign-On
Security Settings
Cloud Connector
Analytics
Billing
How Tos
Creating a Simple Bot
Creating a Banking Bot
Transfer Funds Task
Update Balance Task
Context Switching
Using Traits
Schedule a Smart Alert
Configure Digital Forms
Add Form Data into Data Tables
Configuring Digital Views
Add Data to Data Tables
Update Data in Data Tables
Custom Dashboard
Custom Tags to filter Bot Metrics
Patterns for Intents & Entities
Build Knowledge Graph
Global Variables
Content Variables
Using Bot Functions
Configure Agent Transfer
  1. Home
  2. Docs
  3. Bots
  4. Natural Language
  5. ML Model

ML Model

Once you have built your virtual assistant and trained it, the Kore.ai platform builds an ML model mapping user utterance with bot intents (see here for more). Once created, it is a good idea to validate the model to understand and estimate an unbiased generalization performance of the ML model.

Kore.ai virtual assistant platform offers two validation methods:

  • Confusion Matrix or Error Matrix to visualize of the performance of the machine learning model;
  • K-fold Cross-Validation to estimate the skill of the machine learning model.

You can choose the validation model from Training -> Machine Learning Utterances using the Validate Model drop-down and selecting the method. You will be navigated to the results page of the corresponding validation method.

In the following sections, we will look into each of these methods in detail.

K-fold Cross-Validation

(This was introduced in ver8.0 of the platform)

Cross-validation is a resampling procedure used to evaluate machine learning models on a limited data sample. The technique involves partitioning the data into subsets, training the data on a subset, and using the other subsets to evaluate the model’s performance. Performing Cross-Validation would give a more generalized metric on model performance, which may be a better indicator of the ML model’s performance.

Configuration

Kore.ai virtual assistant platform supports K-fold cross-validation. For this, you need to configure the K-fold parameter for cross-validation from the advanced NLP configurations, see here for how.

Use the Generate button to initiate the ML training using the K-fold approach. Report would be displayed and you have the option to Regenerate the report as and when needed.

Note that the validations can be performed only when the total number of ML utterances used for training is at least 250. This number is configurable for the on-prem installation, contact our support team for details.

Implementation

Following are the steps followed by the platform while performing the K-fold cross-validation:

  • The entire set of utterances is randomly divided into training and test data sets.
  • The entire training data is partitioned into ‘k’ folds with each subset containing an equal number of training utterances. The value for ‘k’ folds needs to be configured as mentioned above.
  • The system then runs ‘k’ iterations and in each iteration, a subset (fold) of utterances is tested against the model trained using the rest of the subsets (‘k – 1’ folds).
  • The resulting model is validated on the test data set to compute the performance measures.
  • This process is repeated until every utterance is used at least once for testing the model.
  • The metrics are provided post K fold cross-validation to help you assess the ML model’s performance.

Understanding the Results

The following metrics are provided post the K fold cross-validation:

  • The Precision score of each testing fold – to define how precise/accurate your model is and is calculated as the ratio of true positives over total predicted positives (sum of true and false positives)
  • The Recall score of each testing fold – defines the fraction of the relevant utterances that are successfully identified and is calculated as the ratio of true positives over actual positives (sum of true positives and false negatives).
  • The F1 Score of each testing fold – to even out class distribution and seek a balance between precision and recall and is calculated as the weighted average of Precision and Recall.
  • A mean of the precision, recall, and F1 scores for all the folds.

The following information is also provided to help understand the associated metrics better:

  • Total Utterances – number of utterances in the training corpus;
  • Number of Intents – total number of intents in the bot;
  • Number of Folds – number of subsets the training corpus was divided into, the K-fold parameter;
  • Test Data per Fold – number of utterances in each subset used for testing; and
  • Training Data per Fold – number of utterances in each subset used for training.

Note that these results are more accurate and representative of the ML Model’s performance when performed on larger utterance datasets, 250 utterances at the least.

Confusion Matrix

(Previously referred to as ML model)

Confusion Matrix is useful in describing the performance of a classification model (or “classifier”) on a set of test data for which the true values are known. The graph generated by the confusion matrix presents an at-a-glance view of the performance of your trained utterances against the bot tasks. The name stems from the fact that it makes it easy to see if the model is confusing utterances.

The ML Model graph evaluates all the training utterances against each bot task and plots them into one of these quadrants of the task: True Positive (True +ve), True Negative (True -ve), False Positive (False +ve), False Negative (False -ve). A quick look at the graph and you know which utterance-intent matches are accurate and which can be further trained to produce better results.

The higher the utterance in the True quadrants the better it exhibits expected behavior – True +ve represents a strong match with the task for which they are trained and the True -ve represents a mismatch with the irrelevant intents as expected. Utterances at a moderate level in the True quadrants can be further trained for better scores.

The utterances falling into the False quadrants need immediate attention. These are the utterances that are either not matching with the intended tasks or are matching with the wrong ones. To read the utterance text in any quadrant, hover over the dot in the graph.

True Positive Quadrant

When utterances trained for an intent receive a positive confidence score for that intent, they fall into its True Positive quadrant. This quadrant represents a favorable outcome. However, the higher the utterance on the quadrant’s scale the more chances of it finding the right intent.
Note: Utterances that fall into the true positive quadrants of multiple bot tasks denote overlapping bot tasks that need to be fixed.

True Negative Quadrant

When utterances not trained for an intent to receive a negative confidence score for the intent, they fall into its True Negative quadrant. This quadrant represents a favorable outcome as the utterance is not supposed to match with the intent. The lower the utterance on the quadrant’s scale, the higher the chances of it staying afar from the intent. All the utterances trained for a particular bot task should ideally fall into the True Negative quadrants of the other tasks.

False Positive Quadrant

When utterances that are not trained for an intent receive a positive confidence score for the intent, they fall into its False Positive quadrant. This quadrant represents an unfavorable outcome. For such outcomes, the utterance, the intended bot task, and the incorrectly matching task may have to be trained for optimum results.

False Negative Quadrant

When utterances trained for an intent receive a negative confidence score for the intent, they fall into its False Negative quadrant. The quadrant represents an unfavorable outcome as the utterance is supposed to match with the intent. For such outcomes, the utterance, the intended bot task, and the task need to be trained for optimum outcome. Read Machine Learning to learn more.

Note: Make sure to click the train button after making any changes to your bot to reflect them in the ML Model Graph.

Consider the following key points when referring to the graph:

  • The higher up the utterance in the True quadrants the better it exhibits the expected behavior
  • Utterances at a moderate level in the True quadrants can be further trained for better scores.
  • The utterances falling into the False quadrants need immediate attention.
  • Utterances that fall into the true quadrants of multiple bot tasks denote overlapping bot tasks that need to be fixed.

Understanding a Good/Bad ML model

Let us consider a banking bot as an example for understanding Good or Bad ML Mode. The bot has multiple tasks with more than 300 trained utterances. The below Image depicts 4 tasks and the associated utterances.

The model in this scenario is fairly well trained with most of the utterances pertaining to a task are concentrated in the True Positive quadrant and most of the utterances for other tasks are in the True Negative quadrant.

The developer can work to improve on the following aspects of this model :

  • In the ML model for task ‘Get Account Balance’ we can see a few utterances (B) in the False Positive quadrant.
  • An utterance trained for ‘Get Account Balance’ appears in the True Negative quadrant (C).
  • Though the model is well trained and most of the utterances for this task are higher up in the True Positive quadrant, some of the utterances still have a very low score. (A)
  • When you hover over the dots, you can see the utterance. For A, B, and C, though the utterance should have exactly matched the intent, it has a low or negative score as a similar utterance has been trained for another intent.
    Note: In such cases, it’s best to try the utterance with Test & Train module, check for the intents that the ML engine returns and the associated sample utterances. Fine tune the utterances and try again.
  • The task named Report Loss of Card contains limited utterances which are concentrated together.

Let us now compare it with the ML Model for the Travel Bot below:

The model is trained with a lot of conflicting utterances, resulting in a scattered view of utterances. This will be considered as a bad model and will need to be re-trained with a smaller set of utterances that do not relate to multiple tasks in a bot.

Viewing the Graph for Specific Task Utterances

By default, the ML Model Graph shows the performance of all the trained utterances against all bot tasks. To view the performance of a specific bot task’s trained utterances against all the other intents, toggle the switch for the bot task as shown in the image below.


Note: Since these are the trained utterances of the first bot task, ideally the utterances should appear at the top of the True +ve quadrant of that task and the bottom of the True -ve quadrant of all the other tasks.

Filtering the ML Model Graph

You can filter the ML Model Graph based on the following criteria:

  • In Development or Published: By default the graph shows the graph for all the tasks In Development and Published tasks. Toggle the switch to view the graph for only the published tasks.
  • Weak to Strong: View the graph from the least accurate tasks scores to the most accurate.
  • Strong to Weak: View the graph from the most accurate task scores to the least.
  • Task/Intent: Select all or select specific task names to view their graph.
  • Utterance: Select all or select specific trained utterances to view their graph.

Editing and Remapping Utterances

You can edit user utterances and re-assign them to other tasks to improve their scores directly from the ML Graph. To do so click on a quadrant and the Quadrant view opens with the name of the task and all the utterances related to it.

To edit an individual utterance, click the edit icon against it. The edit utterance window opens. You can make changes to the text in the Utterance field or reassign the utterance to another task using the Expected Task drop-down list.

Note: You can also open this window by clicking an individual dot on the ML graph instead of the entire quadrant.
Menu