Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin...

15
Predictive Texting Predictive Texting C S Inside... Computer Science Computer Science Inside… Inside… Predictive Text Messaging Predictive Text Messaging and and Machine Learning Machine Learning Quintin Cutts, Margaret Brown Quintin Cutts, Margaret Brown University of Glasgow University of Glasgow

Transcript of Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin...

Page 1: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

Computer Science Computer Science Inside…Inside…

Predictive Text MessagingPredictive Text Messagingandand

Machine LearningMachine Learning

Quintin Cutts, Margaret BrownQuintin Cutts, Margaret Brown

University of GlasgowUniversity of Glasgow

Page 2: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

How many of you own mobile How many of you own mobile phones?phones?

• What do you use your mobile phone for?What do you use your mobile phone for?

• How many text messages do you send in How many text messages do you send in a day?a day?

• How long does it take you to send a text?How long does it take you to send a text?• Is there anything difficult about sending texts?Is there anything difficult about sending texts?

Page 3: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

Who has used Predictive Who has used Predictive Texting?Texting?

• Does it speed up your texting?Does it speed up your texting?

• HelloHello– Non-predictiveNon-predictive

4433555 <pause> 555666 4433555 <pause> 555666 – PredictivePredictive

4355643556

• Is it good/ bad then?Is it good/ bad then?

1

ABC

2

JKL

5

DEF

3

GHI

4

MNO

6

PQRS

7TUV

8

WXYZ

9 _

0

.

Page 4: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

Predictive Text Predictive Text Messaging…Messaging…

• Does it always offer you the word you want?Does it always offer you the word you want?

• What do you notice when you get a new What do you notice when you get a new phone?phone?

• You have to tell it words e.g. namesYou have to tell it words e.g. names• You teach it!You teach it!

• Does it get better?Does it get better?• It should learn the words that you use most oftenIt should learn the words that you use most often• and so offer you and so offer you betterbetter words over time words over time

Page 5: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

How does it work??How does it work??

• Any ideas how the system Any ideas how the system (phone/computer/etc) might learn from the (phone/computer/etc) might learn from the user?user?

• We are going to look at how it might do that:We are going to look at how it might do that:– You are going to pretend to be users and predictive You are going to pretend to be users and predictive

text systems and experience how they work!text systems and experience how they work!

User User typing in typing in the txtthe txt

Predictive test Predictive test system system interpreting interpreting key presses, offering key presses, offering wordswords

Page 6: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

Setting up the SystemSetting up the System• Get into pairsGet into pairs• Each get a mobile phone texting Each get a mobile phone texting dictionarydictionary

– Contains mappings:Contains mappings:• from keypad codesfrom keypad codes• to possible words with that codingto possible words with that coding

– and a frequency column:and a frequency column:• so we can record how often that word's been so we can record how often that word's been

requested, by keeping a tallyrequested, by keeping a tally

CodeCode WordWord FrequencyFrequency

2253722537 ablerablerbakerbakerbakesbakesbalerbalerbalesbalescakescakes

Page 7: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

An example firstAn example first

• In this run, I'll be the user, and In this run, I'll be the user, and you'll all be the predictive text you'll all be the predictive text systemsystem– have your dictionaries at the readyhave your dictionaries at the ready

• I'll read out codes to you, and I'll read out codes to you, and explain how to operate the explain how to operate the dictionary…dictionary…

Page 8: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

Setting up the messagesSetting up the messages• You will each be given two text messages to sendYou will each be given two text messages to send

– don't show them to your partnerdon't show them to your partner

• Task 1: encode the words of the 2 messages into button Task 1: encode the words of the 2 messages into button pressespresses

– DO NOT DO ANYTHING TO THE CODED MESSAGEDO NOT DO ANYTHING TO THE CODED MESSAGE– you have the keypad to help youyou have the keypad to help you

– 'a' or 'b' or 'c' => 2'a' or 'b' or 'c' => 2– 'd' or 'e' or 'f' => 3'd' or 'e' or 'f' => 3– ……– Hence “bad” => 223Hence “bad” => 223

Page 9: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

Acting as phone user and Acting as phone user and predictive text systempredictive text system

• In your pairIn your pair– one'll be user and the other the pred. text systemone'll be user and the other the pred. text system– and then you'll swap roundand then you'll swap round

• As a userAs a user– you have some messages to sendyou have some messages to send

• As the predictive text systemAs the predictive text system– you have you have your ownyour own dictionary, which will record all dictionary, which will record all

