Document Sample
alg Powered By Docstoc
					                                     Chapter 4

                             Algorithm of S-96

4.1 General comments

         Most ANSs have a background controller that guides overall net operation. For example,

backpropagation nets require strict scheduling of signal propagation between layers when learning,

and discrete Hopfield nets require distinct epochs of propagation. S-96 is somewhat more

autonomous because its floating FOA does not need global information, so its control can probably

be programmed at the unit level. However, aspects such as learning and the S-96 shift between

emanation state and flow state are better regarded as part of a background controller. Therefore the

S-96 also is considered here to have a background controller, or algorithm.

         Below is the general algorithm of the S-96 background controller. Various details of

decision making, consistency checking, range checking, node and link creation, etc. are omitted for

the sake of clarity. The flowchart in Figure 23 closely follows this pseudocode description.

Figure 24 shows the overall functionality of the system, and roughly corresponds to the procedures

in the simulation program.

4.2 The algorithm in pseudocode

Preliminary step:

The user builds a knowledge base in the form of a semantic net. (This can be stored in a separate file

in the special format required by the program, or else hard-coded into the program.)

The algorithm:

 Input query. User supplies one to three node names and the desired relationship to find. System

    supplies constant external input of 1.0 to each of the user-supplied query nodes. System decides

    which node corresponds to the solution node (this is usually a user-invisible conjunctive node),

    and the waveform that should correspond to that solution node to solve that query. If the

    solution node does not already exist in the knowledge base, the solution node is created but is

    linked to the fantasy node and very limited links are created to the solution node.

 Initialize. System chooses an initial T-link. (Theoretically, any T-link is acceptable as an initial

    T-link.) Miscellaneous technical bookkeeping: Old values are same as new values, since we are

    just starting: (R' and D' have not been found yet.) T-link' <- T-link

 State update. Reset activations. Reset all node activations to 0, including conjunctive nodes,

    except for those with external input, and S, which must have activation 1. With respect to the

    current T-link, collect all emanating T-links and improper adjacent T-links. ("Improper

    adjacent" means include the current T-link with the "proper adjacent" T-links.)

 Emanate from FOA: With S node at activation 1, send its signal to all adjacent nodes over the

    weight links w, wave links v, and tid links x, and calculate the values within all those adjacent

    nodes. This will produce a set of candidate SRD nodes, each of which represents a T-link.

 Detect and report any solutions. Is the solution node firing with activation level close to 1.00

    and with the solution waveform? (The simulation currently uses a threshold of 0.80 since this

    exceeds the activation that would be caused by only two nodes of the maximum query arity

    (viz., 3), since activation of 2/3 = 0.67 < 0.80.)

        Yes: Success, relationship found, report solution and continue.

        No: Failure, relationship not found, continue searching, using same S node as the focus

         node, go to next step.

 Find winning T-link. The "winning T-link" is the T-link having the maximum value determined

    by the employed heuristic. (The search could be more powerful in the future by relaxing the S-

    adjacency constraint.) If the winning T-link must equal the current T-link, so be it. Find which

    of the three winning nodes of next T-link are S, R, D nodes. If T-link is different than T-link'

    then S' = the node that is common to T-link and T-link', else S' = node that has max activation

    of R and D (do not use S again.)

 Does shunt learning apply? (Shunt learning currently has priority over chain learning.)

        Yes: Shunt learn. Age T-link according to upcoming nodes: T-link <- T-link'.

        No: Do nothing, continue.

 else does chain learning apply? (This will not apply until there a history of at least two T-links.)

        Yes: Chain learn. Age T-link according to upcoming nodes: T-link <- T-link'. (On the next

         epoch we will have to go back all the way to the initial suggested S node or else risk

         overlooking another learning opportunity due to the change in link topology. However, the

         next pass through the algorithm should be faster since a new "shortcut" link exists.)

        No: Do nothing, continue.

 else no learning applies, so use the winning T-link (calculated earlier) on the next epoch. Age

    T-link according to upcoming nodes: T-link <- T-link'.

 Add the determined next epoch's T-link T[S,R,D] to the history list. (With the current learning

    rules, the system needs to remember only the two most current T-links, though currently all past

    T-links are stored. These T-links are represented as 4-tuples in the form [S, R, D, SRD].)

 Go back to the "State update" step.

    The mathematical calculation of S-96 node activation is almost the same as that of typical ANS

