Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoKnowledgeAdapter always return message with confidence=1 #1273

Closed
tomliau33 opened this issue Apr 17, 2018 · 10 comments
Closed

NoKnowledgeAdapter always return message with confidence=1 #1273

tomliau33 opened this issue Apr 17, 2018 · 10 comments

Comments

@tomliau33
Copy link

tomliau33 commented Apr 17, 2018

I created ChatterBot instance in read-only mode with a customized logic adapter, but I found that the default adapter NoKnowledgeAdapter always return message with confidence=1, and then the message returned from my logic adapter always be skipped because of NoKnowledgeAdapter has higher priority.

Is it possible to disable NoKnowledgeAdapter when I create a ChatterBot object?

@gunthercox
Copy link
Owner

It is not currently possible to disable the NoKnowledgeAdapter. Have you made sure that you chat bot has been trained? The NoKnowledgeAdapter will only return a confidence of 1 if there is no responses for the chat bot to reply with.

@tomliau33
Copy link
Author

I have my own model, I implemented a logic adapter which store trained data in my own table, so the statement table was empty. Since NoKnowledgeAdapter would return confidence=1 if self.chatbot.storage.count() == 0, so my own logic adapter would be ignore even it return a response with confidence==1.

If it is possible, I hope that I can pass a default adapter to replace NoKnowledgeAdapter when I new a ChatBot object.

Ex:
chatbot = ChatBot(default_logic_adapter=MyOwnDefaultLogicAdapter())

@vkosuri
Copy link
Collaborator

vkosuri commented Apr 27, 2018

Just curios, Could you please let me know what are the use case your trying achieving using above scenario?

@tomliau33
Copy link
Author

I use ChatterBot as the engine to implement a questionnaire survey bot. The bot will ask question to user, and then user response their answer. User's answers are privacy, others should not have chance to know the answer, so it is better to prevent chatbot reply those message, I disabled to store message and keep statement table as empty.

@vkosuri
Copy link
Collaborator

vkosuri commented May 1, 2018

Just curios, how you are managing, could you please elaborate this situation with more information. I think it should be a separate usecase or feature that needs to separate user based conversations.

I think this can achieved by using conversation_id http://chatterbot.readthedocs.io/en/stable/conversations.html#conversation-scope? did you tried this method, instead disabled training process.

@gunthercox Master, do you have any comments?

@tomliau33
Copy link
Author

tomliau33 commented May 2, 2018

I run in read-only mode not only for separate user conversations, but also prevent bot learn wrong conversions.

For example, below are normal situation:
user: I'm ready to answer
bot: How old are you
user: 28 years old
bot: What is your gender
user: man
bot: How tall are you (cm)
user: 17500
bot: The value is invalid, too high
user: 175
bot: Where are you living
user: Antarctica


If the bot learned from this conversation, it might have below scenario:
bot: How heavy are you (kg)
user: 700
bot: 28 years old


It might reply incorrect message "28 years old" since it learned before.

The bot can return correct message in read-only mode:
bot: How heavy are you (kg)
user: 700
bot: The value is invalid, too weight
user: 70
bot: Thank you for your answer


If ChatterBot can enable/disable learning dynamically, it will be suitable in my case.

@gunthercox
Copy link
Owner

gunthercox commented May 4, 2018

@tomliau33 I'm glad to see that you created your own model, that's awesome!

I think I can make a small code change that will make it easier for you to disable the NoKnowledgeAdapter since you don't need it for your project. Just opened a pull request with the changes: #1296

Let me know if you think that would solve this.

@tomliau33
Copy link
Author

That's awesome.
Thank you very much!

@tomliau33
Copy link
Author

tomliau33 commented May 5, 2018

PR #1296 can solve this.
Thank you!

@lock
Copy link

lock bot commented May 5, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators May 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants