Command line completion (CLC) an illustration of learning and - - PowerPoint PPT Presentation

command line completion clc
SMART_READER_LITE
LIVE PREVIEW

Command line completion (CLC) an illustration of learning and - - PowerPoint PPT Presentation

Command line completion (CLC) an illustration of learning and decision making using the imprecise Dirichlet model Erik Quaeghebeur p. 1/15 Classical CLC in action login: erik Password: Last login: Tue Feb 17 08:24:47 on tty1


slide-1
SLIDE 1

Command line completion (CLC)

an illustration of learning and decision making using the imprecise Dirichlet model

Erik Quaeghebeur

– p. 1/15

slide-2
SLIDE 2

Classical CLC in action

login: erik Password: Last login: Tue Feb 17 08:24:47 on tty1 command-prompt$ _

– p. 2/15

slide-3
SLIDE 3

Classical CLC in action

login: erik Password: Last login: Tue Feb 17 08:24:47 on tty1 command-prompt$ log<TAB> logger login logname logout command-prompt$ log_

– p. 2/15

slide-4
SLIDE 4

Classical CLC in action

login: erik Password: Last login: Tue Feb 17 08:24:47 on tty1 command-prompt$ log<TAB> logger login logname logout command-prompt$ logn<TAB> command-prompt$ logname <ENTER> erik command-prompt$ _

– p. 2/15

slide-5
SLIDE 5

Classical CLC in action

login: erik Password: Last login: Tue Feb 17 08:24:47 on tty1 command-prompt$ log<TAB> logger login logname logout command-prompt$ logn<TAB> command-prompt$ logname <ENTER> erik command-prompt$ ls<ENTER> mail/ logic.dvi logic.tex command-prompt$ _

– p. 2/15

slide-6
SLIDE 6

Classical CLC in action

login: erik Password: Last login: Tue Feb 17 08:24:47 on tty1 command-prompt$ log<TAB> logger login logname logout command-prompt$ logn<TAB> command-prompt$ logname <ENTER> erik command-prompt$ ls<ENTER> mail/ logic.dvi logic.tex command-prompt$ dvips log_

– p. 2/15

slide-7
SLIDE 7

Classical CLC in action

login: erik Password: Last login: Tue Feb 17 08:24:47 on tty1 command-prompt$ log<TAB> logger login logname logout command-prompt$ logn<TAB> command-prompt$ logname <ENTER> erik command-prompt$ ls<ENTER> mail/ logic.dvi logic.tex command-prompt$ dvips log<TAB> logic.dvi logic.tex command-prompt$ dvips logic.d<TAB> command-prompt$ dvips logic.dvi _

– p. 2/15

slide-8
SLIDE 8

Properties of classical CLC

Two completion action types: list the possible completions, or return the unique completion.

– p. 3/15

slide-9
SLIDE 9

Properties of classical CLC

Two completion action types: list the possible completions, or return the unique completion. Rule-based: allows for context dependency, and requires a categorized database of commands.

– p. 3/15

slide-10
SLIDE 10

Properties of classical CLC

Two completion action types: list the possible completions, or return the unique completion. Rule-based: allows for context dependency, and requires a categorized database of commands. User independent: reliable, but does not take command history into account.

– p. 3/15

slide-11
SLIDE 11

Complementing classical CLC

We want to take the command-history into account: Whenever there are multiple completions possible.

– p. 4/15

slide-12
SLIDE 12

Complementing classical CLC

We want to take the command-history into account: Whenever there are multiple completions possible. By building and updating a model for the user’s behavior.

– p. 4/15

slide-13
SLIDE 13

Complementing classical CLC

We want to take the command-history into account: Whenever there are multiple completions possible. By building and updating a model for the user’s behavior. To add completion action types, such as returning the ‘best guess’ completion on the command line, listing a set of ‘best guesses’, listing all possible completions, but ordered.

– p. 4/15

slide-14
SLIDE 14

The set of possible completions

Two illustrative completions: command-prompt$ ha<TAB> halt hash command-prompt$ pin<TAB> pine ping pinky

