ai fundamentals: knowledge representation and reasoning

42
AI Fundamentals: Knowledge Representation and Reasoning Maria Simi

Upload: others

Post on 18-Dec-2021

16 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: AI Fundamentals: Knowledge Representation and Reasoning

AIFundamentals:KnowledgeRepresentationandReasoningMariaSimi

Page 2: AI Fundamentals: Knowledge Representation and Reasoning

GraphrepresentationsandstructuredrepresentationsLESSON5:SEMANTICNETWORKS,FRAMES

Page 3: AI Fundamentals: Knowledge Representation and Reasoning

Summaryü Structuredrepresentationsandgraphrepresentationsü Earlysemanticnetworksü Sowaconceptualgraphsü KL-Oneü Knowledgegraphsü Formalizinginheritanceü Framesandframelanguages

25/10/17 AIFUNDAMENTALS- M.SIMI 3

Page 4: AI Fundamentals: Knowledge Representation and Reasoning

Psychological-linguisticapproachtoKR&R§ Thelogicalapproach:devisedtomodelrationalreasoning

◦ Emphasisonvalidreasoningandformalizationofmathematicalproperties◦ Extendedtomodelcommonsensereasoning

§ Thecognitive–linguisticapproach◦ Moreconcernedwithunderstandingthemechanismsforknowledgeacquisition,representationanduseofknowledgeinhumanminds

§ Synergieswithotherfields◦ Cognitivepsychology◦ Linguistics

25/10/17 AIFUNDAMENTALS- M.SIMI 4

Page 5: AI Fundamentals: Knowledge Representation and Reasoning

Associationist theoriesInlogicsystems,symbolicexpressionsaresyntacticallytransformedwithoutpayingattentiontothesymbolsusedorontheirinterpretation;thesymbolthemselvesarearbitrary.

"xStrawberry(x)Þ Red(x)Associationist theoriesareinsteadconcernedwiththeconnectionsamongsymbolsandthemeaningthatemergesfromtheseconnections.Theideaisthatmeaningofawordemergesasaresultoftheconnectionstootherwords.

25/10/17 AIFUNDAMENTALS- M.SIMI 5

Neve

Acqua

Freddo

Ghiaccio

Bianco

Inverno

Page 6: AI Fundamentals: Knowledge Representation and Reasoning

SemanticmemoryThequestionishowthemeaningofwordsisacquired,representedandused.Thememoryitselfisdistinguishedin:§ Episodicmemory:specificfactsandevents§ Semanticmemory:abstractandgeneralknowledge

SemanticnetworksisagraphicalmodelproposedforsemanticmemoryTwokindsofknowledge:§ Concepts:thesemanticcounterpartofwords,representedasnodes§ Propositions:relationsamongconcepts,representedaslabelledarcs

Notaccountingfordynamicaspectsofmemoryandlearning:Othermodels:§ Distributionalmodels§ Connectionistmodels

25/10/17 AIFUNDAMENTALS- M.SIMI 6

Page 7: AI Fundamentals: Knowledge Representation and Reasoning

Hierarchicalorganizationofconcepts:experimentsCognitivepsychologyisanexperimentaldiscipline.ExperimentsbyCollins&Quillian,1969.Questions:

1.“Is acanary abird?”2.“Does acanary fly?”3.“Does acanary has skin?"

Answertimes:T1 <T2 <T3

25/10/17 AIFUNDAMENTALS- M.SIMI 7

Page 8: AI Fundamentals: Knowledge Representation and Reasoning

Hierarchicalorganizationofconcepts:interpretation1. Evidenceforhierarchical

organization.2. Propertiesareattachedtothemost

generalconcepttowhichtheyapply.

3. Exceptionsareattacheddirectlytotheobject

SuccessofhierarchicalorganizationofconceptsincomputerscienceandinfluenceonOOPlanguagesinSWengineering.

25/10/17 AIFUNDAMENTALS- M.SIMI 8

Page 9: AI Fundamentals: Knowledge Representation and Reasoning

TheessenceofsemanticnetworksSemanticnetworksarealargefamilyofgraphicalrepresentationschemes.Asemanticnetworkisagraphwhere:§ Nodes,withalabel,correspondtoconcepts§ Arcs,labelledanddirected,correspondtobinaryrelationsbetweenconcepts,often

