480 likes | 498 Views
Stochastic Logic Programs. Stephen Muggleton. Outline. Stochastic automata Stochastic context free grammars Stochastic logic programs Stochastic SLD-refutations. Deterministic Automata. Stochastic Automata. Stochastic Automata. SA Probabilities.
E N D
Stochastic Logic Programs Stephen Muggleton
Outline • Stochastic automata • Stochastic context free grammars • Stochastic logic programs • Stochastic SLD-refutations
SA Probabilities • Stochastic automata represent probability distributions • Probability of accepting u in L(A)
SA Productions • Stochastic automata can be represented by labelled productions becomes
SA Productions • Stochastic automata can be represented by labelled productions becomes
Stochastic CFGs • Straightforward extension of SA • Probability of a string is the sum of probabilities of its derivations
Stochastic Logic Programs • Set of weighted range restricted definite clauses • Require for each predicate q, sum of weights for clauses with q in their head is 1.
SSLD-refutations • Analogous to stochastic CFG productions • A SSLD-refutation is a sequence: • Probability of is • Probability of an atom is where is an SLD refutation
Learning in SLPs • Structure and parameters learned simultaneously • Requires existing ILP framework
Derivation Overview • Generalisation Model • Optimal parameter choice • The general case • Two example case • Numerical solutions
Generalisation Model • Add clauses one at a time • Given SLP S and positive examples E, choose x:H such that:
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x to maximize the likelihood:
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x to maximize the likelihood:
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x to maximize the likelihood:
Optimal Parameter Choice • Since maximizing choose x such that • Derivative is messy, but since monotonicity preserves extrema we can maximize
General Derivation • Assuming S is non-recursive then has one of the forms: • c if p does not involve a q clause • cx if p involves x : H • c(1-x) if p involves a clause in q other than x : H
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x to maximize the likelihood:
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x to maximize the likelihood:
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x to maximize the likelihood:
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x to maximize the likelihood:
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x to maximize the likelihood:
General Derivation • Assuming S is non-recursive then has one of the forms: • c if p does not involve a q clause • cx if p involves x : H • c(1-x) if p involves a clause in q other than x : H
General Derivation • Assuming S is non-recursive then has one of the forms: • c if p does not involve a q clause • cx if p involves x : H • c(1-x) if p involves a clause in q other than x : H
General Derivation • Assuming S is non-recursive then has one of the forms: • c if p does not involve a q clause • cx if p involves x : H • c(1-x) if p involves a clause in q other than x : H
General Derivation • Assuming S is non-recursive then has one of the forms: • c if p does not involve a q clause • cx if p involves x : H • c(1-x) if p involves a clause in q other than x : H
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x to maximize the likelihood:
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x to maximize the likelihood:
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x to maximize the likelihood:
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x to maximize the likelihood:
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x to maximize the likelihood:
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x to maximize the likelihood:
Generalisation Model • If added to need to ensure weights sum to one. • Replace weight of each in by • Want to choose x such that:
Two Parameter Solution • Only two clauses, e1 and e2 • Then we can analytically derive:
Numerical Solutions • Analytical solutions for more clauses involve solving higher order polynomials • Exponentially many terms in polynomial • Numerical solutions a good idea • Use iteration method
Iteration Method • Transform g(x) = 0 into x = f(x) • Iterate: • Converges so long as x0 close to root
Iteration Method • In our case, use: