Learning Interpretable Models Expressed in Linear Temporal Logic - - PowerPoint PPT Presentation

learning interpretable models expressed in linear
SMART_READER_LITE
LIVE PREVIEW

Learning Interpretable Models Expressed in Linear Temporal Logic - - PowerPoint PPT Presentation

Learning Interpretable Models Expressed in Linear Temporal Logic Alberto Camacho 1 , 2 and Sheila McIlraith 1 , 2 1 Department of Computer Science, University of Toronto 2 Vector Institute { acamacho, sheila } @cs.toronto.edu ICAPS 2019 July 13,


slide-1
SLIDE 1

Learning Interpretable Models Expressed in Linear Temporal Logic

Alberto Camacho1,2 and Sheila McIlraith1,2

1 Department of Computer Science, University of Toronto 2 Vector Institute

{acamacho, sheila}@cs.toronto.edu

ICAPS 2019

July 13, 2019

slide-2
SLIDE 2

Linear Temporal Logic on Finite Traces (LTLf)

LTLf extends propositional logic with temporal operators: next: ϕ until: ψ U χ always: ϕ eventually: ♦ϕ release: ψ R χ It is useful to define: macro final to denote the end of trace: final := ¬ ⊤

  • perator weak next:

ϕ ≡ final ∨ ϕ We presume LTLf formulae are written in Negation Normal Form, where negations are pushed to the level of propositional formulae.

2 / 19

slide-3
SLIDE 3

Passive Learning from Positive and Negative Example Traces

Passive Learning Learn an LTLf formula that is consistent with a given set of positive (+) and negative (−) examples.

  • Examples are finite sequences of states
  • States are truth assignments to atomic propositions (represented as sets).

Examples + : {p} {p} {q} − : {p} {r} {q} + : {p} {q} − : {p} {r} − : {r} {q} − : {q, r} + : {p, r} {q} Passive Learner Model p U q

3 / 19

slide-4
SLIDE 4

Related Work

There exist related work in: Learning automata (e.g. L* (Angluin, 1987)) And very (very!) recent work in learning LTL: Neider and Gavran (2018) learns LTL temporal properties (interpreted over infinite traces) that are consistent with a given set of finite observation traces. Shah et al. (NeurIPS 2018), and Kim et al. (IJCAI 2019) adopted a non-exact, Bayesian approach to infer models in terms of behaviors encoded as LTL templates.

4 / 19

slide-5
SLIDE 5

Skeleton Templates for Alternating Finite Automata (AFA)

  • A tree expansion is accepting if all the leaf nodes are accepting.
  • An state trace e = e1 . . . eN satisfies ϕ iff Aϕ has an accepting tree expansion.

Aβ Aα

(a) Aα∧β

Aβ Aα

(b) Aα∨β

⊤ Aα

(c) Aα

⊤ Aα

(d) A

α

⊤ Aα

(e) Aα

Aβ Aα ⊤

(f) Aα U β

Aβ Aα ⊤

(g) Aα R β

⊤ Aα

(h) Aα

p

(i) Ap

⊤ q ⊤ ¬r p

(j) Ap∨(q U ¬r)

5 / 19

slide-6
SLIDE 6

Passive Learning of LTLf

Theorem

The following algorithm returns a minimal LTLf formula that is consistent with a set of positive and negative examples.

1: Fix the size of the formula to N = 1 2: Construct an AFA Aϕ with N skeletons that:

accepts all positive examples rejects all negative examples

3: If no AFA exists, increment N by one and go to 2. 4: Extract an LTLf formula ϕ from the structure of Aϕ. Return ϕ.

We use SAT to find Aϕ. Recall: SAT is the problem of finding an assignment to variables V such that a boolean formula holds true.

6 / 19

slide-7
SLIDE 7

Reduction to SAT

Skeletons s1, s2, . . . sN AFA is rooted at skeleton s1 Each skeleton is one of one type: SkType(s) := {AND(s), OR(s), NEXT(s), WNEXT(s), UNTIL(s), RELEASE(s), EVENTUALLY(s), ALWAYS(s), LIT(s)} Skeleton s has one associated skeleton subformula ‘alpha’ Skeleton s has one associated skeleton subformula ‘beta’ Skeleton s has one associated literal (used if LIT(s) holds) Clauses:

  • neOf(SkType(s))
  • neOf({A(s, s′) | s + 1 ≤ s′ < N})
  • neOf({B(s, s′′) | s + 1 < s′′ ≤ N})
  • neOf({L(s, v) | 1 ≤ v ≤ |V |} ∪ {L(s, −v) | 1 ≤ v ≤ |V |})

7 / 19

slide-8
SLIDE 8

Enforcing Acceptance of Positive Examples

Notation:

  • state trace example e
  • timestep t ∈ {1, . . . , |e|}
  • v ∈ V represent state variables.
  • skeleton index s ∈ {1, . . . N}

Clauses: For each positive example e and skeleton s:

  • RUN(e, 1, 1) has to hold.
  • Implication clauses for each LTLf operator.

Subformula Timestep Implication clauses for a positive example α ∧ β 1 ≤ t < |e| RUN(e, t, s′) ← RUN(e, t, s) ∧ AND(s) ∧ A(s, s′) RUN(e, t, s′′) ← RUN(e, t, s) ∧ AND(s) ∧ B(s, s′′) α 1 ≤ t < |e| RUN(e, t + 1, s) ← RUN(e, t, s) ∧ NEXT(s) ∧ A(s, s′) t = |e| ⊥ ← RUN(e, |e|, s) ∧ NEXT(s) ∧ A(s, s′)