calledroles.

Nodescomeintwoflavors:1. Genericconcepts,correspondingtocategories/classes2. Individualconcepts,correspondingtoindividuals

Twospecialrelationsarealwayspresent,withdifferentnames:1. IS-A:holdsbetweentwogenericconcepts(subclass)2. Inst-Of:holdsbetweenanindividualconceptandaclass(memberof)

25/10/17 AIFUNDAMENTALS- M.SIMI 9

Page 10: AI Fundamentals: Knowledge Representation and Reasoning

Anexample[AIMA]

HasMother Legs

WhichisthelogicalmeaningofHasMother?

WhichisthelogicalmeaningofMary?

ArethetworelationsLegsusedwiththesamemeaning?

Page 11: AI Fundamentals: Knowledge Representation and Reasoning

InheritanceinhierarchicalnetworksInheritanceisveryconvenientlyimplementedaslinktraversal.HowmanylegshasClyde?JustfollowtheINST-OF/IS-AchainuntilyoufindthepropertyNLegs.

Multipleinheritanceisalsoallowed,butisbanneddiOOP.

25/10/17 AIFUNDAMENTALS- M.SIMI 11

Mammal

Elephant

Clyde

Animal

4

greyColor

NLegsIS-A

IS-A

INST-OF

Page 12: AI Fundamentals: Knowledge Representation and Reasoning

InheritancewithexceptionsThepresenceofexceptionsdoesnotcreateanyproblem.HowmanylegshasPat?Justtakethemostspecificinformation:thefirstthatisfoundgoingupthehierarchy.

25/10/17 AIFUNDAMENTALS- M.SIMI 12

Mammal

Bat

Pat

Animal

4

2NLegs

NLegsIS-A

IS-A

INST-OF

Page 13: AI Fundamentals: Knowledge Representation and Reasoning

Onlybinaryrelations?Casestructure representation

Page 14: AI Fundamentals: Knowledge Representation and Reasoning

LimitedexpressivepowerofsemanticnetsEveniftheycanexpressn-ary predicates,semanticnetworksdonothavethesameexpressivepowerofFOL:§ Existentials,Ú,Þ ...arenotexpressibleorareexpressibleonlyinspecialcases§ ThisisnotnecessarilyabadthingsinceitsuggestsasubsetofFOLwithinteresting

computationalproperties,exploredindescriptionlogics.§ Moreexpressiveassertional networkswereproposedinthepast:

Gottlob Frege (1879)developedatreenotationforthefirstversionoffirst-orderlogic.CharlesS.Peirce(1880,1885)independentlydevelopedanalgebraicnotationforthemodernnotationforpredicatecalculus,thathecalled“Thelogicofthefuture”.

§ AwellknownexampleinAIareSowa’sconceptualgraphs,inspiredbyPierce’sexistentialgraphs.Theycandidateasanintermediateschemaforrepresentingnaturallanguage.

25/10/17 AIFUNDAMENTALS- M.SIMI 14

Page 15: AI Fundamentals: Knowledge Representation and Reasoning

Sowa’sconceptualgraphs

§ Rectanglesareconcepts(possiblytypedasinPerson:John)§ Circlesarecalledconceptualrelations:thelabelisthetypeoftherelation§ Logicalmeaning:

∃x ∃y (Go(x)∧Person(John)∧City(Boston)∧Bus(y)∧Agnt(x,John )∧Dest(x,Boston )∧Inst(x,y))

25/10/17 AIFUNDAMENTALS- M.SIMI 15

Page 16: AI Fundamentals: Knowledge Representation and Reasoning

Sowa’sconceptualgraphsAmorecomplexproposition,includingimplication,usescontextboxes:“Ifafarmerownsadonkey,thenhebeatsit”¬[∃x ∃y (Farmer(x)∧Donkey(y) ∧Owns(x,y)∧¬Beats(x,y))]

25/10/17 AIFUNDAMENTALS- M.SIMI 16

Page 17: AI Fundamentals: Knowledge Representation and Reasoning

AnexamplefromKL-OneWoods[75]andothers point outthelack of“semantics”ofsemantic netsAsaresultinthe80’sKL-One[Brachman-Schmolze 1985]introducesimportantideas:• Conceptsandroles(theyarealso

nodeswithadifferentstatus)• Valuerestrictions(v/r)• Numericalrestrictions(1,NIL)• Aformalsemantics