words seen, and how often they're usedwords seen, and how often they're used

• Decide who will be user, who pred. text system Decide who will be user, who pred. text system first…first…

Page 10: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

Each user send the txts using their new Each user send the txts using their new mobilemobile

• UserUser– send 1send 1stst word of 1 word of 1stst message to the text system message to the text system– do this by saying the numbers aloud to the text systemdo this by saying the numbers aloud to the text system

• Text system Text system – use table to decide which word to offer the useruse table to decide which word to offer the user– pick the word with the pick the word with the highest frequencyhighest frequency (if all the same, pick top one) (if all the same, pick top one)– tell the user the wordtell the user the word– if no entry present for that code, add a new entryif no entry present for that code, add a new entry

• UserUser– if the word offered is correct, tell the system so, and move on to the next if the word offered is correct, tell the system so, and move on to the next

word/codeword/code– if word not correct, tell the system soif word not correct, tell the system so

• Text systemText system– If word offered is correct, add a bar (5-bar gates) to frequency for that wordIf word offered is correct, add a bar (5-bar gates) to frequency for that word– If the word offered is incorrect, continue offering words until it’s correct. If the word offered is incorrect, continue offering words until it’s correct.

Remember to update table when correct word found.Remember to update table when correct word found.– If all offered words are incorrect, add a new entryIf all offered words are incorrect, add a new entry

• Continue untilContinue until– all words in the txt are translatedall words in the txt are translated

Page 11: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

Activity 1 – run the Activity 1 – run the system…system…

• Try two sentences each and see how you Try two sentences each and see how you gogo

– i.e swap roles between user and text systemi.e swap roles between user and text system

• User try and work out if the system is getting User try and work out if the system is getting better at knowing which word to offer youbetter at knowing which word to offer you

• Think about why this might be?Think about why this might be?

Page 12: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

Activity 2 – What has been Activity 2 – What has been learned?learned?

• The final text is coded already The final text is coded already – and is the same for both of youand is the same for both of you

• Read the codes to your partnerRead the codes to your partner– Write down the first responseWrite down the first response

• i.e. text systems – go for the most popular, or the i.e. text systems – go for the most popular, or the first of a group of some of equal popularityfirst of a group of some of equal popularity

• What sentence do you each get?What sentence do you each get?

Page 13: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

What did you discover?What did you discover?

• How frustrating/annoying/ time consuming was How frustrating/annoying/ time consuming was this task for the user?this task for the user?

• What was hard about being the predictive text What was hard about being the predictive text system?system?

• Did the system get better at making Did the system get better at making predictions?predictions?– Why? Why not?Why? Why not?– What was the important step in getting better or not?What was the important step in getting better or not?

Page 14: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

Learning…?Learning…?• How is the system trying to learn?How is the system trying to learn?

– It learned which words the user used most by counting It learned which words the user used most by counting the frequency. It can then offer the user the most the frequency. It can then offer the user the most popular words firstpopular words first

– The system adapts to the user - it learns!!The system adapts to the user - it learns!!

• Why is it not very good?!Why is it not very good?!

• Why do some phones not include a learning Why do some phones not include a learning capacity?capacity?

• Why do we need machines to learn?Why do we need machines to learn?– So they can adapt to their environmentSo they can adapt to their environment– New knowledge does not mean complete redesignNew knowledge does not mean complete redesign– So it can learn from human activitySo it can learn from human activity

Page 15: Predictive Texting Computer Science Inside… Predictive Text Messaging and Machine Learning Quintin Cutts, Margaret Brown University of Glasgow.

Predictive TextingPredictive TextingCSInside...CSInside...

ConclusionConclusion• This is a large area of Computing ScienceThis is a large area of Computing Science

– Artificial Intelligence deals with intelligent behaviour, Artificial Intelligence deals with intelligent behaviour, learning and adaptive behaviour in machineslearning and adaptive behaviour in machines

– It is a very challenging and important area of the disciplineIt is a very challenging and important area of the discipline

• What other applications of AI and machine learning What other applications of AI and machine learning are there?are there?– Can you guess what the artificial intelligence in the Can you guess what the artificial intelligence in the

following applications might be:following applications might be:» Speech RecognitionSpeech Recognition» Game playingGame playing» Computer VisionComputer Vision» Expert SystemsExpert Systems» RobotsRobots» Genetic ProgrammingGenetic Programming» Any others you can think of…?Any others you can think of…?