Hands-on

Mallu Updated by Mallu

Introduction

Let's train an AI to understand and interpret your customers' messages.

We will follow some steps

It is recommended to read the section Intents and Entities to understand how intents and entities (optional) work.

Hands-on

Now, let's work on the AI

  1. Define the purpose of the AI
  2. Define required Intents for its purpose
  3. Create example sentences for each intent
  4. Train the model based on these examples
  5. Test the trained model

1. Define intelligence context

To define the purpose of your AI, it is necessary to answer a few questions: Where will your AI operate? What specific problems will it address? What kind of topics should the customer bring up?

As an example, we will create an AI for a website that classifies phrases into the intentions: question, complaint, tracking.

The main idea is to have a simple intelligence, working in a website chatbot, that will guide users to talk to its requested department.

2. Define the necessary intentions for this purpose

To be able to train, it is required to define which intents will be used in the AI.

We can ask some questions to help with this step: What is the scope/context your AI will address? How can this context be divided into distinct intents?

Upon receiving a sentence, the AI will label it as one of the registered intents.

To our example, it is clear that we will use question, complaint and tracking as intents.

Advanced
At this stage, it is important to analyze whether the defined intentions align with the purpose of the AI.

As an example, the user could add here greetings and farewell intents, in order to classify the sentences also in this context, and it would work. However, depending on the flow used in your chatbot, it might make more sense to use an specific intelligence to that context, which would enter the beginning and end of the flow.

The same applies to AIs with many intents. Ideally, an analysis should be carried out to determine whether all those intents need to remain in a single AI. The less intents an IA has, the more assertiveness it will have, and the simpler it will be maintained.

As a chatbot can use several AIs at the same time, it is recommended to think of smaller AIs for specific topics of the flow, than a single great AI for all purposes.

Other good practices can be found at Guidelines and good practices.

3. Create example sentences for each intent

Each intent should receive different example sentences to be able to learn and correctly label the incoming messages.

In the Training tab, add the phrases with their respective intents. In our example, we have:

To learn more about adding sentences, check out Training your Intelligence.

The more sentences it has, the more assertive it will be.

Advanced

Entities are groupings of words used to extract extra information beyond the sentence classification. In this example, as two words were marked as products, when making the classification, the intelligence will also try to extract entities that fall into this category of products (words such as: computer, tablet, laptop, TV).

To learn more, read Intents and Entities.

4 Train the model based on these examples

Here, Weni takes care of the work, just click "Run Training" and the AI will be trained with the registered phrases, generating a new model*.

If you already have your AI trained and want to make changes to sentences such as some addition, edit or removal, these changes will only take effect by retraining AI.
The training is a heavy process that usually takes 7 to 15 minute. Just wait a little bit!
Advanced *
The training process always uses all registered sentences, whether they are already trained sentences or new sentences, not yet trained. Therefore, when training, the old model* is not updated, it is simply replaced with a new one.

* model is the component generated by the training process, as shown in the diagram:

5 Test the trained model

After the training process, your intelligence was created. To find out how it is working and if you can already interpret the different messages that your customer will send, just open the Quick Test window and send a sentence for classification. Your last trained model will be used to classify the sentence. A response will be returned with the classified intention and the confidence rate for that classification.

The confidence rate indicates how certain your intelligence is about its prediction.

To put together a more effective test, it is recommended to go to the Tests tab and add the test sentences you want, along with the real intention of each sentence.

When running the test, Weni will use your model to classify the test sentences one by one, and compare the predicted result with the actual value entered by you, showing them in the test results.

For more information, see Tests

How did we do?

Intents and Entities

Creating an Intelligence

Contact