Download as pdf or txt
Download as pdf or txt
You are on page 1of 30

Data Science

Survival Skills

Telegram & Co. - being responsive


Agenda
● Bots
● Natural-Language-Processing
● Bot interaction
What are bots?
● Provide automated services
● Use websites or messaging apps
● Able to respond to text message and voice
● Provide answers in real time - as voice or text
Roots in psychology
1966: ELIZA

Joseph Weizenbaum
(German-American psychologist) He tried to prove: machines cannot replace
humans in conversation.
He proved himself wrong. → paved the path for bots
Person-centered therapy

The person-centred counsellor PERFECT ROLE FOR BOT!


is not an expert; rather the
client is seen as an expert on ● Not emotionally invested
themselves and the ● Can respond with patience
person-centred counsellor ● It is able to (passively/actively) listen
● Does not need to provide solutions
encourages the client to
explore and understand
themselves and their troubles. Rather:

→ The therapist listens empathically and without Person: “I am sad”


judgment. The therapist’s only role is to encourage Bot: “Why are you sad”
and support the patient—with no interruptions or → similar to Rogerian Therapy
interferences.
From ELIZA to PARRY
Invented by Kenneth Colby:
PARRY models a schizophrenic paranoid patient → training purposes

ELIZA took PARRY as patient.

https://datatracker.ietf.org/doc/html/rfc439
What can we program this bot to do?
● Dr. Sbaitso (1992)
● Artificial Linguistic Internet Computer Entity (A.L.I.C.E.), 1995
→ AIML (AI Markup Language for Chatbots), Program O or AB understands it
● Jabberwacky, 1997
● SmarterChild, 2000
● Siri, 2011
If you build it, they will chat
● Can be used for telemedicine
● Sales (e.g. shoes. What is your shoe size? Favourite brand/color? Preferences? …)
● Human resources
● Legal advice…

Main target: Messaging Apps

→ are as of now more often used than any other social network!!
How do chatbots work?
Simple bots; aka easy to build:
“Tell me the weather”

● Reads your location


● Request data from weather service
● Reports current weather/temperature
More difficult bot
Sales: “How can I help you”

I look for pants

B: For a man or woman?

For a woman

B: What size and color?

Pants <-> trousers, etc. → bots need Learning capabilities!


Natural Language Processing
Normal coding:

Python, PHP, Ruby on Rails → specific language with error prone syntax/grammar

Real life:

Plenty of grammar errors etc. - but with structure and context it creates meaning.
Highly dynamic process.
NLP
Interaction of machines and human language

● Symbolic NLP (50s - 90s) → Georgetown-IBM experiment, ELIZA


● Stochastic NLP (90s - 2010s) → No handwritten rules, (un)supervised learning
● Neural NLP (2010s and ongoing) → representation learning, deep neural networks
NLP - Overall tasks
● Content categorization (search, indices, plagiarism)
● Topic understanding and modelling (optimization, prognosis)
● Context extraction (structur generation)
● Sentiment Analysis (mood extraction, subjective opinions, opinion mining)
● Speech-to-text and text-to-Speech
● Summary generation
● Machine Translation (e.g. French to German)
Translation
Word embeddings
Encoder-decoder
Attention

https://deepmind.com/blog/article/wavenet-generative-model-raw-audio
Attention
Transformer architectures

Q: Query
K: Keys
V: Values
Where does the sequence come from?
Positional encoding
Waste of useful resources…
Position Embeddings
Very fancy
● GPT-3
● BERT

https://openai.com/blog/dall-e /
NLP - unstructured to structured

From wit.ai
Bots and fake news - Social bots
● “Behave” like “real” people
● Give likes, dislikes, retweet, subscribe, comment…
● Too easy to create too real profiles
● And bots become more and more genuine
Bots in messaging apps
● Facebook
● WhatsApp
● Telegram
● Kik
● WeChat
● Viber
● LINE
● Slack

Slack → Common bot is for Github (commit,


push, pull request, …)
Frameworks
Give your bot a home
The last slide
● The idea of bots is old
● People love bots
● Natural language processing is hyped
Exercise
Description of the exercise
In this exercise, you will create a Telegram bot that sends messages using Tensorflow
callbacks.

Your tasks are:

● Create the Telegram bot.

● Create a callback capable of:


○ Notifying when a CNN is learning.
○ Sending messages showing partial results.
○ Stopping the training process when asked by the user.
○ Sending test results.

You might also like