Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
Quick Itroduction to the ACTR Cognitive Architecture
Łukasz Stafiniak, Instytut Informatyki Uniwersytetu Wrocławskiego
My notes after reading the ACT-R 6 tutorials.
ACTR is a Production System
Procedural Knowledge: production / transition rules Manipulating named attributevalue structures:
mutable chunks with physical identity (like objects) Patterns match the AV structures, which can have other
chunks as constants in slots
State factorized into a fixed set of modules and their associated buffers: for any number of modules LHS queries a module or matches a chunk in a buffer, RHS requests action from a module or modifies a chunk
in a buffer; modules can repeat in both LHS and RHS.
ACTR Production Syntax (P prodname =module1> attribute =variable ?module2> query value ==> =module1> attribute newvalue +module2> request =variable) prodname ID for displaying and manipulation =variable binds a value across multiple occurrences
in both LHS and RHS, must occur in LHS =module1> in LHS matches a chunk in buffer of
module named ”module1” and binds it to variable =module1; in RHS modifies the chunk =module1
?module2> asks ”module2” about query
+module2> requests action from ”module2”
ACTR Retrieval Module: Memory
Declarative Knowledge is a store of chunks Put an AV structure to the right of +retrieval>
to get from it a chunk with at least those AV pairs A copy – different chunk – goes into the retrieval buffer
Some time later (another production can fire in the meanwhile) you can match the chunk with =retrieval>
When a chunk is removed from any buffer, it goes into the retrieval store: removed = memorized Merged with a structurally equal chunk if already there
More on ACTR Productions
,<,>,<=,>= before an AV pair on LHS means ”different than” (any value), arithmetic comparison
before a buffer identifier on RHS means ”remove the chunk from the buffer”, e.g. retrieval> By default, if a chunk is matched on LHS but not on
RHS, it is harvested – automatically removed A chunk can be modified and memorized in one step
After matching a buffer with =module>, use =module to refer to its chunk
On RHS, !output! (Writes out =text)
ACTR Goal and Imaginal Modules
They are just buffers to build and manipulate chunks goal> is for control state, immediate effects imaginal> is a scratchpad, creation/modification
takes time (to match experimental data) Remember you have to match a buffered chunk =module> on LHS before you can modify it (RHS)
With harvesting on (default), to keep a chunk in a buffer without modifying it, put =module>, without any AV structure, on RHS
ACTR as a Software System
ACTR is a Lisp software with a TclTk graphical interface, to write models: cog. psych. experiments, and simulate the ACTR theory agent on them
Start with (load ”./loadactr6.lisp”) In another shell, cd actr6/environment/gui ; wish starter.tcl
(startenvironment)
(Re)load models and step/inspect from GUI, but (runexperiment) and observe trace in Lisp
Experiments often have their own GUI window
Programming in ACTR
Chunks are typed, declare with (chunktype tyname attrib1 attrib2 ...)
Attribute isa specifies chunk’s type, unspecified attributes of a created chunk have value nil, variable in a pattern cannot match nil
Add (e.g. initial) chunks to the store with (adddm (chunkname isa tyname attr1 val1...) ...)
Set initial contents of the goal buffer with (goalfocus chunkname)
ACTR Vision Module
The vision module has a ”visuallocation” buffer for location chunks of tobeattendedto objects,
and a ”visual” buffer for details of attended objects. The ”protocol” is: (a point is a separate production)
request location +visuallocation> isa visuallocation AVdetails aboutloc
request attention =visuallocation> isa visuallocation ?visual> state free ==> +visual> isa moveattention screenpos =visuallocation
get information about object from =visual>
ACTR Vision Module Details
location details :attended nil location of recently unattended obj.
attributes starting with : are not part of the chunk, they’re transferred directly to the module as request parameters
screenx and screeny coordinates in the window height, width (in pixels), color (e.g. black) and kind (e.g. text) of the object
you can pick or compare with constants, variables, relative values lowest and highest, the corresponding attribute of the currently attended object current, RHSonly variables e.g. &x, an object :nearest another location (current or stored)
ACTR Vision Module Details object details: isa kind (e.g. text, line, oval), screenpos location chunk, value (e.g. ”string” for text), color, height, width
buffer stuffing puts an :attended new (object that just appeared) location into an empty visual location buffer, so that +visuallocation> is not needed when expecting an object (reactivity)
finsts: the visual module’s :attended and retrieval module’s :recentlyretrieved hold true only for a small fixedlength queue of elements
there’s an auditory module: aurallocation etc
ACTR Motor Module
Only concerned with ”hand movements”. ”Protocol” e.g.: ?manual> state free ==> +manual> isa presskey key =letter
This module can also control mouse pointer and other devices.
There’s a ”vocal” module that pretends to speak: ?vocal> state free ==> +vocal> isa speak string =val; it can also subvocalize (a time waster to tune into experimental data)
Base and Spreading Activation Enable subsymbolic computations (sgp :esc t) A chunk with maximal activation among those that
match will be retrieved; noise is /( + (( -1 1 exp t E )/ ))A s
otherwise, retrieval failure, t– threshold (sgp :rt t) time of retrieval= * (- )F exp A , time of failure= * (- )F exp t
A = B(how often retrieved) + Spr(parent or sibling of a buffered chunk) + Partial match + Noise
=B (∑ln - )=t^ d (∑ /ln 1 ),t t–time since ith presentation B≈ ( )- . ( ),ln 2n 0 5ln L n–# of presentations, L–lifespan In extras, ( )= * ( - )+ , ( )= ( )+d i c e^m i 1 a m i B i noise
Base and Spreading Activation ( )=Spr i ∑ ∑ ( ) ( ),k j W kj S ji ( )W kj – amount of
activation from source j in buffer k, j – chunks in slots of chunk in buffer k
( )=S ji 0, j≠i and i is not a parent of j ( )= - ( ( ))S ji S ln fan j , ( )f an j – 1+ # of parents of j By default, activation only from the goal,
( , )= /W goal j 1 n, n – # of slots, change e.g. (sgp :imaginalactivation 0.5)
( )=PartM i ∑ * ( , )l P M l i , ( , )M l i – similarity for slot l maximal similarity = 0, maximal difference = 1
ACTR Production Utilities Production with maximal utility among those that
match will be selected; with noise, the prob. is ( )= ( ( )/Pr i exp U i ) / 2s ∑ j ( ( )/exp U j )2s
The difference learning is very simple ( )( )= ( )( - ) + Ui n Ui n 1 [ ( )( )- ( )( - )]Ri n Ui n 1
( )( )R i n – the closest reward after nth application of i minus the time that has passed from the application to the occurrence of the reward no dynamic programming – resembles ”Monte Carlo” RL all rewards are final ”additive” discounting
ACTR Frustration Model Not distributed yet with ACTR 6. Inspired by an experiment: one lever is reinforced
until the monkeys fixate on pressing it, then reinforcement is switched to the other lever.
Longterm and shortterm global estimates of rewards: ( )= ( - )+SR n SR n 1 ( )[ ( )- ( - )], sr Rn SRn 1
( )= ( - )+( )[ ( )- ( - )], LRn LRn 1 l r Rn LRn 1 ( )= . , sr 0 008( )= . .l r 0001
Adjusting the noise parameter: ( )= ( - )+s n s n 1 ( )s[ ( )- ( - )], ( )= ( , *( ( )- ( ))], F n s n 1 F n max 1 b LR n SR n( )= . , = . s 005 b 4 Increases noise when LRSR>1/b
Worked great for monkeys, but so many parameters!
ACTR Production Compilation
Composition of rules: (P p2 LHS2==>RHS2) fires right after (P p1 LHS1==>RHS1)
The compiled rule (P ”p1&p2” LHS==>RHS) LHS=Inst(LHS1)+CompL, RHS=CompR+Inst(RHS2)
Buffers classified into composition styles motor style buffers: they never hold a chunk; only one of
RHS1, RHS2 can request such buffer, and if RHS1 does, LHS2 can at most query it for state busy
perceptual style buffers: if RHS1 makes a request on such buffer, then p2 cannot operate on the same buffer
ACTR Production Compilation
Buffers classified into composition styles [cont] retrieval style buffer: declarative memory grows
monotonically; RHS1 retrieval requests can be instantiated if LHS2 does not query retrieval failure
goal style buffer (goal and imaginal): LHS=LHS1+(LHS2RHS1), RHS=(RHS1~RHS2)+RHS2 LHS2RHS1: conditions not provided by actions RHS1~RHS2: actions that are not undone RHS1 and RHS2 cannot both make a request
ACTR Production Compilation ”p1&p2” initial utility is 0, but each time it is
recreated, it receives p1’s utility as a reward using the difference equation, so it approaches p1’s utility.
When ”p1&p2” starts firing on its own (due to noise), its utility can surpass that of p1, as it leads to rewards sooner.
Defining a production with P* you can use variable slot names but only if the slot variable is explicitly bound, e.g. a value of a named slot (1 level indirect).
A concise set of interpretation rules can compile declarative facts into specialized code (rules).
ACTR Production Compilation
When declarative knowledge leaves many interpretation choices, production compilation leads to incremental search for highutility programs.
But it does not fix scripts: productions are single actions.
I don’t like having space wasted on a slide ;)
ACTR Blending Module Generalization mechanism that produces contiuously
varying answers. See extras/blending to turn it on. Retrieve best compromise value by integrating
possible answers weighted by retrieval probability. = . ( ) V arg min V ∑ ( )*( - ( , ( ))i P i 1 Sim V V i ^2
Generalizes merging: the most active pool of identical AV structures. Could generalize partial matching, but see (*).
+blending> like +retrieve> but independent. The explicitly given values will be preserved. (*) The implementation uses the retrieval module to
select candidates (without discarding lowactivated).
ACTR More Extras WNLexicon: a module for querying WordNet 3.0.
Based on the Prolog bindings.
Threads: multitasking Extends the goal buffer to hold multiple chunks, e.g.:
(P starttwogoals =goal> isa curr ==> +goal> isa next1 +goal> isa next2)
Multiple calls to goalfocus have the same effect. Use goal> to halt the current (i.e. matched) goal, other
goals will still run. Style: check for empty buffer before requesting a chunk.
(I.e. don’t act upon that you don’t need its old contents.)
Temporal: nonlinear clock / timer.
ACTR Productions – More Details Queries specified for every buffer/module:
buffer: empty, full, requested, unrequested (e.g. stuffing)
state: free, busy, error; error: t, nil
Discouraged superconditions/actions: !eval! (any lisp =code) – nil causes
production to fail; ACTR variables are instantiated ![mv]bind! =varname (code) – also binds
the result[s]
buffer overwrite: e.g. =goal> =chunk, (from a slot), or =goal> =imaginal (from a buffer)
ACTR Productions – More Details +retrieval> =chunk, the chunk is expanded
to its AV structure. !safeeval! like !eval!, allows compilingout. Use !stop! as debug breakpoint. When P*defined RHS has a slotvariable with
value that does not belong to the chunk type, the chunk type is extended.
All parts or ACTR are called modules: printing, naming, random, buffer trace, procedural, utility, production compilation, goal, imaginal, declarative, device, vision, audio, motor, speech.
References
All the documents in the ACTR 6 distribution.