Upload
ginger-floyd
View
213
Download
0
Embed Size (px)
Citation preview
Music AI Music AI Lecture 3 Lecture 3
More on Knowledge More on Knowledge Representation (anaparastasi Representation (anaparastasi
gnosis) gnosis)
Introduction to searching Introduction to searching (anazitisi) (anazitisi)
Overview Overview
Forwards and backwards deduction Forwards and backwards deduction More on Semantic nets More on Semantic nets Frames and scripts Frames and scripts Grammars and syntactic trees in NLP Grammars and syntactic trees in NLP Break Break Introduction to searching Introduction to searching Exercises Exercises Reading for next week Reading for next week
Forwards deduction Forwards deduction
Knowledge base: Knowledge base: Mary coughs. Mary coughs. Mary has temperature. Mary has temperature. Mary and John are together. Mary and John are together. Is someone coughs and has temperature, then he has Is someone coughs and has temperature, then he has
a cold. a cold. If someone is together with someone else, then the If someone is together with someone else, then the
someone else is together with the someone. (?!) someone else is together with the someone. (?!) If someone has a cold and is together with someone If someone has a cold and is together with someone
else, then this someone else also has a cold. else, then this someone else also has a cold. Task 1:Task 1: Translate the above into a KR formalism. Translate the above into a KR formalism.
Forwards deduction Forwards deduction
Knowledge base: Knowledge base: coughs(mary). coughs(mary).
has_temperature(mary). has_temperature(mary).
together(mary,john). together(mary,john).
coughs(X) ^ has_temperature(X) coughs(X) ^ has_temperature(X) hascold(X) hascold(X)
together(Plato, Socrates) together(Plato, Socrates) together(Socrates,Plato) together(Socrates,Plato)
hascold(A) ^ together(B,A) hascold(A) ^ together(B,A) hascold(B) hascold(B) Task 2: Prove that John has a cold Task 2: Prove that John has a cold
Forwards deduction: Forwards deduction:
write here the correct answerwrite here the correct answer
Tips for deductions: Tips for deductions:
In predicate unification, make sure the In predicate unification, make sure the names of predicates match exactly. names of predicates match exactly.
You don’t have to use all the facts and rules You don’t have to use all the facts and rules in the knowledge base to prove something. in the knowledge base to prove something.
Don’t get confused with variable names. Don’t get confused with variable names. Variables start with a capital, and if they are Variables start with a capital, and if they are confusing, substitute them with X,Y etc. confusing, substitute them with X,Y etc.
If you are unsure, write down what you want If you are unsure, write down what you want to say in English. Then translate it into to say in English. Then translate it into predicate logic notation. predicate logic notation.
Backwards deduction Backwards deduction Knowledge base:Knowledge base: coughs(mary). coughs(mary). has_temperature(mary). has_temperature(mary). together(mary,john). together(mary,john). coughs(X) ^ has_temperature(X) coughs(X) ^ has_temperature(X) hascold(X). hascold(X). together(Plato, Socrates) together(Plato, Socrates) together(Socrates,Plato). together(Socrates,Plato). hascold(A) ^ together(B,A) hascold(A) ^ together(B,A) hascold(B). hascold(B). goes_swimming(Snoopy) goes_swimming(Snoopy) hascold(Snoopy). hascold(Snoopy). hascold(Beast) ^ together (Beauty, Beast) hascold(Beast) ^ together (Beauty, Beast)
takes_care(Beauty, takes_care(Beauty, Beast). Beast).
hascold(Cold) ^ drinks_from_same_glass(Hot, Cold) hascold(Cold) ^ drinks_from_same_glass(Hot, Cold) hascold(Hot). hascold(Hot).
weather(freezing) weather(freezing) hascold(House). hascold(House). hastemperature(mary) hastemperature(mary) says_nonsense(mary). says_nonsense(mary). (What is the problem with the last rule?) (What is the problem with the last rule?)
Backwards deduction Backwards deduction
Task: Using the above KB, prove that Task: Using the above KB, prove that John has a cold. In doing that, show John has a cold. In doing that, show all the options of rules and where all the options of rules and where they lead to. they lead to.
Backwards deduction: Backwards deduction:
Write down the answer hereWrite down the answer here
Semantic Networks, frames and Semantic Networks, frames and scripts scripts
Task Task
In groups, think of a different example In groups, think of a different example of a frame, and of a script. Write it of a frame, and of a script. Write it out into some detail. out into some detail.
Syntactic rules so far: Syntactic rules so far:
s s np, vp. np, vp. np np det, n. det, n. np np n. n. vp vp v. v. vp vp v, np. v, np.
Task: Draw the syntactic tree: Task: Draw the syntactic tree:
The baby cries. The baby cries.
Obelix ate the Roman. Obelix ate the Roman.
Ungrammatical sentences : Ungrammatical sentences :
A sentence that cannot be explained with A sentence that cannot be explained with our grammar is our grammar is UngrammaticalUngrammatical. .
Which of the following are ungrammatical? Which of the following are ungrammatical? • I am reading. I am reading. • Tarzan kissed Jane in the rain. Tarzan kissed Jane in the rain. • I hate Mondays. I hate Mondays. • A dictionary of philosophy. A dictionary of philosophy. • Sing! Sing! • The book is on the shelf. The book is on the shelf. • Chris wears glasses. Chris wears glasses.
Searching (anazitisi) Searching (anazitisi)
Lets play tic tac toe (triliza) ... Lets play tic tac toe (triliza) ... What is a What is a search spacesearch space? (xwros anazitisis) ? (xwros anazitisis) What is a What is a search treesearch tree? (dentro) ? (dentro) What is a What is a search strategysearch strategy? (stratigiki) ? (stratigiki) What is What is depth first search (DFS)depth first search (DFS)? (kata vathos) ? (kata vathos) What is What is breadth first search (BFS)breadth first search (BFS)? (kata platos) ? (kata platos) What is a What is a heuristicheuristic? (euristiki sinartisi) ? (euristiki sinartisi) How can we use heuristics to cut down the search How can we use heuristics to cut down the search
tree? tree?
Task: Think of a favourite game or problem that needs Task: Think of a favourite game or problem that needs solving. Create the (part of) the first two levels of the solving. Create the (part of) the first two levels of the
search space in a tree diagramsearch space in a tree diagram..
Reading for next week Reading for next week
Revise everything so far Revise everything so far
Question: Can we devise grammars Question: Can we devise grammars for music? (200-300 words) for music? (200-300 words)