architectures, using sum of activations. However, S-96 has additional arrays describing other types

of node and link parameters. These calculations are summarized below.

a[j] <- I[j] +   i   f(w[i,j]*a[i])        nodes   i with links incoming to j

f(x) <- min(x, 1)

waveform[j] <- v[i,j]      if i = the source node

            <- null        otherwise

tid[i, j] <- 1      if j = the SRD node,       nodes      i with links incoming to j

          <- 0      otherwise

4.3 Search heuristic

         The S-96 FOA flows around the network of T-links, guided by a heuristic. The exact form

of this heuristic formula has not been a prominent issue in this study since it can be significantly

changed without major impact on system behavior, and the simulation cases tested have not been

large enough to detect undesirable behavior. The current heuristic is described below.

         Currently the heuristic weights three criteria:

1) favor the maximum SRD node activation in the improper adjacent T-links list: he(x)

2) favor T-links that are new or have not been seen for a long time: h n(x)

3) disfavor the inverse T-link of the current T-link: hi(x)

         The most obvious way of combining these values is to add them, and then choose the T-

link having the largest sum to be the next focal T-link. However, these values do not immediately

lend themselves to summing due to the nature of their functions. If h(x) = he(x) + hn(x) + hi(x)

represents the final heuristic sum and the three h(x) functions are those indicated above, then note

that he(x) is inherently linear whereas hn(x) is inherently nonlinear. This is because he(x) depends of

total activation, which has no theoretical limit, since the number of incoming links has no theoretical

limit, and it is logical to consider the number of incoming signals as a type of linear voting system.

hn(x), on the other hand, mimics animal memories, and is a measurement of novelty. A node that has

never been seen before has some function of infinite novelty and the current node has zero novelty.

Yet it is not logical to consider this a linear function since a node that has never been seen is not

much more novel than a node that was visited long ago, and to declare their difference in novelty to

be infinite is neither logical nor mathematically tractable. To combine such disparate functions,

hn(x) should be "squashed" using a horizontally asymptotic function.

         The exact form of this squashing function is not very important. It will be similar in nature

to the sigmoid activation functions of the well-known ANSs, whose exact formula is chosen for

practical reasons such as ease of differentiation or ease of hardware implementation, except here it

will not have an S-shape. The squashing function used in this simulation is squash(x) = 1 -

(1/(x+1)). Infinite x will produce an output of 1, and x = 0 will produce an output of 0, thereby

implementing a monotonically increasing horizontally asymptotic function with an asymptote at 1.

This corresponds well to the above notion of novelty, since completely new nodes are guaranteed a

higher novelty value than nodes visited long ago, but not much more, and the difference diminishes

as time progresses. This is similar to human memory, where it is often more difficult to distinguish

the relative order of two events long ago than of two recent events.

         The exact heuristic formula for any given node x is therefore:

h(x) = he(x) + hn(x) + hi(x)

he(x) = "expression" of node x = squash(Ke * a(x))

Ke = 1

a(x) = activation of x = a(x) in the formula in the previous section

squash(x) = 1 - (1/(x+1))

hn(x) = "novelty" of node x = squash(Kn * visit_distance(x))

Kn = 2

visit_distance(x) = current_epoch - epoch in which node x was last visited

hi(x) = squashed_inverse_contribution(x) = squash(K i * inverse_contribution(x))

Ki = 1

inverse_contribution(x) = 0 if the link is the inverse of the current link, otherwise 1

         The three factors Kn, Ke, and Ki allow for fine-tuning the heuristic, but are not currently

very important. Not shown here is the complete listing of permutations of the various cases of the

three conditions that could occur, which lead to the derivation of this summation method.


Shared By: