ai fundamentals: knowledge representation and reasoning
TRANSCRIPT
AIFundamentals:KnowledgeRepresentationandReasoningMariaSimi
GraphrepresentationsandstructuredrepresentationsLESSON5:SEMANTICNETWORKS,FRAMES
Summaryü Structuredrepresentationsandgraphrepresentationsü Earlysemanticnetworksü Sowaconceptualgraphsü KL-Oneü Knowledgegraphsü Formalizinginheritanceü Framesandframelanguages
25/10/17 AIFUNDAMENTALS- M.SIMI 3
Psychological-linguisticapproachtoKR&R§ Thelogicalapproach:devisedtomodelrationalreasoning
◦ Emphasisonvalidreasoningandformalizationofmathematicalproperties◦ Extendedtomodelcommonsensereasoning
§ Thecognitive–linguisticapproach◦ Moreconcernedwithunderstandingthemechanismsforknowledgeacquisition,representationanduseofknowledgeinhumanminds
§ Synergieswithotherfields◦ Cognitivepsychology◦ Linguistics
25/10/17 AIFUNDAMENTALS- M.SIMI 4
Associationist theoriesInlogicsystems,symbolicexpressionsaresyntacticallytransformedwithoutpayingattentiontothesymbolsusedorontheirinterpretation;thesymbolthemselvesarearbitrary.
"xStrawberry(x)Þ Red(x)Associationist theoriesareinsteadconcernedwiththeconnectionsamongsymbolsandthemeaningthatemergesfromtheseconnections.Theideaisthatmeaningofawordemergesasaresultoftheconnectionstootherwords.
25/10/17 AIFUNDAMENTALS- M.SIMI 5
Neve
Acqua
Freddo
Ghiaccio
Bianco
Inverno
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
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
Hierarchicalorganizationofconcepts:interpretation1. Evidenceforhierarchical
organization.2. Propertiesareattachedtothemost
generalconcepttowhichtheyapply.
3. Exceptionsareattacheddirectlytotheobject
SuccessofhierarchicalorganizationofconceptsincomputerscienceandinfluenceonOOPlanguagesinSWengineering.
25/10/17 AIFUNDAMENTALS- M.SIMI 8
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
Anexample[AIMA]
HasMother Legs
WhichisthelogicalmeaningofHasMother?
WhichisthelogicalmeaningofMary?
ArethetworelationsLegsusedwiththesamemeaning?
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
InheritancewithexceptionsThepresenceofexceptionsdoesnotcreateanyproblem.HowmanylegshasPat?Justtakethemostspecificinformation:thefirstthatisfoundgoingupthehierarchy.
25/10/17 AIFUNDAMENTALS- M.SIMI 12
Mammal
Bat
Pat
Animal
4
2NLegs
NLegsIS-A
IS-A
INST-OF
Onlybinaryrelations?Casestructure representation
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
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
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
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
AmorecomplexexampleinKL-One
25/10/17 AIFUNDAMENTALS- M.SIMI 18
- Shadedovalsareindividuals- Roleinheritance
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.
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
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
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)
25/10/17 AIFUNDAMENTALS- M.SIMI 23
(c)
Theshortestdistancestrategywouldconcludethat
Clydeisgrey
ButtheinformationaboutRoyalElephant ismorespecificthanElephantandshouldbepreferred.
Theinferentialdistancestrategywouldconcludethat
Clydeisnotgrey
RoyalElephant isclosertoClydethanElephantbecausethereispathtoElephant passingtroughRoyalElephant.
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
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
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)
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
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
Objectorientedrepresentationsandframes
25/10/17 AIFUNDAMENTALS- M.SIMI 29
ObjectOrientedrepresentationsItisverynaturaltothinkofknowledgenotasaflatcollectionofsentences,butratherasstructured andorganized intermsoftheobjects theknowledgeisabout.§ Complexobjectshaveattributes,partsconstrainedinvariousways§ Objectsmighthaveabehaviorthatisbetterexpressedasprocedures… verymuchasinObjectOrientedProgramming
MarvinMinskyin1975suggestedtheideaofusingasstructuredrepresentationofobjects,calledframes,torecognizeanddealwithnewsituations.
25/10/17 AIFUNDAMENTALS- M.SIMI 30
FramesKnowledgeisorganizedincomplexmentalstructurescalledframes["AFrameworkforRepresentingKnowledge”,Minsky,1974].Theessenceofthetheory:“Whenoneencountersanewsituation(ormakesasubstantialchangeinone'sviewofthepresentproblem)oneselectsfrommemoryastructurecalledaframe.Thisisarememberedframeworktobeadaptedtofitrealitybychangingdetailsasnecessary.”Aframeisadata-structureforrepresentingastereotypicalsituation:§ Examples:hotelbedroom,orgoingtoachild'sbirthdayparty.
25/10/17 AIFUNDAMENTALS- M.SIMI 31
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>...)
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 ]>… )
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
Reasoningwithframes:exampleChapter8.3ofthebookbyBrachman&Levesquepresentsanexampleofusingframestoplanatrip(madeoftravelsteps).Ileavethisasanexerciseorpresentation.
25/10/17 AIFUNDAMENTALS- M.SIMI 35
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
Applicationsofframes§ Storyunderstanding§ Scenerecognitioninvision§ Toolsforbuildingexpertsystems(possiblytogetherwithrules)
Example:KEE(Fikes-Kehler,85)§ Theideaofframeswasalsousedinbuilding“FrameNet”:alargeNLresource
basedonthetheoryof“frame-based”semantics.
25/10/17 AIFUNDAMENTALS- M.SIMI 37
FrameNet[Lowe,Baker,Fillmore]FrameNet isaresourceconsistingofcollectionsofNLsentencessyntacticallyandsemanticallyannotated,organizedinframes.Framesemantics:themeaningofwordsemergesfromtheroletheyhaveintheconceptualstructureofsentences.Knowledgeisstructuresin16generaldomains:time,space,communications,cognition,health…6000Lexicalelements;130.000annotatedsentences.http://www.icsi.berkeley.edu/~framenet/
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].
Conclusionsü Knowledgerepresentationisnotonly“logics”. Logicismodularandwell
definedbuthasnostructure.ü Structure canbeexploitedtoreasonmoreefficiently.ü Networkbasedrepresentationsarevery“natural”buthavebeenusedtoo
informally:thedefinitionoflegalconclusionscannotbelefttoprograms.ü Proceduralknowledge,asusedinframes,inadditiontodeclarative
knowledge,isstillaviablealternativeforreasoningsystems.
25/10/17 AIFUNDAMENTALS- M.SIMI 40
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
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