Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling...

Preview:

Citation preview

The Cogent EnvironmentModeling Language

Example Task

Cognitive ModelingLecture 3: Basic Features of Cogent

Sharon Goldwater

School of InformaticsUniversity of Edinburghsgwater@inf.ed.ac.uk

January 18, 2010

Sharon Goldwater Cognitive Modeling 1

The Cogent EnvironmentModeling Language

Example Task

1 The Cogent EnvironmentPrincipal FeaturesData VisualizationModel Testing

2 Modeling LanguageOverviewSyntaxUnification

3 Example TaskFree RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Based on the Cogent tutorial held by Rick Cooper at the CognitiveScience Conference, Philadelphia, 2000.Reading: Cooper (2002: Ch. 2).

Sharon Goldwater Cognitive Modeling 2

The Cogent EnvironmentModeling Language

Example Task

Principal FeaturesData VisualizationModel Testing

Cogent: Principal Features

Cogent offers the following features:

a visual programming environment;

research program management tools;

a range of standard functional components;

an expressive rule-based modeling language andimplementation system;

automated data visualization tools;

a powerful model testing environment.

Sharon Goldwater Cognitive Modeling 3

The Cogent EnvironmentModeling Language

Example Task

Principal FeaturesData VisualizationModel Testing

Visual Programming in Cogent

Sharon Goldwater Cognitive Modeling 4

The Cogent EnvironmentModeling Language

Example Task

Principal FeaturesData VisualizationModel Testing

Research Program Management

Sharon Goldwater Cognitive Modeling 5

The Cogent EnvironmentModeling Language

Example Task

Principal FeaturesData VisualizationModel Testing

Standard Functional Components

A library of components is supplied:

memory buffers;rule-based processes;simple connectionist networks;data input/output devices.

Components can be configured for different applications.

Sharon Goldwater Cognitive Modeling 6

The Cogent EnvironmentModeling Language

Example Task

Principal FeaturesData VisualizationModel Testing

Data Visualization Tools: Tables

Sharon Goldwater Cognitive Modeling 7

The Cogent EnvironmentModeling Language

Example Task

Principal FeaturesData VisualizationModel Testing

Data Visualization Tools: Graphs

Sharon Goldwater Cognitive Modeling 8

The Cogent EnvironmentModeling Language

Example Task

Principal FeaturesData VisualizationModel Testing

Data Visualization Tools: Pictures

Sharon Goldwater Cognitive Modeling 9

The Cogent EnvironmentModeling Language

Example Task

Principal FeaturesData VisualizationModel Testing

The Model Testing Environment

Visualization tools are dynamically updated;

facilities are included to trace inter-componentcommunication;

a flexible “scripting” environment allows:

models to be run over multiple blocks of trials;multiple “subjects” to be run over multiple blocks;automated parameter varying “meta-experiments”.

Sharon Goldwater Cognitive Modeling 10

The Cogent EnvironmentModeling Language

Example Task

OverviewSyntaxUnification

Rule-Based Modeling Language

Processes may contain rules such as:

IF minuend(X) is in Working Memorysubtrahend(X) is in Working Memory

THEN add equal(minuend, subtrahend) to Working Memorysend difference(0) to Write Answer

Cogent’s representation language is based on Prolog.

We will use teletype for terms and boldface for buffers.

Sharon Goldwater Cognitive Modeling 11

The Cogent EnvironmentModeling Language

Example Task

OverviewSyntaxUnification

Rule-Based Modeling Language

Sharon Goldwater Cognitive Modeling 12

The Cogent EnvironmentModeling Language

Example Task

OverviewSyntaxUnification

Basic Syntax

Cogent’s representational unit is the term. Terms include

Numbers: reals or integers. Ex: 6, 6.0.

Atoms: any string of letters, digits, or ‘ ’ beginning with alower-case letter. Ex: apple, b0, myName, response count.

Variables: any string of letters, digits, or ‘ ’ beginning with anupper-case letter or ‘ ’. Ex: Apple, B0, MyName, count.

Lists: for representing sequences; consist of comma-separatedterms. Ex: [a, b, c], [X], [].

Compound terms: for representing structured information;consist of a functor and arguments. Ex: word(apple),date(6, jan).

Sharon Goldwater Cognitive Modeling 13

The Cogent EnvironmentModeling Language

Example Task

OverviewSyntaxUnification

Unification

The power of Cogent’s representational system comes fromunifying terms, binding variables to values (or to other variables).

IF word(Word) is in Stimulithe current cycle is Cycle

THEN send memorize(Word) to Subjectdelete word(Word) from Stimuliadd presented(Word, Cycle) to Stimuli

Sharon Goldwater Cognitive Modeling 14

The Cogent EnvironmentModeling Language

Example Task

OverviewSyntaxUnification

Rules of Unification

Variables match anything.

Compound terms must have matching functors and arity.

