+ All Categories
Home > Documents > Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop...

Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop...

Date post: 26-Apr-2018
Category:
Upload: trankhanh
View: 223 times
Download: 4 times
Share this document with a friend
42
Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting… download WordNet http://web.eecs.umich.edu/~soar/tutorial16 June 7 2016 Semantic Memory Tutorial 1
Transcript
Page 1: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

SoarWorkshopSemanticMemoryTutorial

NateDerbinsky

Whilewaiting…downloadWordNethttp://web.eecs.umich.edu/~soar/tutorial16

June72016 SemanticMemoryTutorial 1

Page 2: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Agenda

• Bigpicture• Basicusage• WordNet demo• Additionalresources

June72016 SemanticMemoryTutorial 2

Page 3: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Soar9

June72016 SemanticMemoryTutorial 3

SymbolicLong-TermMemories

SymbolicWorkingMemory

Procedural

Decision

Procedure

ChunkingReinforcementLearning

Action

Semantic

SemanticLearning

Episodic

EpisodicLearning

Spatial Visual SystemObject-basedcontinuousmetricspace

Perception

Page 4: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

SoarBasicFunctions

1. Input fromenvironment2. Elaboratecurrentsituation:parallelrules3. Proposeoperatorsviaacceptable preferences4. Evaluateoperatorsviapreferences:Numericindifferentpreference5. Selectoperator6. Applyoperator:Modifyinternaldatastructures:parallelrules7. Output tomotorsystem[andaccesstolong-termmemories]

OperatorDecisionInput Output

StateElaboration

OperatorProposal

OperatorEvaluation

OperatorElaboration

OperatorApplication

June72016 EpisodicMemoryTutorial 4

Page 5: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

SemanticMemory:BigPicture

Supportsdeliberatestorageandretrievaloflong-term“objects,”features,andrelations

June72016 SemanticMemoryTutorial 5

Page 6: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

ArchitecturalIntegration

June72016 SemanticMemoryTutorial 6

Page 7: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

ArchitecturalIntegrationStorage

June72016 SemanticMemoryTutorial 7

Page 8: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

ArchitecturalIntegrationStorage

June72016 SemanticMemoryTutorial 8

Page 9: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

ArchitecturalIntegrationStorage

June72016 SemanticMemoryTutorial 9

Page 10: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

ArchitecturalIntegrationNon-Cue-Based Retrieval

June72016 SemanticMemoryTutorial 10

Page 11: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

ArchitecturalIntegrationNon-Cue-Based Retrieval

June72016 SemanticMemoryTutorial 11

Page 12: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

ArchitecturalIntegrationCue-BasedRetrieval

June72016 SemanticMemoryTutorial 12

Page 13: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

ArchitecturalIntegrationCue-BasedRetrieval

June72016 SemanticMemoryTutorial 13

Page 14: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

BasicUsage

• Working-memorystructure• Semantic-memoryrepresentation• Controllingsemanticmemory• Storingknowledge• Retrievingknowledge

June72016 SemanticMemoryTutorial 14

Page 15: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Working-MemoryStructure

Soarcreatesansmem structureoneachstate– SoarJavaDebugger

• step 5• print --exact (* ^smem *)• print s2

Eachsmem structurehasspecializedsubstructure– command:agent-initiatedactions– result:architecturalfeedback

June72016 SemanticMemoryTutorial 15

Page 16: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Semantic-MemoryRepresentation

Similartoworkingmemory:symbolictriples– Allidentifiersinsemanticmemoryarelong-term• Theletter-numberpair(e.g.S5orC7)ispermanentlyassociatedwiththeidentifier• Whenprinted,long-termidentifiersareprefacedwiththe@symbol(e.g.@S5or@C7)• Whendepicted,long-termidentifiersaredoublecircles

– Attributescannotbeidentifiers(currently)– Theresultinggraphisnotnecessarilyconnected

June72016 SemanticMemoryTutorial 16

Page 17: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

ControllingSemanticMemory

