Chatterbot: Bot Response, confidence 0

Created on 25 Jun 2019  路  2Comments  路  Source: gunthercox/ChatterBot

Hi, i am using ListTrainer, and right after i train the bot response is what i expect with confidence 0.51, and when i run the same thing again with same question asked, i get confidence 0.
Here is my settings.py
{
'import_path': 'chatterbot.logic.BestMatch',
'statement_comparison_function': 'chatterbot.comparisons.levenshtein_distance',
'maximum_similarity_threshold': 0.50,
'default_response': 'I am sorry, but I do not understand.',
},

Here is what i get in the terminal after making a two POST requests in postman, with the same question

Confidence: 0.51
[25/Jun/2019 07:14:27] "POST / HTTP/1.1" 200 7509
Confidence: 0
[25/Jun/2019 07:15:03] "POST / HTTP/1.1" 200 7493
Confidence: 0
[25/Jun/2019 07:15:18] "POST / HTTP/1.1" 200 7493
Confidence: 0
[25/Jun/2019 07:15:21] "POST / HTTP/1.1" 200 7493

I have tried chatterbot.storage.drop() and then again training the bot, but still got the same.

Most helpful comment

I found solution to this error, in your views.py, make another function to call the training list.. Name it PATCH.

if request.method == 'PATCH':
    trainer = ListTrainer(chatterbot)
    for _file in os.listdir('chatbot/chats_training'):
        chats = open('chatbot/chats_training/' + _file, 'r').readlines()
        trainer.train(chats)    
    return Response(status=200)

The problem happened because the bot was over-trained. So now try training only once and execute the bot

All 2 comments

i am facing same problem, i tried different response selection method but still i am getting same error, even i repeatedly send messages exactly same as training data it does not always returns expected answer

I found solution to this error, in your views.py, make another function to call the training list.. Name it PATCH.

if request.method == 'PATCH':
    trainer = ListTrainer(chatterbot)
    for _file in os.listdir('chatbot/chats_training'):
        chats = open('chatbot/chats_training/' + _file, 'r').readlines()
        trainer.train(chats)    
    return Response(status=200)

The problem happened because the bot was over-trained. So now try training only once and execute the bot

Was this page helpful?
0 / 5 - 0 ratings