Wiki
Clone wikitutorial / ReferenceSheet
###Initialize a Sigma program
####Initialization before defining graph:
(init &optional <operator-names> <multiagent> <center-discrete-numeric-on-integer>)
multiagent: either the number of agents (integer) or a list of agent names
(init-operator <type-of-operator-specification> <operator-specification> &optional <detect-impasses>); If operators not specified in init, can be specified later via init-operators
- type-of-operator-specification: ‘symbols , ‘type or ‘predicates
- operator-specification: If type is ‘symbols then a list of operator name, if type is ‘type then either a type definition or the name of an existing type, if type is ‘predicates then a list of existing predicate names (predicates must have only universal discrete variables and no user provided variables of type operator ) to use in generating operator instances for combinations of discrete values across variables (each with its own operator id)
####Specify the form of selection to use for operators in the selected predicate:
(operator-selection <best or match-prob or Boltzmann>) ; best is the default
(new-type type-name &optional :numeric T :discrete T :min min :max max :constants constant-list)
(predicate predicate-name &optional :world <world> :arguments <arguments> :persistent <persistent> :unique <unique> :select <select> :exponential <exponential> :no-normalize <no-normalize> :perception <perception> :function <function>)
- arguments: list of arguments
- argument: (<argument-name> <type-name> &optional <unique-symbol>)
- unique-symbol: ! (select best) or % (maintain distribution) or $ (select expected value) or ^
(maintain exponential transform of distribution [* Experimental *]) or = (select by probability matching)
- persistent: T or nil (overrides defaults, which are T for closed world defaults and nil for open world)
- unique: name of argument that is non-multiple [set automatically if !, %, $ or = are used], or list of argument names if they are jointly unique
- select: (nil, best, prob-match, boltzmann or expected ): What kind of selection, if any to do over the unique variable, if there is one [set automatically if !, $ or = are used]
- exponential: T or nil (whether to exponentiate outgoing messages from WMVN [set automatically if ^ is used])
- no-normalize: T or nil (whether to normalize outgoing messages from WMVN; may be used to override default of T, and for unique predicates leads to combining positive actions via addition and negative actions via subtraction) - perception: T or nil (whether predicate can receive perceptual information) - function: Can be a number, a list of region functions, a list starting with row-major followed by a list of numbers (requires that all of the arguments be discrete, and that enough numbers are provided to exactly fill all of the regions in row-major order) or the name of another predicate (in which case it shares the same function
####Define conditionals:
(conditional conditional-name &optional :conditions ; Quoted list of predicate patterns :condacts ; Quoted list of predicate patterns :actions ; Quoted list of predicate patterns :function-default ; Default value for unspecified regions of function :function-variable-names ; Variables in function (in order) :normal ; Which variable(s) to normalize over in gradient descent learning :function ; Function defined over function-variable-names )
####Define evidence: Define evidence by adding it to individual working memories
(evidence evidence-list &optional empty-wms) (perceive evidence-list) ; More appropriate version for use in perception. It enables triggering of episodic and diachronic learning
(goal predicate-name evidence-list) ; First argument is name of original predicate, but the evidence list should use the name of its goal predicate (i.e., the original predicate name followed by *goal)
(learn &optional <quoted list of learning specifiers>)
Any form not mentioned is turned off
###Format for predicate patterns (conditions, condacts and actions)
(<predicate-name> <optional negation-symbol> <elements>) ; element-list must have an element for each argument in predicate definition
(1) a constant, yielding an interval of length 1 starting there,
(2) a , yielding the entire scope of the dimension, or
(3) a list (<min> <max>), where min and max are numbers specifying the
beginning and ending of interval ; interval is always closed at min and open at max - constant: a symbol or a number - filters: (:filter <filter> ...) - filter: (<constant-region> <constant> <coefficient>) ; Defines a linear value function over the constant region. The outer product of the filters for all of the pattern’s arguments becomes the message filter, which is multiplied times incoming messages. - variable: (<variable-name> optional offset or <affine transform> or <filters> or <not-equal test> or :explicit ) - variable name: A symbol (not a number) - offset: a number specifying how far to offset from variable value (converted to affine) - affine transform: (optional :from <variable-name> :offset <number or variable> :coefficient <nonnegative number> :pad <nonnegative number>) ; :from defaults to the current variable, :offset to 0, :coefficient to 1 and :pad to 0 for closed-world predicates and 1 for open-world predicates. At present it shouldn’t be necessary to use :from in an action, just use the corresponding condition variable, and things may not work right in some cases if you do. :from can be used in conditions to map from another variable, but it should only be used for variables in the same pattern. The offset can only be a variable in an action, and then the smallest maximal domain element for that variable is used as the offset. - not-equal test: (<> <variable-name>); if the variable is discrete, and the variable after <> is of the same type and has either been bound in the same pattern – if this is a condition – or in an earlier condition (if this is a condition, action or condact), then limit matches of variable to elements that are zero in <> variable (using an inverse of a delta function). - :explicit : In a sense does the inverse of a summarization. Should only be used with a variable in an action that is bound nowhere else, and where functional values are in [0, 1]. It takes the functional value it receives and puts a 1 in the position along the variable’s type corresponding to the fraction of the type before the functional value. < Highly experimental *>
###Format for a function ‘(<region-value> ...) or number ; If no function is specified, defaults to 1. Processes region-values left to right, so can provide a default value first, and then alter subregions of it later
- region-value: (< function> <constant-region> ...) ; One constant-region per variable in function
- function: either a single number (for a constant function) or a list of numbers for the constant and the coefficients associated with the variables
###Format for an item of evidence in evidence-list (<predicate-name> <optional negation-symbol or function> <items>) ; Negation not allowed in perception
- item: (<attribute> <constant-region>)
###Run a Sigma program Pass up to n (default max-messages) messages or until quiescence:
(run &optional n do-pre-run) [(r &optional n do-pre-run)]
(decide &optional n max-messages) [(d &optional n max-messages)]
Run n (default 1) trials (each of which makes decisions until halted):
(trials &optional n continue) [(ts &optional n)] ; continue is nil
(m message-number)
###Debug Recompute a message from one node to another with lots of tracing:
(debug-message node-number1 node-number2 &optional regions)
(undo-debug-traces)
(product-plms plm1 plm2)
(compare-gmas gma1 gma2)
(compare-gma-lists gmal1 gmal2)
Break before a decision where there is a positive message between any listed pair of node numbers
break-on-positive-messages
(g &optional size conditional-name) ; Size is small, medium or large
(highlight-node node-number &optional color) [(h node-number &optional color)]
(scroll-to-node node-number) [(s node-number &optional color)]
(sh node-identifier &optional color)
###To print Alpha memories:
(print-alpha-memories &optional conditional-name symbolic stream) [(pam) &optional conditional-name {t trace-stream}]
(print-conditional conditional &optional current-function reordered- conditions stream) [(pc conditional-name &optional current-function reordered- conditions stream) ] [(pcs &optional current-function reordered-conditions stream) ] ; All
(pcf conditional-name &optional array) (pcfs &optional array) ; Print all defined conditional functions (print-expected-value-cond-function conditional-name &optional variable array) ; Print expected value of conditional’s function along (:normal or only) unique/distribution variable (or variable specified) [(pevcf conditional-name &optional variable array)]
(print-pattern-matches conditional-name &optional stream) [(ppm conditional-name)]
(print-dimension dimension-min dimension-max &optional variable(s) symbolic stream weight)
(print-factor-function node-name &optional symbolic stream)
(print-factor-step factor-step node &optional stream) (print-factor-steps node &optional stream)
(pafs &optional array) ; Print all defined functions (pcfs &optional array) ; Print all defined conditional functions (ppfs &optional array) ; Print all defined predicate functions
(print-graph &optional symbolic stream)
(graph-statistics &optional stream) [(gs &optional stream) ]
(pem &optional predicate-name) ; Print function(s) in episodic memory (pep) ; Print variable nodes with predictions for episodic predicates
(print-link link &optional symbolic stream)
(print-link-depths &optional stream) [(plds &optional stream)]
(print-link-counts &optional nhighest minimal-count) [(plc &optional nhighest minimal-count) ] ; nhighest is how many (from high to low) to print ; Don’t print link direction if its count is less than minimal-count
(print-link-message-sizes &optional nhighest minimal-size) [(plms &optional nhighest minimal-count) ] ; nhighest is how many (from high to low) to print ; Don’t print link direction if its message size is less than minimal-size
(print-message trace-header link index &optional symbolic reverse print-first stream) (print-message-times &optional stream) ; trace-message-times must have been set to T before running for this to work [(pmt)] (print-in-messages node &optional symbolic stream) [(pim node-name) {T T}] (print-out-messages node &optional symbolic stream) [(pom node-name) {T T}] (pm from-node-number to-node-number &optional symbolic stream)
(message-statistics &optional stream) [(ms &optional stream) ]
(print-node node &optional symbolic stream) [(pn node-id &optional symbolic stream) ] ; node-id is either number or name
(print-factor-nodes &optional symbolic stream) [(pfns) {t trace-stream }] Function factor nodes: (print-functions &optional symbolic stream) [(pfs &optional as-array) {t trace-stream }]
(print-variable-nodes &optional symbolic stream) [(pvns) {t trace-stream }]
(print-node-names &optional stream) [(pnn) {trace-stream )]
(print-node-neighbors node &optional stream)
(print-node-type node &optional stream) [(pnt node-number) ]
(pid id-number) ; Print an operator description from its id number (pids) ; Print descriptions of all operators from ids
(print-plm {plm or node-number or predicate-name or conditional-name} &optional symbolic stream limits) [(pplm {plm or node-number or predicate-name or conditional-name }) {t trace-stream nil}]
(parray {plm or node-number or predicate-name or conditional-name} &optional regions summarize stream) [(pa {plm or node-number or predicate-name or conditional-name} &optional regions summarize stream)] ; Prints functions of any dimension as arrays
(print-smart {plm or node-number or predicate-name or conditional-name } &optional symbolic stream summarize limits) [(ps {plm or node-number or predicate-name or conditional-name} &optional stream summarize limits)] ; Intelligently decide whether to use pplm or pa based on max-span-pa (and whether or not to print an array as regions based on max-fraction-pa-regions)
(print-predicate predicate &optional current-function stream)
(print-predicates &optional current-function state stream) [(pps &optional current-function state)]
(print-predicate-from-name predicate-name &optional stream) [(pp predicate-name)]
(print-predicate-perception-function predicate &optional symbolic stream limits) [(pppfn predicate-name &optional limits) ] [(pppfns)] ; Print contents of all perception functions
(ppf predicate-name &optional array) (ppfs &optional array) ; Print all defined predicate functions (print-expected-value-pred-function predicate-name &optional variable array) ; Print expected value of predicate’s function along (:unique or only) unique/distribution variable (or variable specified) ```lisp [(pevpf conditional-name &optional variable array)]
(print-preferences) [(pprefs)]
(print-queues &optional symbolic stream) [(pqs) {t trace-stream}] (print-queue queue-number symbolic stream) [(pq queue-number) {t trace-stream }]
(print-region region plm &optional symbolic stream)
(print-plm-slices plm &optional symbolic stream) [(ps plm) {nil T} ]
(print-type type &optional stream) [(pt type) {nil}]
(print-type-from-name type-name) [(ptn type-name) ]
(print-types &optional stream) [(pts) {nil}]
(print-svariable svariable &optional stream) (print-svariables svariables &optional stream)
(print-wm &optional symbolic stream) [(pwm &optional as-array stream) {t }]
(print-wm-basic (&optional pred-list array stream) [(pwmb (&optional pred-list array stream)]
(print-pred-wm predicate &optional symbolic stream limits) [(ppwm &optional predicate-name as-array stream) {t nil}]
(print-pred-function predicate &optional symbolic stream limits) [(ppfn predicate-name &optional limits as-array stream) {t}]
(print-pred-wm-function predicate &optional symbolic stream limits) [(ppwmfn predicate-name &optional limits) {t trace-stream }]
(print-wm-vn predicate &optional symbolic stream limits) [(ppvn predicate-name stream) {t nil}]
(best-in-plm plm &optional state)
(conditional-from-name conditional-name)
(conditional-function-node-name-from-conditional-name conditional-name) [(cfn conditional-name)]
(link-from-nodes node1 node2) (link-from-numbers node-numer1 node-number2)
(message-from-numbers node-number1 node-number2) (message-function-from-numbers node-number1 node-number2) [(mffn node-number1 node-number2)]
(mp node-number1 node-number2)
(node-from-name node-name &optional node-type) (node-from-number node-number) [(nfn node-number) ]
(node-function-from-number node-number) [(nffn node-number)]
(node-neighbors node)
(operator-in-state state-number &optional agent)
(predicate-from-name predicate-name)
(perception-node-from-name predicate-name)
(get-symbol-name ordinal type)
(type-from-name type-name) (type-from-predicate-argument argument predicate)
(value-in-state predicate-name state-number argument-name &optional agent)
(variable-from-name name svariables)
(nonstate-value predicate-name)
(vn-posterior predicate) [(vnp predicate-name)]
beta-memories
alpha
(variable node or nil): End of alpha network for new patternold-beta
(variable node or nil): Beta memory or end alpha network for previousnew-beta
(variable node or nil): New beta memory after beta factorconditional
name
(symbol): Name of conditionalconditions
(list of condition patterns)condacts
(list of condact patterns)actions
(list of action patterns)variables
(list of svariable structures)function
(constant or list of linear region functions): Function of function-variable-names (default 1)function-default
(0 or 1): Value to be used for unspecified regions in conditional’sfunction
(default 0)function-node
(a node): Factor node in which conditional’s function is storedfunction-variable-names
(list of variable names used in function, in order used)condition-later-variable-names
(list of lists of variable names): Variables in conditions used later in conditionalcondact-later-variable-names
(list of lists of variable names): Variables in condacts used later in conditionalaction-later-variable-names
(list of lists of variable names): Variables in actions used later in conditionallast-memory
(node ): Last beta memory in conditional’s graphlast-condition-memory
(node): Last condition alpha memory in conditional’s graphnormal
(nil or variable name): Variable over which to normalize during gradient descentshared-action-beta
(beta memory): Variable node connecting conditional’s actionsmap
(T or nil): Whether to summarize out unique variables at node by max (versus integration)learning-rate
(number in (0,1]): Learning rate for conditional’s function (if specified)smoothing-parameter
(number): Smoothing parameter for CF node (if specified)episodic
(T or nil): Whether conditional is part of episodic memory (default nil )reordered-conditions
(list of condition patterns): In order as automatically reordereddescendant ;(within node )
node
(node): Descendent nodeparents
(list of node numbers): Parents of node by which it descendsdescendant-link ;(within node)
link
(link): Descendent linkdirection
(0 or 1): From variable (0) or factor (1) nodefrom
(node): Number of source node of link directionto
(node): Number of target node of link directiondimension ;(within region )
min-slice
(slice ): Lower bound on dimensionmax-slice
(slice ): Upper bound on dimensionweight
(number): Weight of dimension’s variable in linear functiondiscrete
(T or nil): Whether dimension is discrete
factor-step ;(within node ): Define a summarization or combination (product) step
type
(INTEGRAL , MAX or PRODUCT ): Operation to performargument
(dimension number or link): Argument of operation
graph
types
(list of type): List of all of the types in the graphpredicates
(list of predicate ): List of all of the predicates in the graphnodes
(list of node): List of all of the nodes in the graphnode-vector
(vector of nodes): Vector of all of the nodes in the graphlinks
(list of link)conditionals
(list of conditional ): List of all of the conditionals in the graphpattern-vars
(list of pattern-variable ): Vestigial for explicit sharing of nodes across conditionalsprequeue
(list of message ): List of messages to go into queuesqueues
(queues of message )node-count
(integer): Number of nodes in graphlast-node
(link ): Last node created in graphpositive-preferences
(list of nodes): Positive action factor nodes for selected predicate negative-preferences
(list of nodes): Negative action factor nodes for selected predicate depth
(integer): Depth of graphagents
(integer): Number of agentsoperator-type-name
(name of type): Name of type to use for operators in selectioninitialized
(T or nil): Whether graph has been initializedoperator-predicates
(list): Predicates that determine operators, if anyselected-predicate
(predicate): The selected predicate if there is onechanges
(list of node): Assumption nodes whose functions have changed goals-set
(T or nil): Whether predicate goals have been set (by initializing WMFNs) goal-list
(list of evidence lists): Lists from calls to goal for initializing predicate goalsagent-type
(type): Definition of agent typepredicate-type
(nil): A symbolic type that includes all of the predicate namessurprise-predicate
(predicate): Predicate with a global measure of surprise (in PBFN)surprise-distribution-predicate
(predicate): Predicate with surprise distribution over predicates (in PBFN)surprise-predicates
(list of predicate): List of predicates for which surprise will be computedprogress-predicate
(predicate): Predicate with a global measure of progress (in PBFN)progress-distribution-predicate
(predicate): Predicate with progress distribution over predicates (in PBFN)progress-predicates
(list of predicate): List of predicates for which progress will be computeddifference-predicate
(predicate): Predicate with a global measure of difference (in PBFN)difference-distribution-predicate
(predicate): Predicate with difference distribution over predicates (in PBFN)difference-predicates
(list of predicate): List of predicates for which attention will be computedattention-predicate
(predicate): Predicate with a global measure of attention (in PBFN)attention-distribution-predicate
(predicate): Predicate with attention distribution over predicates (in PBFN)attention-predicates
(list of predicate): List of predicates for which attention will be computed
link ;Link between a pair of nodes
map
(smap)nodes
(vector of two nodes ): Variable and factor nodes on linkcontents
(vector of two plms): Messages from variable and factor nodes on linkdepths
(vector of two integers): Depth of link in each direction from WM and FF factorsloop-depths
(vector of two integers): Pseudo-depth of link within a loop in each direction from WM and FF factorsinits
(vector of two integers): Decision on which message from node was last initializedincoming
(vector of two T or nil): Whether incoming messages in parallel modein
(T or nil): T for links in actions and condacts, nil for conditionsout
(T or nil): T for links in conditions and condacts, nil for actionscounts
(vector of two integers): Number of messages sent in link directions on current decision cyclestale
(T or nil ): T for links that may not have the correct value currently stored on them given the input messages at the source nodesmap ;(within link) How variable node variables map onto variables in factor function (short for Sigma map)
vfactor
(vector of integers): Factor node variable index from variable node variable indexfvar
(vector of integers): Maps from summarized product in factor node back to variable nodemessage ;(within queue )
index
(0 or 1): Index into a link’s arrays (0 for variable and 1 for factor) for directionlink
(link): Link along which message is to be sentwm-driven
(T or nil): Whether message is driven by change in WMnode ;Factor and variable nodes in graph
name
(symbol)type
(factor or variable )subtype
(alpha , beta, delta, combine , constant , function , inversion , offset, split or wm)subsubtype
(match , negative , nil, positive or sum)object
(capi:expandable-item-pinboard-object ): Object in graphical window for node evidence
(list of evidence nodes)variables
(list of svariables or list of pairs of svariables for delta factors)factor-steps
(list of factor-steps)function
(a plm ): Function for factor nodeslinks
(list of links): Links attached to nodenumber
(integer): Node’s numberaction
(T or nil ): Whether is a special action node for combining shared actionsdescendants
(list of descendant ): Nodes dependent on values of assumption nodesdescendant-links
(list of descendant-link): Links dependent on values of assumption nodesregion-pad
(nil or 0 or 1): What padding to use for new regions in offsets and affinesnormal
(nil or integer): Dimension over which to normalize during gradient descentlinear-filter
(T or nil ): Whether is a filter factor node with a linear filterpattern-type
(condition , action , condact or nil): What kind of pattern a variable node is associated withexponential
(T or nil): Whether to exponentially transform messages out if WMVNnormalize
(T or nil): Whether to normalize outgoing messages from nodeintegral
(T or nil): Whether to summarize out unique variables at node by integration (versus max) [Is overridden if default-integral is nil]predicate
(predicate ): When node is a WM FN or FAN or PFF points to corresponding
predicatelearning-rate
(number in (0,1]): Learning rate for CF node (if specified on conditional) smoothing-parameter
(number): Smoothing parameter for CF node (if specified on conditional)changes
(non-negative integer): Number of times node function has been changed by gradient-descent learningshared-functions
(list of CFF nodes): Conditional factor function nodes that share the same functionvariables-same
(list of variable-node names): Adjacent variable-node names for a beta factor with the same variables (in the same order)restriction
(plm): Boolean function multiplied times results of learning to insure that regions that were originally 0 remain 0function-name
(symbol): For a function node, name of conditional or predicate that generated itwmvn
(T or nil): Whether node is a working memory variable nodebeta-non-full
(T or nil): If node is a beta factor, whether its function is not a constant 1; that is, whether there are not-equal (<>) tests to be performed assumption
(T or nil): Whether is an assumption node (messages out don’t change during message passing)vector
(T or nil): if the node performs vector normalizationssurprise-predicate
(predicate): Surprise predicate pointer from predicate's function nodepattern-variable ;Variable for explicit pattern sharing (vestigial)
name
(symbol)wm-memory
(node): WM variable node for sharingvariable-names
(list of symbols): Names of variables in WM variable nodeplm ;A piecewise linear function
rank
(integer): Number of dimensionsactive
(vector of T or nil ): T for variables active (vestigial?)variables
(vector of svariables ): Variables corresponding to dimensionsarray
(PLM array): Array of regionsslices
(vector of lists of slices ): Slices through the dimensionsremoved-unneeded-slices
(T or nil): Whether have removed unneeded slicespiecewise-constant
(T or nil): Whether regions in function are all constant in valuepredicate ;Relational structure for use in conditionals
name
(symbol)world
(closed or open): Defaults to openarguments
(list of <arguments>)wm
(node): Working memory factor nodewm-variables
(list of variables): Variables in predicate’s working memory factor nodeem
(node): Episodic memory factor nodeem-predicate
(predicate or nil): Episodic memory predicate for predicatefunction
(constant or list of linear region functions): Function of function-variable-names (default 1)function-default
(0 or 1): Value to be used for unspecified regions in predicate’s function (default 0)function-node
(a node): Node in which predicate’s function is stored (if defined)function-variable-names
(list of variable names used in function, in order used)perception
(T or node or nil): If T or node, there is perception for the predicate (user specifies T, system replaces with pointer to perception node) (default is nil)perception-temp-mem
(a plm): Temporary memory for aggregating perceptions during a cycle before storing the result into the factor nodepersistent
(T or nil): Whether values of predicate persist in its WMFNpredict
(predicate): Predicate for diachronic prediction of current predicateprediction
(node or nil): If predicate is used for diachronic prediction of another predicate then WMFN for other predicate; else nilprediction-link
(link): Prediction link for diachronic processingexponential
(T or nil): Whether to exponentially transform messages out of WMVNassign-ids
(a plm): Function used to assign ids via a factor attached to WMVNsoperators
(integer): Number of operator (ids) corresponding to predicate, if anyfirst-operator
(integer): First id for operators corresponding to predicate, if anyid-contents
(vector of lists): Operator descriptions associated with idsoutgoing-vn
(node): WMVN for conditions, condacts and chained actionsincoming-vn
(node): WMVN for actionsno-normalize
(T or nil): When true, overrides the default for non-multiple predicates and doesn’t normalize the messages coming out of the WMVN node (and for unique predicates, combines positive actions via addition and negative actions via subtractionunique
(list of symbols): List of names of non-multiple argument(s)unique-for-gdl
(list of symbols): List of names of non-multiple argument(s) for use in divisor within gradient-descent learningselect
(nil, best , prob-match, boltzmann or expected ): What kind of selection, if any to do over the unique variable, if there is oneagent-arg-index
(positive integer): Index in arguments of agent argument if there is onefan
(node): Combination factor node for actionsreplace
(T or nil ): Whether to replace current values in WMFN for the predicate with values in actions (versus updating current values)learning-rate
(number in (0,1]): Learning rate for predicate’s function (if specified)smoothing-parameter
(number): Smoothing parameter for predicate’s function (if specified)condact-conditionals
(list of conditionals): Conditionals that use the predicate in a condactepisodic
(T or nil): Whether predicate is part of episodic memory (default nil)no-models
(T or nil): Whether to ignore predicate in generating perception and action models (default nil)goal-predicate
(predicate): Predicate in whose WM the predicate’s goal is stored (its name is the original predicate name with goal added at end)progress-predicate
(predicate): Predicate whose function tracks amount of progress towards predicate’s goal (its name is the original predicate name with progress added at end)action-function
(<function>): When doing automatic action modeling, the action model for the predicate is initialized with this function. At the moment this is a hack you shouldn’t use unless you really know what you are doing, as the variables used in this function are not the predicate’s variables. perception-function
(<function>): When doing automatic perception modeling, the perception model for the predicate is initialized with this function. At the moment this is a hack you shouldn’t use unless you really know what you are doing, as the variables used in this function are not the predicate’s variables.vector
(T or nil): whether this predicate represents a vectorsurprise-predicate
(predicate): Predicate for surprise mapprogress-predicate
(predicate): Predicate for progress mapdifference-predicate
(predicate): Predicate for difference mapsurprise-predicate
(predicate): Predicate for attention mapautomated-perception
(T or nil): Whether this predicate is automatically created by the template for perception learning to hold the learned perception functionno-surprise
(T or nil): Whether a predicate should not have surprise computed for itgoal
(<function>): Goal function for predicatequeue ;List of messages in queue
head
: Pointer to pseudo message that remains fixed at front of queuetail
(message): Pointer to last message in queueregion ;(within plm)
constant
(number): Constant in region’s linear functiondimensions
(vector of dimensions )maximals
(vector of (min max) lists): Segments of dimension yielding maximal valuesbad
(T or nil): Whether translated region is completely outside of type’s scopeslice ;(within plm): Location of a slice across a dimension
location
(integer)
stype ;Variable/dimension type (short for Sigma type)
name
(symbol)numeric
(T or nil): Defaults to nildiscrete
(T or nil): Defaults to nilconstants
(list of symbols): Defaults to nil (when specified, discrete is set to T)min
(number): Beginning of range of type (defaults to 0 when constants specified)max
(number): End of range of type (defaults to number of constants when constants specified)span
(positive integer): abs(max-min)svariable ; (short for Sigma variable)
name
(symbol)type
(type)unique
(T or nil ): Whether variable is unique or universal/multipleselect
(nil, best , prob-match, boltzmann or expected ): What kind of selection, if any to do over this variable.
###System Types
Users should never define types with these names even when the system doesn’t define them
It is also safest to avoid predicates ending in: goal or progress if using architectural goal
specification; and *episodic , -learn, -select and –retrieve if using episodic learning.
Detect-impasses [open]: (state state) (value flag %) ; Whether to detect impasses in the state Evaluate-operator[open]: (evaluate operator) (operator operator) ; If detect-impasses is true Halt[closed]: Impasse[closed]: (state state) (operator operator) (type impasse !) ; If detect-impasses is true (and will have (agent agent) argument if multiagent) Selected[closed]: (state state) (operator operator !) ; If operators have been defined (and will have (agent agent) argument if multiagent) State[open]: (state state) ; Will have (agent agent) argument if multiagent Time[closed]: (value time) ; Number of decisions that have passed
action-list
: nil (list of forms to execute as external actions)
adaptive-learning-rate
: nil (t) ; Dynamically determine learning rate at each node (when not overridden by learning rate on conditional) [Only one of this and learning-rate-fraction-of-smoothing-parameter should set] [ Not recommended at present ]
adaptive-smoothing
: t (nil) ; Dynamically determine smoothing (for learning) at each node
all-condact-filters-pad-1
: nil (t) ; Invert filter messages for condact messages moving away from WM (this is already done for condact messages heading towards WM)
always-max-operators
: nil (t); If true, only use max when summarizing out operators
arousal
: nil (positive number ) ; Level of arousal [default is off] (set manually)
automatically-reorder-conditions
: t (nil ) ; Automatically reorder conditions in conditionals for efficiency
automatic-action-models
: nil (t) ; Automatically create conditionals for action modeling (aka learning of transition functions)
automatic-perception-models
: nil (t) ; Automatically create conditionals for perception modeling (including map learning)
automatic-reinforcement-learning
: nil (t ) ; Automatically create types, predicates and conditionals for reinforcement learning
bipartite-graph-display
: t (nil) ; Use new form of factor graph display in graph/g
center-discrete-numeric-on-integer
: nil (t); If true, center unit regions for discrete numbers around the integers rather than beginning the regions at the integers (needs to be set via optional argument to init rather than directly) [Warning : May not work correct at this point with either impasses or multiple agents.]
compute-attention
: nil (t) ; Compute attention for predicates with progress/difference and/or surprise
compute-progress
: nil (t) ; Compute progress (and difference) for predicates with goals
compute-surprise
: nil (t) ; Compute surprise for predicates with functions
condacts-change-wm
: nil (t) ; Condacts send messages back to WM factor node (but don’t actually lead to changes in WM)
break-on-positive-messages
: nil ; A list of node-number pairs (each a list). Breaks before any decision with a non-empty message between those nodes at quiescence
cycle-message-counts
: nil ; If tracing cycles, history of messages per cycle
debug-descendants
: nil (list of node numbers) ; Trace descendant and message initialization computations for node numbers in list
debug-init-descendants
: nil (‘summary or ‘all ) ; Trace descendant initialization, either just summary statistics (‘summary ) or also how many descendants each has (‘all)
decision-count
: 0 ; Number of decisions since init
default-integral
: t (nil) ; Use integral by default (rather than max) for unique variables
detect-impasses
: nil (t) ; Whether to impasse on operator selection if tie (needs to be set via optional argument to init-operators rather than directly)
diachronic-prediction
: nil (t) ; Predict results of actions/operators
discount-wm
: t (nil) ; Discount (by wm-discount-factor ) messages from WMFNs to FANs for selection predicates
display-subgraph
: nil (t): Automatically pop up a restricted window showing the region around a node when go to it in the graphical display via sh (or via the entry box)
do-not-learn
: nil (list of conditional and predicate names): Conditionals and predicates for which not to do gradient-descent learning
episodic-learning
: nil (t, ‘open, ‘closed ) ; Perform episodic learning. Should use the function learn
to set and unset this variable
epsilon
: .0000001 (real number) ; Accuracy within which to compute absolute value comparisons (when use-relative-epsilon is nil)
epsilon2
: .0001 (real number) ; Span of continuous maximal regions
exponential-product-gradient
: nil (t) ; Use an exponential product gradient rather than a traditional additive gradient. This is still experimental and not yet ready for general use
extend-type-constants-by-evidence
: nil (t) ; Instead of signaling an error if a constant is used in evidence or perceive that isn’t in the type, extend the type to include it
fan-constant
: .001 ; Constant at open-world FAN nodes to ensure that actions for non-matching conditionals don’t clamp the WMVN at 0
feedback-to-functions
: t (nil) ; Send feedback messages to factor function nodes
field-beyond-label
: 3 ; Extent of field beyond length of largest label
function-default
: 0 ; Value to use by default for unspecified regions of conditional/predicate functions
gdl-divide
‘new (t, nil) ; Divide gradient by function-message product (new version uses a different divisor within each region of universal variable values)
gdl-subtractive-normalization
t (nil) ; Use subtractive rather than divisive normalization in gradient-descent learning
gradient-subtract-average
t (nil) ; Subtract average of gradient before updating
integrate-universal-in-unique
nil (t) ; Integrate rather than max over universal variables in unique functions (very experimental)
infinity
: (most-positive-fixnum-10) ; For scope of temporal variable
base-level-state
: 0 ; State at which processing starts in reflective hierarchy
learning-rate
: .05 (real number) ; Learning rate for gradient descent
learning-rate-fraction-of-smoothing-parameter
: nil (positive number) ; If a number, the learning rate is set to this times the smoothing parameter [Only one of this and adaptive-learning-rate
should be set] [Intended to be used in conjunction with adaptive smoothing , and to be <1]
learn-no-normal
: nil (t) ; Learn for conditionals without a normal variable
learn-open
: nil (t) ; Learn for open-world predicates as well as closed-world ones
learn-via-gradient-descent
: nil (t) ; Use gradient descent on function factor functions. Should use the function learn to set and unset this variable
max-decisions
: 500 ; Maximum number of decisions to execute when no value specified
max-elaboration-cycles
: 50 ; Maximum number of (parallel) cycles per decision
max-final-discrete
: 10 ; Maximum number of items in the final region along a discrete numeric dimension to list explicitly
max-fraction-pa-regions
: .5 (in [0,1]); Threshold for shifting from regions in parray within print-smart
max-gdl-increment
: 1 (positive number or nil); Maximum increment added during gradient-descent learning (rescales increment after learning rate applied if the largest value is greater than this)
max-messages
: 10000 ; Default maximum number of messages (per decision)
max-messages-links
: 20 ; When non-nil, set max-messages to this times number of links
max-span-pa
: 10 ; Threshold on size of symbolic dimension in shifting from parray to pplm in print-smart
max-states
: 100 ; When number of states (height of goal hierarchy)
max-time
: 999999 ; Size of temporal dimension (and max number of cycles, if time is being tracked via track-time, due to incrementing time each cycle)
message-count
: 0 ; Number of messages since init
message-protocol
: ‘serial (parallel ) ; Pass messages serially versus simulated parallel
minimal-parray-field
: 13 ; Minimum size of a field for a PLM array print
multiagent
nil (t) ; Default to multiple agents (mostly set automatically within init )
non-operator-best-select
: ‘random (‘first ) ; Choose randomly among maximals for regions in predicates other than selected (or first maximal)
one-way-c-a-betas
: t (nil) ; Use unidirectional beta networks within conditions and actions
open-actions-like-condacts
: nil (t) ; Invert filter messages for open-world actions, and combine via product, as normally do action part of condacts
open-conditions-like-condacts
: nil (t) ; Connect outgoing message from WMFN directly to WMVN (via product) instead of going through a VAN/FAN (probabilistic or) path (and invert filter messages for open-world conditions if all-condact-filters-pad-1 is T)
open-world-wmfns
: nil (t) ; WMFN nodes are generated for open-world predicates
operator-best-select
: ‘random (‘first ) ; Choose randomly among maximals for operator in selected predicate (or first maximal)
parameter-override-reset
: nil (list of parameter names [without bracketing *s]) ; These parameter are not reset by reset-parameters (this parameter is itself not automatically reset)
perceive-list
: nil (list of forms to execute for perception)
pre-d
: nil ; Forms to evaluate after messages are sent but before decision and WM changes (occurs after both runs for diachronic decisions)
pre-run
nil ; Forms to evaluate before messages are sent within a decision (only for the first run within a diachronic decision)
pre-t
: nil ; Forms to evaluate before each trial begins
pre-ts
: nil ; Forms to evaluate before sequence of trials begins
print-regions-on-separate-lines
: nil (t); Print each region in a PLM on a separate line
post-d
: nil ; Forms to evaluate after decision is made and WM is changed
post-run
nil ; Forms to evaluate before messages are sent within a decision (only for the first run within a diachronic decision)
post-t
: nil ; Forms to evaluate after trial is over (on a explicit halt, via haltp)
range-field-beyond-label
: 3 ; Extent of range field beyond twice length of largest label
reset-parameters-in-init
: t (nil) ; Whether to automatically reset all parameter in init (this parameter is not itself reset in init)
save-message-state
: t (nil) ; Only reinitialize messages across decisions that depend on changed functions
smoothing-parameter
: .000001 (number) ; Minimum value in a learned function
sparse-product
: t (nil) ; Use optimization for multiplying a sparse function times another function
sparse-product-threshold
: number in [0,1]; When sparse-product is T, use optimization when function density below threshold
specify-function-variable-names
: t (nil) ; Explicitly specify variables used in function
symbolic-trace
: t (nil) ; Traces should be symbolic
temperature
: (number) ; Current temperature for Boltzmann selection (not for user setting)
temperature-minimum
: 1/60 (number) ; Temperature remains above this to avoid overflow
temperature-schedule
: #’inverse-log (function) ; Function that updates temperature on each trial (default sets it as 1/log(1+trial-count)
threshold-for-dense-connection
: 5 ; If the number of bidirectional links at a variable node is more than this threshold, break up into a binary tree of nodes and links
trace-affine
: nil (t) ; Trace computation at affine transform factor node
trace-attention
: nil (t) ; Trace attentional processing (including appraisals)
trace-average
: nil (t) ; Trace the processing that creates an averaged version of a PLM
trace-combine
: nil (t ‘region) ; Trace combination (product/sum). Print individual region combinations if ‘region
trace-cycles
: t (nil) ; Trace elaboration cycles
trace-decisions
: t (nil) ; Trace decision cycles
trace-el
: nil (t) ; Trace episodic learning
trace-empty
: nil (t) ; Print regions in PLMs with 0 values
trace-full
t (nil) ; Print regions in PLMs with 1 values
trace-gdl
: nil (t or list of node numbers, node names, conditional names and predicate names) ; Trace gradient-descent learning (for all nodes if t or just the specified function factor nodes)
trace-impasses
: t (nil) ; Print impasses at decision time
trace-link-depths
: nil (t) ; Trace depths of links for messages
trace-maximals
: nil (t) ; Trace lists of maximal regions
trace-messages
: nil (t or a list of node names or numbers) ; Trace messages (to and from nodes named/numbered)
trace-message-times
: nil (t) ; Trace times taken for messages
trace-perception
: nil (t) ; Trace perception
trace-performance
: t (nil) ; Trace performance data about decisions
trace-preferences
: nil (t) ; Trace preference messages for selected predicate
trace-queue
: nil (t) ; Trace the queue to which each new message is added
trace-states
: t (nil ) ; Trace addition and deletion of states from hierarchy
trace-stream
: t (nil ) ; Default stream to use for traces
trace-summarize
: nil (t) ; Trace summarization (integral/max)
trace-transform
: nil (t) ; Trace transformations (including normalizations)
trace-trials
: t (nil ) ; Trace trials
trace-wm-changes
: nil (t or a list of predicate names) ; Trace the process of deciding which WM changes to make (just for predicates listed if there is a list)
(trace-wm-changes [boolean or list]) ; Set trace-wm-changes and trace-states
trace-wm-driven
: nil (t) ; Trace whether messages are wm-driven
track-graph-messages
: nil (t) ; Store messages at the end of each decision into a list
track-time
: t (nil) ; Create time predicate and increment each decision (this parameter is not automatically reset during init)
trial-count
: 0 ; Number of trials since init
unique-weights-only
: t (nil) ; Generate error if region has a weight for a universal variable
unsup-categories
: 5 (integer) ; Number of categories for unsupervised learning
use-relative-epsilon
: t (nil) ; Use relative rather than absolute numeric comparisons
wm-discount-factor
: .01 (positive number) ; Factor to use when discount-wm is T
###Saving Sessions & Graphs
save a graph to a file
(save-graph "mygraph")
(load-graph "mygraph")
(save-sigma-session "mysession")
lispinit.mem
save-sigma-session ()
save-session
functions save the file as a binary so you execute that file to restore your previous session, lispworks may require you to enter your license & key on the commandline
###Learn a naïve Bayes classifier from a data set Each instance in the data set is one line in a file, with values for its attributes separated by commas
Learn from training data set and test on test data set
(gdl train test &optional unsupervised training-cycles)
Define a data set:
(define-data-set ‘(attribute-domain-list ...) &optional unsupervised)
Specify an instance to be loaded into WM (all of WM is emptied first):
(instance inst-string &optional omit not-in-data)
Set up training and test data sets:
(setup-gd filename &optional test omit not-in-data)
- test: when T, learning is turned off (and it is turned on when it is nil).
- omit: Attribute names in the list are not read in (this is used to omit the concept name when predicting it during a test).
- not-in-data: Attribute names in the list don’t exist in the data (this is used for the category in unsupervised learning).
###Parallel Execution
(run-parallel function parameter-list &optional filename)
- filename : string representing a lisp file containing a definition for the function to be run
over the list of parameters (not needed if you are running a function that’s already in sigma) - function : defined in filename, takes a single argument
- parameter-list: a list of input parameters to be given to function
Example:###Regression TestingSIGMA> (run-parallel 'runmodel '(1 0 2.5 3) "~/sigma/model.lisp")
- run all tests in parallel listeners
SIGMA> (regression-testing)
- run all tests serially in current window
SIGMA> (run-all-regression-tests)
Updated