Get/Setaparameter:– smem [-g|--get] <name>– smem [-s|--set] <name> <value>

SMem isdisabled bydefault.Toenableit…1. smem2. smem --set learning on3. smem

June72016 SemanticMemoryTutorial 17

Page 18: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

StoringKnowledge

ManualMethodofappendingviacommandline(especiallyusefulforloadingexternalKBs)

AgentDeliberate(viarules)addition/modification

Note:bothmethodscanchange existingand/oraddnewknowledgeinsemanticmemory.

June72016 SemanticMemoryTutorial 18

Page 19: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

ManualStorage

Syntax:similartoproductionRHS

smem --add {(<id1> ̂ attr1 val1 val2 ̂ attr2 val1 … )(<id2> ̂ attr3 <id1> val5 … )(<id3> ̂ attr4.attr5 <id3>)…

}

June72016 SemanticMemoryTutorial 19

Page 20: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

ManualStorage:ExampleSoarJavaDebugger

1. smem --add {(<a> ^name alice ^friend <b>) (<b> ^name bob ^friend <a> <c>)(<c> ^name charley)}

2. smem --print

(@A1 ̂ friend @B1 ̂ name alice [+1.000])(@B1 ̂ friend @A1 @C4 ^name bob [+2.000])(@C4 ̂ name charlie [+3.000])

June72016 SemanticMemoryTutorial 20

Page 21: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

AgentStorageSyntax

(<smem> ^command <cmd>)(<cmd> ^store <id1> <id2> …)

• Requires thatSMem isenabled (slide16)• Processedatendofphaseinwhichrulefires• Multiple identifiersmaybestoredatonce• Storageisnot recursive

Result(<smem> ^command <cmd> ^result <r>)(<cmd> ^store <id1> <id2> …)(<r> ^success <id1> <id2> …)

June72016 SemanticMemoryTutorial 21

Page 22: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

AgentStorage:Example• SoarJavaDebugger

1. smem --set learning on2. watch 53. source4. run 4 -p5. print --depth 10 s2

sp {propose*init(state <s> ^superstate nil

-^name)-->

(<s> ̂ operator <op> +)(<op> ̂ name init)

}

sp {apply*init(state <s> ^operator.name init

^smem.command <cmd>)-->

(<s> ̂ name friends)(<cmd> ̂ store <a> <b> <c>)(<a> ̂ name alice ^friend <b>)(<b> ̂ name bob ̂ friend <a> <c>)(<c> ̂ name charley)

}

June72016 SemanticMemoryTutorial 22

Page 23: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

ExaminingtheTrace=>WM: (30: C4 ^name charley)=>WM: (29: B1 ^friend A1)=>WM: (28: B1 ^friend C4)=>WM: (27: B1 ^name bob)=>WM: (26: A1 ^friend B1)=>WM: (25: A1 ^name alice)=>WM: (24: C2 ^store A1)=>WM: (23: C2 ^store B1)=>WM: (22: C2 ^store C4)=>WM: (21: S1 ^name friends)--- Change Working Memory (PE) ---=>WM: (33: R3 ^success @A1)=>WM: (32: R3 ^success @B1)=>WM: (31: R3 ^success @C4)

June72016 SemanticMemoryTutorial 23

Page 24: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Semantic-StoreStatistics

smem --stats• Nodes:numberoflong-termidentifiers• Edges:numberoffeatures/relations• Stores:numberofagentstores

June72016 SemanticMemoryTutorial 24

Page 25: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

RetrievingKnowledgeNon-Cue-Based

Addthefeatures/relations ofaknownlong-term identifier toworkingmemory

Cue-BasedFindalong-term identifier thathasasetoffeatures/relations andaddittoworkingmemorywithitsfullfeature/relation set

Common Constraints:– Requires thatSMem isenabled (slide16)– Onlyoneperstateperdecision– Processed duringoutput phase– Onlyre-processed ifWMchangestocommands

• Meta-data(status,etc)automaticallycleanedbythearchitecture

