Phil/Psych 446

Cognitive Modelling

Week 2

2a, Semantic networks

LISP Review

What is the difference between 'PAUL, PAUL, (PAUL), and '(PAUL)?

Checklist for debugging DO loops:

Debugging tips, to try when your program isn't behaving properly:

The importance of representation

Our goal is to explain human intelligence, by considering the kinds of representation and computation that enable people to make inferences and solve problems.

In principle, computations can be done with many different kinds of representations, but in practice it is important to use representations that make for natural computational solutions to particular kinds of problems.

The most important kinds of representation used in cognitive science include:

Representations require computational procedures that operate on them to produce mental processes.

Semantic networks: structure

Much human information is organized in terms of concepts that are linked to each other.

Nouns are organized in terms of kind and part relations.

E.g. a spaniel is a kind of dog which is a kind of animal.

E.g. a claw is part of a foot which is part of a leg which is part of a dog.

Verbs are organized in terms of ways of doing, e.g. digging is one way of removing.

Useful Web sites:

There are other kinds of links between concepts representing other kinds of links, e.g. STUDENT is linked to COURSES because students TAKE courses.

Exercise: draw a semantic network for UNIVERSITY, including part, kind, and other relations.

Semantic networks: procedures

Inference

Do spaniels have claws? Yes, because spaniels are dogs and dogs have claws.

Move up and down the kind and part hierarchies and do inference by inheritance.

This should be more efficient than making inference by proving theorems in a logic-based system.

Memory retrieval

Did you hear the one about how many graduate students it takes to change a lightbulb?

Use spreading activation from concepts GRADUATE, STUDENT, and LIGHTBULB to converge on the joke if you have it in memory.

Spreading activation starts with one or more concepts active, then activates those concepts linked to them.

Spreading activation models can explain semantic priming, which occurs when a decision about one concept makes it easier to decide about another concept. For example, asking a question about STUDENT may make it faster to answer a question about PROFESSOR.

Discourse comprehension

Combine memory retrieval and inference to make sense of a story: first use spreading activation to activate relevant concepts and episodes, then use inference to fill in the gaps about the story.

See Kintsch, ch. 1 in Polk & Seifert.

2b, Implementing semantic networks in LISP

Structures

Concepts are naturally represented as LISP atoms, e.g. DOG.

To represent links, use property lists (Winston and Horn, p. 160). Alternatives: lists or Common Lisp Object System (CLOS).

E.g. (get 'university 'parts) should return the parts of the univervisity.

But first we need to construct the list, which is done awkwardly:

(setf (get 'university 'parts) '(students professors buildings)))

A clearer way is to define your own procedure to create properties:

(defun put (symbol name value)
   (setf (get symbol name) value)
)

(put 'university 'parts '(students professors buildings))
(put 'university 'kind 'institution)
(put 'university 'instances '(uwaterloo uguelph  wlu ))
(put 'uwaterloo 'location 'waterloo)

To get the property list of a symbol:

(symbol-plist 'university) -->

(INSTANCES (UWATERLOO UGUELPH WLU) KIND INSTITUTION PARTS (STUDENTS PROFESSORS BUILDINGS))

 

Procedures

A LISP program consists of a set of procedures that you define to perform tasks.

Spreading activation

Define a variable to represent all the active concepts.

(defvar *active-concepts* nil) ; concepts currently active

Now define a procedure to spread activation from a given concept to all concepts associated with it.

(defun spread-activation (concept)
  (setf *active-concepts* (list concept))
  (do ((properties (symbol-plist concept) (rest (rest properties)))
       (prop)
      )
      ; exit
      ((null properties) *active-concepts*)
      ;
      (setf prop (second properties)) 
      (if (atom prop)
          (setf *active-concepts* (cons prop *active-concepts*))
      )
      (if (listp prop)
          (setf *active-concepts* (append prop *active-concepts*))
      )
       (print *active-concepts*)
   )
)
     
 

NOTE FOR PEOPLE USING LISPWORKS: For some wierd reason, LispWorks puts strings on property lists. E.g. the atom STUDENTS will have the string "STUDENTS" on its property list. The fix for this is to check (STRINGP PROP) before you put PROP into your list of active concepts.

A full implementation of spreading activation would repeatedly call spread-activation until all linked concepts have been activated.

Climb the kind or part hierarchy

Exercise: Write a function that collects kinds or parts. E.g. a spaniel is a kind of dog which is a kind of animal. So (find-kinds 'spaniel) --> (DOG ANIMAL)).

Make inferences

Exercise: Write a function that answer queries. (query thing property) will initially just check for the value of the property of the thing using (get thing property), but if no answer is found it will climb the hierarchy to see if an answer is available higher up. The query function could use find-kinds, but it would be more natural to do it incrementally, with a process akin to spreading activation.

LISP Tips

Instead of (setf mylist (cons myatom mylist)) use (push myatom mylist)).

If you have a bunch of tests to do, use COND instead of IF.


Phil/Psych 446

Computational Epistemology Laboratory.

Paul Thagard

This page updated Jan. 10, 2005