Lists must have matching lengths.

Terms Unifies as BindingsX, word(Word) word(Word) X → word(Word)f(a,B,c), f(X,Y,Z) f(a,B,c) X → a, Y → B, Z → cf(X), g(a) failsf([a,B],[]), f([B,B],B) fails

Sharon Goldwater Cognitive Modeling 15

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

The Task: Free Recall

Classical experiment on word learning:

on each trial, the subject is presented with a list of 25 words;

the subject is told to try to memorize the words;

after an interval, the subject must recall as many words aspossible.

Sharon Goldwater Cognitive Modeling 16

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Free Recall: Empirical Findings

Sharon Goldwater Cognitive Modeling 17

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

The Modal Model: Top Level

Sharon Goldwater Cognitive Modeling 18

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

The Modal Model: Subject

Sharon Goldwater Cognitive Modeling 19

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

The Modal Model: Task environment

Sharon Goldwater Cognitive Modeling 20

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

The Modal Model: Stimuli

Sharon Goldwater Cognitive Modeling 21

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

The Modal Model: Editing stimuli

Sharon Goldwater Cognitive Modeling 22

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

The Modal Model: Stimuli properties

Sharon Goldwater Cognitive Modeling 23

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

The Modal Model: Task environment

Sharon Goldwater Cognitive Modeling 24

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

The Modal Model: Presenting stimuli to subject

Sharon Goldwater Cognitive Modeling 25

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

The Modal Model: Messages

Sharon Goldwater Cognitive Modeling 26

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Building the Short Term Store

Create propositional buffer by clicking on button:

Sharon Goldwater Cognitive Modeling 27

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Building the Short Term Store

Double-click new buffer to name it and edit properties. STS hasLimited Capacity of 7:

Sharon Goldwater Cognitive Modeling 28

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Building the Short Term Store

Open I/O Process and add an If...Then... rule:

Sharon Goldwater Cognitive Modeling 29

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Building the Short Term Store

Double-click rule to edit:

Sharon Goldwater Cognitive Modeling 30

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Building the Short Term Store

The rule to transfer words to STS:

Sharon Goldwater Cognitive Modeling 31

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Building the Short Term Store

Add a read arrow from I/O Process to STS:

Sharon Goldwater Cognitive Modeling 32

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Building the Short Term Store

The rule to recall words from STS (use Add Condition → match):

Sharon Goldwater Cognitive Modeling 33

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Building the Short Term Store

Recall graph now shows a recency effect (output is for 20 trials):

Sharon Goldwater Cognitive Modeling 34

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Building the Short Term Store

What causes the recency effect? If we changed the propertiesof STS, could we change the shape of the graph?

Watch the Messages view of Input/Output. What happensthere now when you run (or single-step) through a trial?

Sharon Goldwater Cognitive Modeling 35

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Adding the Long Term Store

The modal model also includes:

a long term store (LTS);

a rehearsal process to transfer information from STS to LTS;

the possibility to recall from either STS or LTS.

Sharon Goldwater Cognitive Modeling 36

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Adding the Long Term Store

Sharon Goldwater Cognitive Modeling 37

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Adding the Long Term Store

The rehearsal rule:

Sharon Goldwater Cognitive Modeling 38

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Adding the Long Term Store

To recall from either STS or LTS, we define a new condition byclicking the f(X) :- g(X) button and editing the definition:

Read :- as ‘if’: recall(Word) is true if Word is in STS.

Sharon Goldwater Cognitive Modeling 39

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Adding the Long Term Store

Sharon Goldwater Cognitive Modeling 40

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Adding the Long Term Store

What causes the Primacy Effect?

Monitor the Messages view of the I/O Process. Why does themodel sometimes recall the same word twice in the same trial?

Sharon Goldwater Cognitive Modeling 41

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Adding the Long Term Store

The current output (left) still doesn’t match the output from theintro (right). What is different? Why?

Sharon Goldwater Cognitive Modeling 42

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Decay, Time, and Rehearsal

Add decay to LTS. Explore different decay rates.

Change the rehearsal rate by adding another copy of therehearsal rule.

All memorized words are currently recalled in parallel. Makethe recall process serial.

Sharon Goldwater Cognitive Modeling 43

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Decay, Time, and Rehearsal

The serial recall rule:

Sharon Goldwater Cognitive Modeling 44

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Decay, Time, and Rehearsal

Explore the effect of the Access property of each buffer. Playwith these (and other) parameters to see how they affect themodel’s behavior.

The Experimenter system is written using standard Cogent.Try to discover how it works.

Go on to develop the model into something substantial.

Sharon Goldwater Cognitive Modeling 45

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

References

Cooper, Richard P. 2002. Modelling High-Level Cognitive Processes. LawrenceErlbaum Associates, Mahwah, NJ.

Sharon Goldwater Cognitive Modeling 46

Recommended