June72016 SemanticMemoryTutorial 25

Page 26: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Non-Cue-BasedRetrievalSyntax

(<smem> ^command <cmd>)(<cmd> ^retrieve <long-term identifier>)

Result(<smem> ^command <cmd> ^result <r>)(<cmd> ^retrieve <long-term identifier>)(<r> ^<status> <long-term identifier>

^retrieved <long-term identifier>)

Where<status> is…– failure:<long-term identifier> isnotlong-term– success:else(addsallfeatures/relations toWM)

June72016 SemanticMemoryTutorial 26

Page 27: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Non-Cue-BasedRetrieval:Example• SoarJavaDebugger

1. smem --set learning on2. smem --add {

(@A1 ^name alice ^friend @B1)(@B1 ^name bob ^friend @A1 @C4)(@C4 ^name charley)}

3. sp {ncb(state <s> ^superstate nil

^smem.command <cmd>)-->

(<cmd> ^retrieve @B1)}4. run 5 -p5. print --depth 10 s26. smem --stats

June72016 SemanticMemoryTutorial 27

Page 28: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Non-Cue-BasedRetrieval:Debrief• Becautiousoflong-term identifiers inrules

– Onlylegalifalready insemanticstore– Willoccurviachunking

• Onlyfeatures/relations of@B1added toWM– Features/relations of@A1,@C4wouldrequireadditionalretrieve

commands

• Statisticskeptaboutnumberofretrieve commandsprocessed– smem --stats

• (“Retrieves”)

• Meta-datacleanedupduringoutput phase

June72016 SemanticMemoryTutorial 28

Page 29: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Cue-BasedRetrieval:Syntax(<smem> ^command <cmd>)(<cmd> ^query <q>)(<q> ^attr1 val1

^attr2 <val2> ^attr3 @V3 …)

Theaugmentationsofthequery formhardconstraint(s),baseduponthevaluetype…

• Constant:exactmatch• Long-Term ID:exactmatch• Short-Term ID:wildcard

June72016 SemanticMemoryTutorial 29

Page 30: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Cue-BasedRetrieval:Result(<smem> ^command <cmd> ^result <r>)(<cmd> ^query <q>)(<r> ^<status> <q>

^retrieved <long-term identifier>)

Where<status> is…– failure:nolong-termidentifiersatisfiestheconstraints– success:else(addsallfeatures/relationstoWM)

Tiesarebrokenbyabias(default:recency)– Seeactivation-mode parameterinManual– Whenyouexecutesmem -p,thebiasvalueisindicated

June72016 SemanticMemoryTutorial 30

Page 31: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Cue-BasedRetrieval:Example• SoarJavaDebugger

1. smem --set learning on2. smem --add {

(@A1 ^name alice ^friend @B1)(@B1 ^name bob ^friend @A1 @C4)(@C4 ^name charley)}

3. sp {cbr(state <s> ^superstate nil

^smem.command <cmd>)-->

(<cmd> ^query.name alice)}4. run 5 -p5. print --depth 10 s26. smem --stats

June72016 SemanticMemoryTutorial 31

Page 32: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Prohibition

Cue-basedretrievalscanoptionallyprohibittheretrievalofone-or-morelong-termidentifiers

Syntax(<smem> ^command <cmd>)(<cmd> ^prohibit <lti-1> <lti-2> …)

June72016 SemanticMemoryTutorial 32

Page 33: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Prohibition:Example• SoarJavaDebugger

1. smem --set learning on2. smem --add {

(@A1 ^name alice ^friend @B1)(@B1 ^name bob ^friend @A1 @C4)(@C4 ^name charley)}

3. sp {prohibit(state <s> ^superstate nil

^smem.command <cmd>)-->

(<cmd> ^query.name <some-name>^prohibit @A1 @C4)}

4. run 5 -p5. print --depth 10 s2

June72016 SemanticMemoryTutorial 33

Page 34: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

AlsoUseful:ManualQuery