– p. 5/15

slide-15
SLIDE 15

The set of possible completions

Two illustrative completions: command-prompt$ ha<TAB> halt hash

⇒ Ωha = {halt, hash} ∋ ωha command-prompt$ pin<TAB> pine ping pinky ⇒ Ωpin = {pine, ping, pinky} ∋ ωpin

– p. 5/15

slide-16
SLIDE 16

The user as a multinomial process

Model of the user’s behavior: A priori, there is a fixed probability tcommand for every command.

b b b b

– p. 6/15

slide-17
SLIDE 17

The user as a multinomial process

Model of the user’s behavior: A priori, there is a fixed probability tcommand for every command. After typing part of a command, the remaining possible completions are chosen with the corresponding conditional probabilities.

b b b b

– p. 6/15

slide-18
SLIDE 18

The user as a multinomial process

Model of the user’s behavior: A priori, there is a fixed probability tcommand for every command. After typing part of a command, the remaining possible completions are chosen with the corresponding conditional probabilities. Graphical representation of a user: halt hash

b

(thalt, thash) = (1

4, 3 4)

∆ha

b b b b

– p. 6/15

slide-19
SLIDE 19

The user as a multinomial process

Model of the user’s behavior: A priori, there is a fixed probability tcommand for every command. After typing part of a command, the remaining possible completions are chosen with the corresponding conditional probabilities. Graphical representation of a user:

b b b

pine ping pinky

b

(tpine, tping, tpinky) = (1

3, 1 3, 1 3)

∆pin

– p. 6/15

slide-20
SLIDE 20

The user as a Markov process

Model of the user’s behavior: A priori, there is a fixed probability tcommand|previous for every command and every previously typed command.

b b b b b b b b

– p. 7/15

slide-21
SLIDE 21

The user as a Markov process

Model of the user’s behavior: A priori, there is a fixed probability tcommand|previous for every command and every previously typed command. After typing part of a command, the remaining possible completions are chosen with the corresponding conditional probabilities for the previous command.

b b b b b b b b

– p. 7/15

slide-22
SLIDE 22

The user as a Markov process

Model of the user’s behavior: A priori, there is a fixed probability tcommand|previous for every command and every previously typed command. After typing part of a command, the remaining possible completions are chosen with the corresponding conditional probabilities for the previous command. Graphical representation of a user:

b b b b

∆pin|halt

b b b b

∆pin|hash

– p. 7/15

slide-23
SLIDE 23

Knowledge about the user’s behavior

Three models: An exact model: tcommand is known for all commands.

– p. 8/15

slide-24
SLIDE 24

Knowledge about the user’s behavior

Three models: An exact model: tcommand is known for all commands. A precise Dirichlet model (PDM): the uncertainty about the exact model is determined by a Dirichlet distribution. halt hash

Di( ϑ | h, t)

– p. 8/15

slide-25
SLIDE 25

Knowledge about the user’s behavior

Three models: An exact model: tcommand is known for all commands. A precise Dirichlet model (PDM): the uncertainty about the exact model is determined by a Dirichlet distribution. halt hash

Di( ϑ | h, t)

r

  • t = PDi(

ϑ | h, t) PDi(X | h, t) =

  • ∆ha X(

ϑ)Di( ϑ | h, t)d ϑ

– p. 8/15

slide-26
SLIDE 26

Knowledge about the user’s behavior

Three models: An exact model: tcommand is known for all commands. An imprecise Dirichlet model (IDM): the uncertainty is determined by a set of Dirichlet distributions. halt hash

– p. 8/15

slide-27
SLIDE 27

Knowledge about the user’s behavior

Three models: An exact model: tcommand is known for all commands. An imprecise Dirichlet model (IDM): the uncertainty is determined by a set of Dirichlet distributions. halt hash

T

| |

  • t = P(

ϑ | h, T)

  • t = P(

ϑ | h, T) P Di(X | h, T) = inf

t∈T PDi(X | h,

t) P Di(X | h, T) = sup

t∈T PDi(X | h,

t)

– p. 8/15

slide-28
SLIDE 28

Observations, Sufficient statistics, and . . .

Observations: (a sequence of) executed commands for the multinomial model, or (a sequence of) consecutively executed commands for the Markov model.

– p. 9/15

slide-29
SLIDE 29

Observations, Sufficient statistics, and . . .

Observations: (a sequence of) executed commands for the multinomial model, or (a sequence of) consecutively executed commands for the Markov model. Keep what’s relevant for the model: sufficient statistic, the number of occurrences of the commands

n, or

the number of occurrences of a transition between commands N.

– p. 9/15

slide-30
SLIDE 30

. . . Likelihood functions

Likelihood function: likelihood of an exact model given the observations, a multinomial distribution L

n(

ϑ), or

a Whittle distribution LN(Θ), proportional to the product of the L

n(

ϑ) for each of the previous

commands.

– p. 10/15

slide-31
SLIDE 31

Learning using a PDM/IDM

Updating a Dirichlet distribution using Bayes’ rule:

f( ϑ | h, t, n) = Di(

  • ϑ | h,

t)L

n(

ϑ) P(L

n | h,

t) = Di(

  • ϑ | hn = h + n,

tn = h t + n h + n).

– p. 11/15

slide-32
SLIDE 32

Learning using a PDM/IDM

Updating a Dirichlet distribution using Bayes’ rule:

f( ϑ | h, t, n) = Di(

  • ϑ | h,

t)L

n(

ϑ) P(L

n | h,

t) = Di(

  • ϑ | hn = h + n,

tn = h t + n h + n).

Graphically: halt hash prior posterior

  • bserved

– p. 11/15

slide-33
SLIDE 33

Learning using a PDM/IDM

Updating a PDM is updating the underlying distribution:

P(X | h, t)

  • n

− → P(X | hn, tn).

– p. 11/15

slide-34
SLIDE 34

Learning using a PDM/IDM

Updating a PDM is updating the underlying distribution:

P(X | h, t)

  • n

− → P(X | hn, tn).

Graphically:

b b b

pine ping pinky

  • bserved

r

  • t

r

  • tn

– p. 11/15

slide-35
SLIDE 35

Learning using a PDM/IDM

Updating an IDM comes down to updating the corresponding (set of) PDM’s:

P(X | hn, Tn) = inf{P(X | hn, tn) | hn = h + n, tn = h t + n h + n , t ∈ T}.

– p. 11/15

slide-36
SLIDE 36

Learning using a PDM/IDM

Updating an IDM comes down to updating the corresponding (set of) PDM’s:

P(X | hn, Tn) = inf{P(X | hn, tn) | hn = h + n, tn = h t + n h + n , t ∈ T}.

Graphically:

b b b

pine ping pinky

  • bserved

T

– p. 11/15

slide-37
SLIDE 37

Learning using a PDM/IDM

Updating an IDM comes down to updating the corresponding (set of) PDM’s:

P(X | hn, Tn) = inf{P(X | hn, tn) | hn = h + n, tn = h t + n h + n , t ∈ T}.

Graphically:

b b b

pine ping pinky

  • bserved

T Tn

– p. 11/15

slide-38
SLIDE 38

Actions and (expected) utility

Each completion action has a certain utility for the user (part of the model of the user). Let a gamble Xa correspond to each action a.

– p. 12/15

slide-39
SLIDE 39

Actions and (expected) utility

Each completion action has a certain utility for the user (part of the model of the user). Let a gamble Xa correspond to each action a. The expected utility of an action: when a PDM is used: P(Xa | h,

t),

when an IDM is used: P(Xa | h, T) and P(Xa | h, T).

– p. 12/15

slide-40
SLIDE 40

Actions and (expected) utility

Each completion action has a certain utility for the user (part of the model of the user). Let a gamble Xa correspond to each action a. The expected utility of an action: when a PDM is used: P(Xa | h,

t),

when an IDM is used: P(Xa | h, T) and P(Xa | h, T). Choosing one action instead of another also has an expected utility. This is the prevision of the difference of the corresponding gambles (P(Xa − Xb) or P(Xa − Xb)).

