Bot 3 – Statistical cognition – Unsupervised learning

The 3rd stage of my “Cognition Bot Taxonomy”.

The bot makes assumptions about its inputs and comes to its conclusions about its outputs – all on its own and therefore learns unsupervised.

The bot does that by building a statistical model to correlate its inputs with its outputs. Does this sound a little esoteric? Let’s start with an easy example:

The meaning of words

Imagine a chatbot that can turn on or off a lamp, by analyzing your sentence and learn.

The bot is programmed to know 4 word categories:

  • “On” words – turns on the lamp.
  • Neutral words – is ignored.
  • “Off” words – turns off the lamp.
  • Unknown words – will be converted into neutral words.

The chatbot splits the input sentence into words, which are used to estimate the meaning. For example:

“Turn” and “lamp” are neutral and therefore ignored, while “on” and “off” will influence the input.

Reinforce the meaning of words

When a lamp is turned on or off, the bot takes all the words in the sentence and reinforces their meaning, by increasing their “on value” or “off value”.

The sentence: “Turn off the lamp, it’s blinding me” will not only turn off the lamp but also reinforce the meaning of all the words in the sentence. Over time the word “blinding” will become an “off” word, so the sentence “It’s blinding me” could be used to turn off the lamp.

Over time a statistical network will be created like this:

Which can be used to create all kind of sentences: “illuminate lamp”, “I need darkness”, “blind him”, enlighten her”, “I am blinded”, which will correctly turn on or off the lamp.

Bot example:

>>You: turn on, I need light

 known words:
 word on value off value
 'on' 100 2
 'off' 2 100

 on sum (probability): 100 (98%)
 off sum (probability): 2 (2%)
 words to be learned/improved: 'turn', 'on', 'I', 'need', 'light', 

>>Bot: lamp is on


>>You: I need light

 known words:
 word on value off value
 'on' 101 2
 'off' 2 100
 'turn' 3 2
 'I' 3 2
 'need' 3 2
 'light' 3 2

 on sum (probability): 9 (60%)
 off sum (probability): 6 (40%)
 words to be learned/improved: 'I', 'need', 'light', 

>>Bot: lamp is on


>>You: turn off, I need darkness

 known words:
 word on value off value
 'on' 101 2
 'off' 2 100
 'turn' 3 2
 'I' 4 2
 'need' 4 2
 'light' 4 2

 on sum (probability): 13 (11%)
 off sum (probability): 106 (89%)
 words to be learned/improved: 'turn', 'off', 'I', 'need', 'darkness', 

>>Bot: lamp is off


>>You: I need darkness

 known words:
 word on value off value
 'on' 101 2
 'off' 2 101
 'turn' 3 3
 'I' 4 3
 'need' 4 3
 'light' 4 2
 'darkness' 2 3

 on sum (probability): 2 (40%)
 off sum (probability): 3 (60%)
 words to be learned/improved: 'I', 'need', 'darkness', 

>>Bot: lamp is off


Python example (including source code): bot_3_statistical

Run the “” – requires Python 3.x
and type: “on”

“” is just for unit-testing.

Reinforcement of wrong guessing

Sometimes the bot can make a wrong guess.

A button with the label “No! It’s not what I wanted” could be added, for the bot to either correct itself or be reviewed by a human.

YouTube, for example, uses an algorithm to evaluate videos. A video that does not fit its commercials will get demonetized (the creator won’t obtain payment from the ads).

The YouTube video creator can complain about this evaluation, and a YouTube employee will re-evaluate the video and improve the bot.

The problem is that bots sometimes make a lot of wrong guesses. A World of Warcraft channel on YouTube got five videos demonetized in a row. An YouTube employee reverted the demonetization, but the videos had already got most of their views and lost around 95 % of the revenue.


The bot could also get hijacked into wrong knowledge, by reverse engineering it’s learning algorithm. A ‘strange’ sentence like: “off darkness darken blinded on” will make the lamp turn “off”, but will also reinforce the meaning of the word “on” as an “off” word.

Do it enough times, and the word “on” will become neutral. Do it again, and the word “on” will become an “off” word.

The problem could be addressed by making the meaning of words “on” and “off” unchangeable, but this wouldn’t hinder other words from getting hijacked.

All words that become “on” or “off” words, could become unchangeable, but this won’t make neutral words resistant to hijacking.

A larger margin could be added for neutral words, before they become either an “on” or “off word, but then learning will slow down and maybe even come to a halt.

The learning algorithm could be obfuscated to hinder the reverse engineering. Adding complexity to a bot with only two outputs (“on” and “off”) is doable, but doing that to a bot with 100s or 1000s outputs will make your head hurt.

There are now multiple examples of this:

  • Microsoft had to pull the plug on it’s own chatbot, when it became racist
  • China had to pull the plug on its own chatbot, when it became critical of the Chinese government.
  • Pricing bots build on machine-learning, that by accident sold some of their products almost for free.
  • Chess bots that make a chess game be as long as possible, without the ability to win any of them (because its goal was set to “do not lose”)

Testing of cognitive bots

Wrong guesses and hijacking can be solved, by testing these bots properly. Testing can improve our bots with the correct context, as humans use it to filter new knowledge from bullshit – it’s not always accurate, but its better than no filtering.

For this we will need cognitive QA bots, which will try to hijack bots into all the extremes we can imagine. (But that topic is for the 4th stage of my “Cognition Bot Taxonomy”).

View the full “Cognition Bot Taxonomy”

Leave a Reply

Your email address will not be published.