46
The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater School of Informatics University of Edinburgh [email protected] January 18, 2010 Sharon Goldwater Cognitive Modeling 1

Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

Embed Size (px)

Citation preview

Page 1: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

The Cogent EnvironmentModeling Language

Example Task

Cognitive ModelingLecture 3: Basic Features of Cogent

Sharon Goldwater

School of InformaticsUniversity of [email protected]

January 18, 2010

Sharon Goldwater Cognitive Modeling 1

Page 2: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 3: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 4: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

The Cogent EnvironmentModeling Language

Example Task

Principal FeaturesData VisualizationModel Testing

Visual Programming in Cogent

Sharon Goldwater Cognitive Modeling 4

Page 5: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

The Cogent EnvironmentModeling Language

Example Task

Principal FeaturesData VisualizationModel Testing

Research Program Management

Sharon Goldwater Cognitive Modeling 5

Page 6: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 7: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

The Cogent EnvironmentModeling Language

Example Task

Principal FeaturesData VisualizationModel Testing

Data Visualization Tools: Tables

Sharon Goldwater Cognitive Modeling 7

Page 8: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

The Cogent EnvironmentModeling Language

Example Task

Principal FeaturesData VisualizationModel Testing

Data Visualization Tools: Graphs

Sharon Goldwater Cognitive Modeling 8

Page 9: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

The Cogent EnvironmentModeling Language

Example Task

Principal FeaturesData VisualizationModel Testing

Data Visualization Tools: Pictures

Sharon Goldwater Cognitive Modeling 9

Page 10: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 11: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 12: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

The Cogent EnvironmentModeling Language

Example Task

OverviewSyntaxUnification

Rule-Based Modeling Language

Sharon Goldwater Cognitive Modeling 12

Page 13: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 14: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 15: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 16: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 17: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

Free Recall: Empirical Findings

Sharon Goldwater Cognitive Modeling 17

Page 18: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 19: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

The Modal Model: Subject

Sharon Goldwater Cognitive Modeling 19

Page 20: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 21: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

The Modal Model: Stimuli

Sharon Goldwater Cognitive Modeling 21

Page 22: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 23: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 24: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 25: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 26: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

The Cogent EnvironmentModeling Language

Example Task

Free RecallThe Modal ModelLong Term StoreDecay, Time, and Rehearsal

The Modal Model: Messages

Sharon Goldwater Cognitive Modeling 26

Page 27: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 28: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 29: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 30: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 31: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 32: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 33: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 34: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 35: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 36: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 37: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 38: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 39: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 40: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 41: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 42: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 43: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 44: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 45: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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

Page 46: Cognitive Modeling - Lecture 3: Basic Features of Cogent · The Cogent Environment Modeling Language Example Task Cognitive Modeling Lecture 3: Basic Features of Cogent Sharon Goldwater

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