ThedoublearrowisaIS-Arelation.

25/10/17 AIFUNDAMENTALS- M.SIMI 17

Page 18: AI Fundamentals: Knowledge Representation and Reasoning

AmorecomplexexampleinKL-One

25/10/17 AIFUNDAMENTALS- M.SIMI 18

- Shadedovalsareindividuals- Roleinheritance

Page 19: AI Fundamentals: Knowledge Representation and Reasoning

Logicaccountofsemanticnetworks

"x A(x)Þ B(x)AllmembersofclassAarealsomemberofclassB.

B(a)a belongs toclass B

"x x Î AÞ R(x,b)AllmembersofclassAareinrelationRwithb

"x x ÎAÞ$y yÎB Ù R(x,y)ForallmembersA,thereisaR-relatedelementinB

25/10/17 AIFUNDAMENTALS- M.SIMI 19

A BIS-A

BINST-OF

a

RA b

RA B

We may lookat semantic networksas aconvenient notation forapartofFOL.Arepresentation andmechanism at thesymbol level rather than at theknowledgelevel.

Page 20: AI Fundamentals: Knowledge Representation and Reasoning

Translationexample"x Mammal(x)Þ Animal(x)"x Mammal(x)Þ NLegs(x,4)"x Elephant(x)ÞMammal(x)"x Elephant(x)Þ Color(x,grey)Elephant(Clyde)

It is possible todeduce:Animal(Clyde)Mammal(Clyde)NLegs(Clyde,4)Color(Clyde,grey)

Inheritance corresponds to"E, MPandtransitivity ofÞ

25/10/17 AIFUNDAMENTALS- M.SIMI 20

Mammal

Elephant

Clyde

Animal

4

greyColor

NLegsIS-A

IS-A

INST-OF

Page 21: AI Fundamentals: Knowledge Representation and Reasoning

Accountingforexceptions"x Mammal(x)Þ Animal(x)"x Mammal(x)Þ NLegs(x,4)"x Bat(x)ÞMammal(x)"x Bat(x)Þ NLegs(x,4)Bat(Pat)It is possible todeduce:NLegs(Pat,4)NLegs(Pat,2)andthis may lead toacontradiction.Rewriting therule as:"x Bat(x)∧x≠PatÞ NLegs(x,4)Problem:logicsareflat.Defaultsrequirenonmonotonic reasoning

25/10/17 AIFUNDAMENTALS- M.SIMI 21

Mammal

Bat

Pat

Animal

4

2NLegs

NLegsIS-A

IS-A

INST-OF

Page 22: AI Fundamentals: Knowledge Representation and Reasoning

ImplementingdefeasibleinheritanceAmoreessentialnotationforinheritancenetworks:negatedarcs(a) Morespecificinformationshouldwin(b) Multipleinheritance.Caseofambiguous

network.Notsoeasy.Twostrategies:1. Shortestpathheuristics

itfailsinpresenceofredundantlinks(shortcuts)->(c)nextpage.

2. InferentialdistanceBasedonthetopology(notpathlength)AclosertoBthanCiff thereisapathfromaAtoCthroughB.

25/10/17 AIFUNDAMENTALS- M.SIMI 22

(a) (b)

Page 23: AI Fundamentals: Knowledge Representation and Reasoning

25/10/17 AIFUNDAMENTALS- M.SIMI 23

(c)

Theshortestdistancestrategywouldconcludethat

Clydeisgrey

ButtheinformationaboutRoyalElephant ismorespecificthanElephantandshouldbepreferred.

Theinferentialdistancestrategywouldconcludethat

Clydeisnotgrey

RoyalElephant isclosertoClydethanElephantbecausethereispathtoElephant passingtroughRoyalElephant.

Page 24: AI Fundamentals: Knowledge Representation and Reasoning

AformalaccountofdefeasibleinheritanceDef.Aninheritancehierarchy𝛤 =⟨V, E⟩ isadirected,acyclicgraphwithpositiveandnegativeedges§ V arethenodes,orvertices§ E aretheedges:Positiveedgeswillbewrittenas(a⋅x)andnegativeedgeswillbewrittenas

(a ⋅¬x).§ Apositivepath isasequenceofoneormorepositiveedgesa⋅… ⋅ x(supportsa⇒x)§ Anegativepath isasequenceofzeroormorepositiveedgesfollowed byasinglenegative

edge:a ⋅… ⋅v ⋅¬x (supportsa⇒¬x)Asingleconclusioncanbesupportedbymanypaths.However,notallargumentsareequallybelievable.Onlyadmissiblepathsare.

25/10/17 AIFUNDAMENTALS- M.SIMI 24

SKIPPED

Page 25: AI Fundamentals: Knowledge Representation and Reasoning

Admissiblepaths

25/10/17 AIFUNDAMENTALS- M.SIMI 25

r

Apatha⋅s1 ⋅s2 … sn⋅[¬]x isadmissibleiff everyedgeinitisadmissiblewithrespecttoa.Anedgeisadmissiblewithrespecttoa ifthereisanonredundant,admissiblepathleadingtoitfroma thatcontainsnopreemptingintermediaries.Formally:Anedgev ⋅[¬]x isadmissiblein𝛤 withrespecttoa ifthereisapositivepatha⋅s1 ⋅s2 … sn⋅v(n≥ 0)inE and1. eachedgeina⋅s1 ⋅s2 … sn⋅v isadmissiblein𝛤 withrespecttoa

(recursively)2. noedgeina⋅s1 ⋅s2 … sn⋅v isredundant in𝛤 withrespecttoa3. nointermediatenodea, s1, s2,… sn isapreemptorofv⋅¬x with

respecttoaRedundant:ifitisasortofshortcuttothesameconclusion(qinfigure)Preemptor:ifdefiestheconclusion(Whalepreemptsnegativeedger) SKIPPED

Page 26: AI Fundamentals: Knowledge Representation and Reasoning

WordNet[Miller]AbiglexicalresourceorganizedasaSemanticnetwork(122.000terms)§ names,verbs,adjectives,adverbsareorganizedinsetsofsynonims (synsets)whicharearepresentationofaconcepts(117.000synset);

§ Asyntacticwordisassociatedwithasetofsynsets:thewordsensesTheUrl oftheprojectis:§ http://wordnet.princeton.edu/

UsesofWordNetincomputationallinguistics:§ Queryexpansionwithsynonymsorhyperonyms§ Semanticsdistanceamongwords§ Semanticcategoryofaword(orsupersense)

Page 27: AI Fundamentals: Knowledge Representation and Reasoning

WordNet:thestructure

Cardinal Cardinal,c. grosbeak

Cardinal,carmine ...

Cardinal, c. number

4 Synset per ‘cardinal’

bishop

cleric

number

measure

red finch

colour oscine

birdperson

… … … …

organism

Hyperonims

Has-part

Member-of

feather

wing

beak

Sacred college

Page 28: AI Fundamentals: Knowledge Representation and Reasoning

KnowledgegraphsLarge-scaleknowledgebaseshavebeenbuilt,including:§ Opendomain:Dbpedia,WikiData,Freebase,YAGO.§ Proprietary:Microsoft'sSatori,Google'sKnowledgeGraph,Google’sKnowledgevaultFrom2012Googleusestheknowledgegraphwithitssearchengine§ Structureddatacomingfrommanysources,includingtheCIAWorldFactbook,

Wikidata,Wikipedia,Freebase.§ Morethan70billionfactsin2016Since2014,Google’sKnowledgeVault containsfactsderivedautomaticallyfromthewebwithmachinelearningtechniques.Factshaveanassociatedconfidencevalue.Towards GiantGlobalGraph (GGG)oftheSemanticweb[TimBernersLee,2001]…

25/10/17 AIFUNDAMENTALS- M.SIMI 28

Page 29: AI Fundamentals: Knowledge Representation and Reasoning

Objectorientedrepresentationsandframes

25/10/17 AIFUNDAMENTALS- M.SIMI 29

Page 30: AI Fundamentals: Knowledge Representation and Reasoning

ObjectOrientedrepresentationsItisverynaturaltothinkofknowledgenotasaflatcollectionofsentences,butratherasstructured andorganized intermsoftheobjects theknowledgeisabout.§ Complexobjectshaveattributes,partsconstrainedinvariousways§ Objectsmighthaveabehaviorthatisbetterexpressedasprocedures… verymuchasinObjectOrientedProgramming

MarvinMinskyin1975suggestedtheideaofusingasstructuredrepresentationofobjects,calledframes,torecognizeanddealwithnewsituations.

25/10/17 AIFUNDAMENTALS- M.SIMI 30

Page 31: AI Fundamentals: Knowledge Representation and Reasoning

FramesKnowledgeisorganizedincomplexmentalstructurescalledframes["AFrameworkforRepresentingKnowledge”,Minsky,1974].Theessenceofthetheory:“Whenoneencountersanewsituation(ormakesasubstantialchangeinone'sviewofthepresentproblem)oneselectsfrommemoryastructurecalledaframe.Thisisarememberedframeworktobeadaptedtofitrealitybychangingdetailsasnecessary.”Aframeisadata-structureforrepresentingastereotypicalsituation:§ Examples:hotelbedroom,orgoingtoachild'sbirthdayparty.

25/10/17 AIFUNDAMENTALS- M.SIMI 31

Page 32: AI Fundamentals: Knowledge Representation and Reasoning

Framesasdatastructures- 1Therearetwotypesofframes:1. individualframes,usedtorepresentsingleobjects2. genericframes,usedtorepresentcategoriesor

classesofobjects.Anindividualframeisacollectionofslot-fillers pairs.

(Frame-name<slot-name1filler1><slot-name2filler2>…)

Fillerscanbe:• values,usuallydefaultvalues• constraintsonvalues• thenamesofotherindividualframes• thespecialslotINSTANCE-OF

25/10/17 AIFUNDAMENTALS- M.SIMI 32

(tripLeg123 Example1<:INSTANCE-OFTripLeg><:Destinationtoronto>...)

(toronto<:INSTANCE-OFCanadianCity><:Provinceontario><:Population4.5M>...)

Page 33: AI Fundamentals: Knowledge Representation and Reasoning

Framesasdatastructures- 2Genericframesaresimilar.Fillerscanbe:§ thespecialslotIS-A§ procedures1. IF-ADDED:activatedwhentheslotreceivesavalue2. IF-NEEDED:activatedwhenthevalueisrequested

Theseproceduresarecalledproceduralattachmentsor demonsThe:INSTANCE-OFand:IS-A slotsorganizeframesinframesystems.Theyhavethespecialroleofactivatinginheritanceofpropertiesandprocedures.Inframes,allvaluesareunderstoodasdefaultvalues,whichcanbeoverridden.

25/10/17 AIFUNDAMENTALS- M.SIMI 33

(CanadianCity<:IS-ACity><:ProvinceCanadianProvince><:Countrycanada>)

(Lecture<:DayOfWeek WeekDay><:Date [IF-ADDEDComputeDayOfWeek ]>… )

(Table<:Clearance [IF-NEEDEDComputeClearanceFromLegs ]>… )

Page 34: AI Fundamentals: Knowledge Representation and Reasoning

ReasoningwithframesAttachedproceduresprovideaflexible,organizedframeworkforcomputation.Reasoninghasaveryproceduralflavour.Abasicreasoningloopinaframesystemhasthreesteps:1. Recognition:anewobjectorsituationisrecognizedasinstanceofagenericframe;2. Inheritance:anyslotfillersthatarenotprovidedexplicitlybutcanbeinheritedby

thenewframeinstanceareinherited;3. Demons:foreachslotwithafiller,anyinheritedIF-ADDED procedureisrun,

possiblycausingnewslotstobefilled,ornewframestobeinstantiated,untilthesystemstabilizes;thenthecyclerepeats.

Whenthefillerofaslotisrequested:1. ifthereisavaluestoredintheslot,thevalueisreturned;2. otherwise,anyinheritedIF-NEEDED procedureisruntocomputethefillerforthe

slot;thismaycauseotherslotstobefilled,ornewframestobeinstantiated.

25/10/17 AIFUNDAMENTALS- M.SIMI 34

Page 35: AI Fundamentals: Knowledge Representation and Reasoning

Reasoningwithframes:exampleChapter8.3ofthebookbyBrachman&Levesquepresentsanexampleofusingframestoplanatrip(madeoftravelsteps).Ileavethisasanexerciseorpresentation.

25/10/17 AIFUNDAMENTALS- M.SIMI 35

Page 36: AI Fundamentals: Knowledge Representation and Reasoning

FramesandOOPFrame-basedrepresentationlanguagesandOOPsystemsweredevelopedatthesametime.TheylooksimilarandcertainlyonecouldimplementaframesystemwithOOP.Importantdifferenceisthatframesystemstendtoworkinacycle:§ Instantiate aframeanddeclaresomeslotfillers§ inheritvaluesfrommoregeneralframes§ triggerappropriateforward-chainingprocedures§ whenthesystemisquiescent,stopandwaitforthenextinput

Thedesignercancontroltheamountof“forward”reasoningthatshouldbedone(inadata-directed fashion)or“backward”(inagoal-directed fashion).

25/10/17 AIFUNDAMENTALS- M.SIMI 36

Page 37: AI Fundamentals: Knowledge Representation and Reasoning

Applicationsofframes§ Storyunderstanding§ Scenerecognitioninvision§ Toolsforbuildingexpertsystems(possiblytogetherwithrules)

Example:KEE(Fikes-Kehler,85)§ Theideaofframeswasalsousedinbuilding“FrameNet”:alargeNLresource

basedonthetheoryof“frame-based”semantics.

25/10/17 AIFUNDAMENTALS- M.SIMI 37

Page 38: AI Fundamentals: Knowledge Representation and Reasoning

FrameNet[Lowe,Baker,Fillmore]FrameNet isaresourceconsistingofcollectionsofNLsentencessyntacticallyandsemanticallyannotated,organizedinframes.Framesemantics:themeaningofwordsemergesfromtheroletheyhaveintheconceptualstructureofsentences.Knowledgeisstructuresin16generaldomains:time,space,communications,cognition,health…6000Lexicalelements;130.000annotatedsentences.http://www.icsi.berkeley.edu/~framenet/

Page 39: AI Fundamentals: Knowledge Representation and Reasoning

FrameNet:anexampleFRAME:communicationFRAMEDESCRIPTION:Aperson(COMMUNICATOR)producessomelinguisticobject(MESSAGE)whileaddressingsomeotherperson(ADDRESSEE)onsometopic(TOPIC)FE:COMMUNICATOR…FE:MESSAGE…FE:ADDRESSEE …FE: TOPIC ..

[Pat]communicated[themessage][tome].[Management]shoulddevelopandcommunicate[toallemployees][avisionofwheretheorganizationisgoing].Videotapesofschoolactivitiesareusefulmeansofcommunicating[aboutworkundertakenatschool].

Page 40: AI Fundamentals: Knowledge Representation and Reasoning

Conclusionsü Knowledgerepresentationisnotonly“logics”. Logicismodularandwell

definedbuthasnostructure.ü Structure canbeexploitedtoreasonmoreefficiently.ü Networkbasedrepresentationsarevery“natural”buthavebeenusedtoo

informally:thedefinitionoflegalconclusionscannotbelefttoprograms.ü Proceduralknowledge,asusedinframes,inadditiontodeclarative

knowledge,isstillaviablealternativeforreasoningsystems.

25/10/17 AIFUNDAMENTALS- M.SIMI 40

Page 41: AI Fundamentals: Knowledge Representation and Reasoning

YourturnProposalsforassertional networks:ü Sowa’sconceptualgraphsü Tesnière dependencygraphsandsuccessors.ü Shapiro’sSNePS (SemanticNetworkProcessingSystem)ü …Framesbasedreasoning:ü Chapter8.3ofthebookbyBrachman&Levesque:exampleofusingframesto

planatripü FrameNet projectü KEE(Fikes-Kehler,85)

25/10/17 AIFUNDAMENTALS- M.SIMI 41

Page 42: AI Fundamentals: Knowledge Representation and Reasoning

References[AIMA]StuartJ.RussellandPeterNorvig.ArtificialIntelligence:AModernApproach (3rd edition).PearsonEducation2010(Ch.12).

[KR&R]RonaldBrachmanandHectorLevesque.KnowledgeRepresentationandReasoning.MorganKaufmannPublishersInc.,SanFrancisco,CA,USA.2004(Ch.8-10)

25/10/17 AIFUNDAMENTALS- M.SIMI 42