CCNBook/Sims/Networks/Cats and Dogs

From Computational Cognitive Neuroscience Wiki
Jump to: navigation, search
CCNBook/Sims/Networks/Cats and Dogs
Project Name cats_and_dogs
Filename File:cats and dogs.proj Open Project in emergent
Author Randall C. O'Reilly
Publication (O'Reilly, Munakata, Frank, Hazy, & Contributors, 2012)
First Published Jul 28 2016
Tags Semantic Network, Generalization, Prototypes, Constraint Satisfaction
Description A simple semantic network that demonstrates how networks can generalize, and represent prototypes, and satisfy various different constraints.
Updated 28 July 2016, 6 September 2016, 13 January 2017
Versions 8.0.0, 8.0.2, 8.0.3
Emergent Versions 8.0.0, 8.0.4
Other Files File:CatsDogsNet.wts

Back to CCNBook/Sims/All or Networks Chapter.


We will begin our exploration with a simple semantic network intended to represent a (very small) set of relationships among different features used to represent a set of entities in the world. In our case, we represent some features of cats and dogs: their color, size, favorite food, and favorite toy. The network contains information about a number of individual cats and dogs, and is able to use this information to make generalizations about what cats and dogs in general have in common, and what is unique about them. It can also tell you about the consistency of a given feature with either cats or dogs -- this is where the harmony function can be useful in assessing the total constraint satisfaction level of the network with a particular configuration of feature inputs. The network can also be used to perform pattern completion as a way of retrieving information about a particular individual or individuals. Thus, this simple network summarizes many of the topics covered in this chapter.

It is recommended that you click here to undock this document from the main project window. Use the Window menu to find this window if you lose it, and you can always return to this document by browsing to this document from the docs section in the left browser panel of the project's main window.
Cats and Dogs Semantics
Species Name Color Size Food Toy
Cat Morris Orange Small Grass String
Socks Black & White Small Bugs Feather
Sylvester Black & White Small Grass String
Garfield Orange Medium Scraps String
Fuzzy White Medium Grass Feather
Dog Rex Black Large Scraps Bone
Fido Brown Medium Shoe Shoe
Spot Black & White Medium Scraps Bone
Snoopy Black & White Medium Scraps Bone
Butch Brown Large Shoe Shoe

The knowledge embedded in the network is summarized in the table to the right. This knowledge is encoded by simply setting a weight of 1 between an instance node representing an individual cat or dog and the corresponding feature value that this individual possesses (c.f., the Jets and Sharks model from McClelland & Rumelhart, 1988). Each of the groups of features (i.e., values within one column of the table) are represented within distinct layers that have their own within-layer inhibition. In additon, all of the identity units and the name units are within their own separate layers as well. We use the FFFB inhibitory function here which allows considerable flexibility in the actual number of active units per layer.

As usual, take some time to examine the weights in the network, and verify that the weights implement the knowledge shown in the table. To do so, select the r.wt value on the CatsDogsNet tab and then click on individual units in the display using the red arrow button.
Now, click on the StdInputData view panel tab.

Let's first verify that when we present an individual's name as input, it will recall all of the information about that individual. This is a form of pattern completion with a single unique input cue. You should see that Morris in the Name layer units of StdInputData is already on by default (with a value of 1) -- we will use this.

Press Init and Run in the ControlPanel.

You should see that the network activates the appropriate features for Morris. You can think about this process as finding the most harmonious activation state given the input constraint of Morris, and the constraints in the network's weights. Equivalently, you can think about it as settling into the Morris attractor.

Go ahead and try a few other name activations (change the appropriate value from 0 to 1) in the StdInputData view -- first click on the red arrow in upper right-hand corner, then use the left mouse button to toggle unit activation on or off.

Now, let's see how this network can give us general information about cats versus dogs, even though at some level it just has information about a set of individuals.

Select only the Cat Species input (first unit), and then Run.

You should see that the network activates features that are typical of cats, and ends up settling on a subset of cat individuals -- use Step Cycle to see the settling in detail, or look at the CycleGridData to see the trajectory in one glance. You can repeat this for dogs.

Question 3.4: Explain why the subset of cat individuals ended up getting activated, when just Cat was provided as input -- how might this differential activation of individuals be useful?

Constraint Satisfaction

Now let's make use of some of the constraint satisfaction ideas. We can view the harmony of the network over cycles of settling using a graph view.

Select the CycleHarmonyData tab in the right view panel

Notice that, as we expected, this value appears to monotonically increase over settling, indicating that the network is increasingly satisfying the constraints as the activations are updated.

Now, let's make some more specific queries for the network.

Activate the Large size input (last unit in Size column) in addition to Cat, and press Run.

You should see that the harmony value is lower than that for just Cat alone. This lower harmony reflects the fact that you provided discordant, inconsistent constraints, which the network was not able to satisfy as well.

Turn off the Large size input and turn on the Medium one (middle unit in Size column) in addition to Cat, and pressRun.

Although this case starts off earlier, the final harmony is also lower than Cat alone, because even though there are some medium-sized cats, there are fewer of them, so the constraints are tighter. Put another way, Cat is an easy constraint to satisfy, so the resulting harmony is large. Cat plus Medium is harder to satisfy because it applies to fewer things, so the harmony is lower.

There are a seemingly infinite number of different ways that you can query the network -- go ahead and present different input patterns and see what kinds of responses the network gives you. Most of them will we hope be recognizable as a reasonable response to the set of constraints provided by the input pattern.

It is sometimes interesting to try to figure out how the activation spreads through the network as it settles. You can view the CycleGridData view for this purpose. It shows the state of the network every grid_interval (default = 5) cycles of updating.

Have fun experimenting!

You may now close the project (use the window manager close button on the project window or File/Close Project menu item) and then open a new one, or just quit emergent entirely by doing Quit emergent menu option or clicking the close button on the root window.