– p. 12/15

slide-41
SLIDE 41

Decision making: choosing an action

Ordering the actions based on the expected utility of choosing one action over the other.

– p. 13/15

slide-42
SLIDE 42

Decision making: choosing an action

Ordering the actions based on the expected utility of choosing one action over the other. When using a PDM: compare the actions:

a ≻ b ⇐ ⇒ P(Xa − Xb) > 0 ⇐ ⇒ P(Xa) > P(Xb),

create an ordering of the actions, identify the maximal action(s)

a is maximal ⇐ ⇒ ∀b : P(Xa) ≥ P(Xb).

– p. 13/15

slide-43
SLIDE 43

Decision making: choosing an action

Ordering the actions based on the expected utility of choosing one action over the other. PDM: complete ordering of actions.

– p. 13/15

slide-44
SLIDE 44

Decision making: choosing an action

Ordering the actions based on the expected utility of choosing one action over the other. PDM: complete ordering of actions. When using an IDM: compare the actions:

a ≻ b ⇐ ⇒ P(Xa − Xb) > 0 ⇐ ⇒ P(Xb − Xa) < 0,

create an ordering of the actions, identify the maximal action(s):

a is maximal ⇐ ⇒ ∀b : P(Xa − Xb) ≥ 0.

– p. 13/15

slide-45
SLIDE 45

Decision making: choosing an action

Ordering the actions based on the expected utility of choosing one action over the other. PDM: complete ordering of actions. IDM: partial ordering of actions.

– p. 13/15

slide-46
SLIDE 46

Choosing an action

Choosing the maximal action: Is there a unique maximal action? If there is a unique maximal action: choose it (e.g., returning a completion).

– p. 14/15

slide-47
SLIDE 47

Choosing an action

Choosing the maximal action: Is there a unique maximal action? If there is a unique maximal action: choose it (e.g., returning a completion). The need for a default action: Whenever there isn’t a maximal action, then choose this action (e.g., list the actions according to the ordering).

– p. 14/15

slide-48
SLIDE 48

IDM-CLC in action

login: erik Password: Last login: Wed Feb 18 09:25:48 on tty2 command-prompt$ _

– p. 15/15

slide-49
SLIDE 49

IDM-CLC in action

login: erik Password: Last login: Wed Feb 18 09:25:48 on tty2 command-prompt$ pin<TAB> pine pinky m ping command-prompt$ pin_

– p. 15/15

slide-50
SLIDE 50

IDM-CLC in action

login: erik Password: Last login: Wed Feb 18 09:25:48 on tty2 command-prompt$ pin<TAB> pine pinky m ping command-prompt$ pinky<ENTER> erik, logged on since Wed Feb 18 12:13:38 command-prompt$ _

– p. 15/15

slide-51
SLIDE 51

IDM-CLC in action

login: erik Password: Last login: Wed Feb 18 09:25:48 on tty2 command-prompt$ pin<TAB> pine pinky m ping command-prompt$ pinky<ENTER> erik, logged on since Wed Feb 18 12:13:38 command-prompt$ pin<TAB> command-prompt$ pinky _

– p. 15/15

slide-52
SLIDE 52

IDM-CLC in action

login: erik Password: Last login: Wed Feb 18 09:25:48 on tty2 command-prompt$ pin<TAB> pine pinky m ping command-prompt$ pinky<ENTER> erik, logged on since Wed Feb 18 12:13:38 command-prompt$ pin<TAB> command-prompt$ hash<ENTER> ...[some text] ... command-prompt$ _

– p. 15/15

slide-53
SLIDE 53

IDM-CLC in action

login: erik Password: Last login: Wed Feb 18 09:25:48 on tty2 command-prompt$ pin<TAB> pine pinky m ping command-prompt$ pinky<ENTER> erik, logged on since Wed Feb 18 12:13:38 command-prompt$ pin<TAB> command-prompt$ hash<ENTER> ...[some text] ... command-prompt$ pin<TAB> ping pine m pinky command-prompt$ pin_

– p. 15/15