smem -q {(<cue> ^name charley)}

June72016 SemanticMemoryTutorial 34

Page 35: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

WordNetDemohttps://github.com/SoarGroup/Domains-WordNet

• ScriptstoconvertWN-LEXICALtoSMem– Output:smem --add { …• >821Klong-termidentifiers,>3.97Medges,~88MB

– Source:~5-10minutes,~1GBmemory

• SMem usesaSQLitebackend– Hastheabilitytosavesemanticstorestodiskandusedisk-baseddatabases• smem --backup<filename>

June72016 SemanticMemoryTutorial 35

Page 36: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

WordNet:MakeDiskStore• SoarJavaDebugger– source wn.soar

• ~5-10minutes– smem --stats– smem --backup path/to/filename.db

• ~10seconds

• SoarJavaDebugger– smem --set path path/to/filename.db– smem --set database file– smem --stats

June72016 SemanticMemoryTutorial 36

Page 37: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

WordNet:Representation

June72016 SemanticMemoryTutorial 37

“sense”ofthe“verb”to“soar”

“gloss”withthe“synset-id”200155406

smem -q {(<c> ̂ isa s ^ss-type v ^word soar)}

(@S194181 ̂ isa s ^sense-number 4 ^ss-type v ^synset-id 200155406 ^tag-count 1 ^w-num 1 ^word soar ̂ word-lower soar [+194177.000])

smem -q {(<c> ̂ isa g ^synset-id 200155406)}

(@G270 ^gloss |go or move upward; 'The stock market soared after the

cease-fire was announced'| ^isa g ^synset-id 200155406 [+425386.000])

Page 38: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

WordNet Taskwn-senses.soar

Findalldefinitions,givenlexicalword/POS– High-levelalgorithm

1. query:̂ isa s ^word lex ^ss-type pos

2. Ifsuccessfula) query:̂ isa g ^synset-id <sense ^synset-id>b) Ifsuccessful

» write <gloss ^gloss>c) prohibit: <sense>d) Loop

3. Elsea) (halt)

June72016 SemanticMemoryTutorial 38

Page 39: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Eaters!

June72016 SemanticMemoryTutorial 39

Page 40: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

AdditionalResources

• Documentation• Readings

June72016 SemanticMemoryTutorial 40

Page 41: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

Documentation

SeetheSoarManualandTutorial

AdditionalTopics– Detailsofintegrationwithothermechanisms– Retrievalbiases– Performance– Usage:commands,parameters,statistics,etc.…

June72016 SemanticMemoryTutorial 41

Page 42: Soar Workshop Semantic Memory Tutorialsoar/tutorial16/Tutorial-2016-SW-smem.pdf · Soar Workshop Semantic Memory Tutorial Nate Derbinsky While waiting ... (slide 16) • Processed

SelectReadingshttp://soar.eecs.umich.edu/Soar-RelatedResearch

2006– IntegratingSemanticMemoryintoaCognitiveArchitecture

• YongjiaWang,JohnE.Laird(TechnicalReport)

2010– ExtendingSoarwithDissociatedSymbolicMemories

• NateDerbinsky,JohnE.Laird(AISB)– TowardsEfficientlySupportingLargeSymbolicMemories

• NateDerbinsky,JohnE.Laird(ICCM)

2011– PerformanceEvaluationofDeclarativeMemorySystemsinSoar

• JohnE.Laird,NateDerbinsky,JonVoigt(BRIMS)– AFunctional Analysis ofHistoricalMemoryRetrievalBiasintheWord SenseDisambiguationTask.

• NateDerbinsky,JohnE.Laird(AAAI)

2012– Functional InteractionsbetweenMemoryandRecognitionJudgments

• JustinLi,NateDerbinsky,JohnE.Laird(AAAI)

2014– ACaseStudyofKnowledgeIntegrationAcrossMultipleMemoriesinSoar

• JohnE.Laird,Shiwali Mohan(BICA)

June72016 SemanticMemoryTutorial 42


Recommended