8 / 19

slide-9
SLIDE 9

Enforcing Rejection of Negative Examples

How to enforce rejection of negative examples?

  • Naive way: enforce that all tree expansions are rejecting.

This may be problematic because the number of tree expansions can be massive.

  • Clever way: enforce some accepting tree expansion in the dual of the AFA

being learned.

9 / 19

slide-10
SLIDE 10

Dualizing an AFA Skeleton Structure

If Aϕ is an skeleton structure for LTLf formula ϕ, then Adual(ϕ) is an skeleton structure for LTLf formula ¬ϕ, where

dual(p) := ¬p, p ∈ AP dual(¬p) := p, p ∈ AP dual( α) := dual(α) dual(α) := dual(α) dual(α ∨ β) := dual(α) ∧ dual(β) dual(α ∧ β) := dual(α) ∨ dual(β) dual(α U β) := dual(α) R dual(β) dual(α R β) := dual(α) U dual(β)

In other words, Adual(ϕ) accepts the complement language of Aϕ.

10 / 19

slide-11
SLIDE 11

Enforcing Rejection of Negative Examples with Dualized Skeletons

Notation:

  • state trace example e
  • timestep t ∈ {1, . . . , |e|}
  • skeleton index s ∈ {1, . . . N}

If e is a negative example: RUN(e, t, s′) ← RUN(e, t, s) ∧ OR(s) ∧ A(s, s′) RUN(e, t, s′′) ← RUN(e, t, s) ∧ OR(s) ∧ B(s, s′′) And the dualization of skeletons that represent variables is:

If v ∈ e[t]: ⊥ ← RUN(e, t, s) ∧ LIT(s) ∧ L(s, v) If v ∈ e[t]: ⊥ ← RUN(e, t, s) ∧ LIT(s) ∧ L(s, ¬v)

11 / 19

slide-12
SLIDE 12

Active and Passive Learning

Examples + : {p} {p} {q} − : {p} {r} {q} + : {p} {q} − : {p} {r} − : {r} {q} − : {q, r} + : {p, r} {q} Passive Learner Model p U q

(a) Workflow of passive learning Oracle Active Learner

query response

(b) Interaction between the active learner and the oracle.

Passive Learning Learn an LTLf formula that is consistent with a given set of positive (+) and negative (−) examples. Active Learning Learn an LTLf formula from interaction with an oracle, by performing membership and equivalence queries.

12 / 19

slide-13
SLIDE 13

Sample complexity

LTLf to DFA is worst-case double exponential. Learning minimal DFA with N states needs a number of informative examples that is polynomial in N (cf. Angluin 1987). Question: How many examples do we need to learn a minimal LTLf formula?

Theorem

Active learning of an LTLf formula ϕ can be done with a number of queries exponential in the size of ϕ.

Theorem

Passive learning of an LTLf formula ϕ can be done with a number of informative examples exponential in the size of ϕ. We can offer exponentially smaller bounds on the number of examples.

13 / 19

slide-14
SLIDE 14

Practical Applications

Few-shot learning Behavior Classification Plan Intent and Recognition Reward Function Learning Knowledge Extraction LTL Mining

14 / 19

slide-15
SLIDE 15

Experiments

Number of positive (|E +|) and negative (|E −|) examples needed for active learning of each LTLf formula, and comparison with the number of characteristic samples (CS) that uniquely define minimal DFA with S states.

LTLf learning DFA Target |AP| |E +| |E −| Time || S → p 3 1 4 0.3 40 4 32 p ∧ q 3 2 5 0.5 29 4 32 (p ∧ q) 3 5 5 0.4 42 4 32 (p ∧ q) 3 5 6 0.4 29 4 32 p U q 3 3 4 0.2 22 3 24 p R q 3 3 3 0.3 22 3 24

15 / 19

slide-16
SLIDE 16

Active Learning

100 102

Run Time (s)

2 3 4 5 6 7 8 9 10 11

Formula Size

20

# Examples

Figure: Run time (top) and number of examples needed (bottom) to learn a variety of LTLf formulas of different size.

16 / 19

slide-17
SLIDE 17

Behavior Classification

4 different behaviours in the Openstacks planning benchmark. 1000 plans generated per behavior (using Top-k planner). Can we learn LTLf formulae that discriminate between behaviours (K examples per behavior)? e.g. ((not (shipped o5))) U(((stacks avail n4)))

1 2 3 4 5 6 7 8 9 10

K

0.00 0.25 0.50 0.75 1.00

Accuracy

1 2 3 4 5 6 7 8 9 10

K

0.00 0.25 0.50 0.75 1.00

Precision

1 2 3 4 5 6 7 8 9 10

K

0.00 0.25 0.50 0.75 1.00

Recall

LTLf learning via SAT takes 0.1 seconds In contrast, deep learning LSTM time series classification (Karim et al 2018) takes 16 seconds.

17 / 19

slide-18
SLIDE 18

Conclusions

Novel mechanism to do passive and active learning of LTLf formulae Exploiting duality of the AFA to learn from negative examples Exponential bounds on the number of examples (exponentially lower than with DFA) Identification of applications

18 / 19

slide-19
SLIDE 19

Thank you. Questions?

19 / 19