jchrest.architecture
Class Chrest

java.lang.Object
  extended by java.util.Observable
      extended by jchrest.architecture.Chrest

public class Chrest
extends java.util.Observable

The parent class for an instance of a Chrest model.


Constructor Summary
Chrest()
           
 
Method Summary
 void advanceClock(int time)
          Advance the clock by given amount.
 void assignEmotionToCurrentItem(Stm stm, Emotion emotion)
          Attach given emotion to top item in STM, if present.
 Node associateAndLearn(ListPattern pattern1, ListPattern pattern2)
           
 Node associateAndLearn(ListPattern pattern1, ListPattern pattern2, int time)
          Used to learn an association between two patterns.
 ListPattern associatePattern(ListPattern pattern)
          Asks Chrest to return the image of the node which is associated with the node obtained by sorting given pattern through the network.
 void clear()
          Clear the STM and LTM of the model.
 void constructTemplates()
          Instruct model to construct templates, if the 'constructTemplates' flag is true.
 int countTemplates()
          Return a count of the number of templates in the model's visual LTM.
 void emoteAndPropagateAcrossModalities(java.lang.Object stmsobject)
          Propagate emotion across all the given STMs.
 void freeze()
          Instruct model not to update observers.
 double getActionLtmAverageDepth()
          Return the average depth of nodes in action long-term memory.
 int getAddLinkTime()
          Accessor to retrieve time to add a new link.
 int getClock()
          Accessor to retrieve current time of model.
 java.util.Map<java.lang.Integer,java.lang.Integer> getContentCounts()
          Return a map from content sizes to frequencies for the model's LTM.
 boolean getCreateSemanticLinks()
          Accessor to option of whether to create semantic links.
 boolean getCreateTemplates()
          Accessor to option of whether to create templates.
 Emotion getCurrentEmotion(Stm stm)
          Accessor for the emotion associated with the topmost item in STM.
 Emotion getCurrentFollowedByEmotion(Stm stm)
           
 int getDiscriminationTime()
          Accessor to retrieve time to discriminate a new node.
 DomainSpecifics getDomainSpecifics()
          Retrieve the model's current domain specification.
 EmotionAssociator getEmotionAssociator()
          Accessor for Emotion Associator.
 int getFamiliarisationTime()
          Accessor to retrieve time to familiarise image of a node.
 java.util.Map<java.lang.Integer,java.lang.Integer> getImageCounts()
          Return a map from image sizes to frequencies for the model's LTM.
 Node getLtmByModality(ListPattern pattern)
          Return the root node of the long-term memory which the given pattern would be sorted through, based on its modality.
protected  int getMinTemplateLevel()
          Accessor to value of minimum template level.
protected  int getMinTemplateOccurrences()
          Accessor to minimum require occurrences for forming template.
 java.util.Map<ListPattern,java.lang.Integer> getMovePredictions(Scene scene, int numFixations, java.lang.String colour)
          Return a map of moves vs frequencies.
 Perceiver getPerceiver()
          Accessor to retrieve the model's perceiver object.
 float getRho()
          Accessor to retrieve value of rho, the probability of learning an item.
 java.util.Map<java.lang.Integer,java.lang.Integer> getSemanticLinkCounts()
          Return a map from number of semantic links to frequencies for the model's LTM.
 float getSimilarityThreshold()
          Accessor to retrieve value of similarity threshold, the number of items which must be shared between two images for a semantic link to be formed.
 int getTotalLtmNodes()
          Accessor to retrieve the total number of nodes within LTM.
 double getVerbalLtmAverageDepth()
          Return the average depth of nodes in verbal long-term memory.
 Stm getVerbalStm()
          Accessor to retrieve verbal short-term memory of model.
 int getVerbalStmSize()
          Accessor to retrieve the size of verbal short-term memory.
 Node getVisualLtm()
          Accessor to retrieve visual long-term memory of model.
 double getVisualLtmAverageDepth()
          Return the average depth of nodes in visual long-term memory.
 double getVisualLtmAverageImageSize()
          Return the average image size of nodes in visual long-term memory.
 Stm getVisualStm()
          Accessor to retrieve visual short-term memory of model.
 int getVisualStmSize()
          Accessor to retrieve the size of visual short-term memory.
 boolean isExperienced()
          Model is 'experienced' if it has at least 2000 nodes in LTM.
 void learnAndNamePatterns(ListPattern pattern1, ListPattern pattern2)
           
 void learnAndNamePatterns(ListPattern pattern1, ListPattern pattern2, int time)
          Learn and link a visual and verbal pattern with a naming link.
 void learnScene(Scene scene, int numFixations)
           
 void learnSceneAndMove(Scene scene, Move move, int numFixations)
          Learn a scene with an attached next move.
 int ltmActionSize()
          Return a count of the number of nodes in action long-term memory.
 int ltmVerbalSize()
          Return a count of the number of nodes in verbal long-term memory.
 int ltmVisualSize()
          Return a count of the number of nodes in visual long-term memory.
 ListPattern namePattern(ListPattern pattern)
          Asks Chrest to return the image of the node which names the node obtained by sorting given pattern through the network.
 Move predictMove(Scene scene, int numFixations)
          Predict a move using a CHUMP-like mechanism.
 Move predictMove(Scene scene, int numFixations, java.lang.String colour)
          Predict a move using a CHUMP-like mechanism.
 ListPattern recallPattern(ListPattern pattern)
          Asks Chrest to return the image of the node obtained by sorting given pattern through the network.
 Node recognise(ListPattern pattern)
          Retrieve a node in long-term memory using the given ListPattern.
 Node recogniseAndLearn(ListPattern pattern)
          Used to learn about a new pattern.
 Node recogniseAndLearn(ListPattern pattern, int time)
          Use given ListPattern to perform a step of learning within the network.
 Scene scanScene(Scene scene, int numFixations)
          Scan given scene, then return a scene which would be recalled.
 Scene scanScene(Scene scene, int numFixations, boolean clearStm)
          Scan given scene, then return a scene which would be recalled.
 void setAddLinkTime(int time)
          Modify time to add a new link.
 void setCreateSemanticLinks(boolean value)
          Modify option to create semantic links.
 void setCreateTemplates(boolean value)
          Modify option to create templates.
 void setDefaultAlpha(double alpha)
           
 void setDiscriminationTime(int time)
          Modify time to discriminate a new node.
 void setDomain(DomainSpecifics domain)
          Set the domain specification.
 void setFamiliarisationTime(int time)
          Modify time to familiarise image of a node.
 void setRho(float rho)
          Modify value of rho, the probability of learning an item.
 void setSimilarityThreshold(int threshold)
          Modify value of similarity threshold.
 void setTemplateConstructionParameters(int minLevel, int minOccurrences)
          Modify values for template construction.
 void setVerbalStmSize(int size)
          Modify size of verbal short-term memory.
 void setVisualStmSize(int size)
          Modify size of visual short-term memory.
 void unfreeze()
          Instruct model to now update observers for future changes.
 void writeModelAsVna(java.io.Writer writer)
          Write model to given Writer object in VNA format
 void writeModelSemanticLinksAsVna(java.io.Writer writer)
          Write model semantic links to given Writer object in VNA format
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Chrest

public Chrest()
Method Detail

getDomainSpecifics

public DomainSpecifics getDomainSpecifics()
Retrieve the model's current domain specification.


setDomain

public void setDomain(DomainSpecifics domain)
Set the domain specification.


getAddLinkTime

public int getAddLinkTime()
Accessor to retrieve time to add a new link.


setAddLinkTime

public void setAddLinkTime(int time)
Modify time to add a new link.


getDiscriminationTime

public int getDiscriminationTime()
Accessor to retrieve time to discriminate a new node.


setDiscriminationTime

public void setDiscriminationTime(int time)
Modify time to discriminate a new node.


getFamiliarisationTime

public int getFamiliarisationTime()
Accessor to retrieve time to familiarise image of a node.


setFamiliarisationTime

public void setFamiliarisationTime(int time)
Modify time to familiarise image of a node.


getRho

public float getRho()
Accessor to retrieve value of rho, the probability of learning an item.


setRho

public void setRho(float rho)
Modify value of rho, the probability of learning an item.


getSimilarityThreshold

public float getSimilarityThreshold()
Accessor to retrieve value of similarity threshold, the number of items which must be shared between two images for a semantic link to be formed.


setSimilarityThreshold

public void setSimilarityThreshold(int threshold)
Modify value of similarity threshold.


setCreateSemanticLinks

public void setCreateSemanticLinks(boolean value)
Modify option to create semantic links.


getCreateSemanticLinks

public boolean getCreateSemanticLinks()
Accessor to option of whether to create semantic links.


setCreateTemplates

public void setCreateTemplates(boolean value)
Modify option to create templates.


getCreateTemplates

public boolean getCreateTemplates()
Accessor to option of whether to create templates.


getMinTemplateLevel

protected int getMinTemplateLevel()
Accessor to value of minimum template level.


getMinTemplateOccurrences

protected int getMinTemplateOccurrences()
Accessor to minimum require occurrences for forming template.


setTemplateConstructionParameters

public void setTemplateConstructionParameters(int minLevel,
                                              int minOccurrences)
Modify values for template construction.


getVisualStmSize

public int getVisualStmSize()
Accessor to retrieve the size of visual short-term memory.


setVisualStmSize

public void setVisualStmSize(int size)
Modify size of visual short-term memory.


getVerbalStmSize

public int getVerbalStmSize()
Accessor to retrieve the size of verbal short-term memory.


setVerbalStmSize

public void setVerbalStmSize(int size)
Modify size of verbal short-term memory.


getClock

public int getClock()
Accessor to retrieve current time of model.


advanceClock

public void advanceClock(int time)
Advance the clock by given amount.


getTotalLtmNodes

public int getTotalLtmNodes()
Accessor to retrieve the total number of nodes within LTM.


getVisualStm

public Stm getVisualStm()
Accessor to retrieve visual short-term memory of model.


getVerbalStm

public Stm getVerbalStm()
Accessor to retrieve verbal short-term memory of model.


getVisualLtm

public Node getVisualLtm()
Accessor to retrieve visual long-term memory of model.


ltmVisualSize

public int ltmVisualSize()
Return a count of the number of nodes in visual long-term memory.


getVisualLtmAverageDepth

public double getVisualLtmAverageDepth()
Return the average depth of nodes in visual long-term memory.


getVisualLtmAverageImageSize

public double getVisualLtmAverageImageSize()
Return the average image size of nodes in visual long-term memory.


ltmVerbalSize

public int ltmVerbalSize()
Return a count of the number of nodes in verbal long-term memory.


getVerbalLtmAverageDepth

public double getVerbalLtmAverageDepth()
Return the average depth of nodes in verbal long-term memory.


ltmActionSize

public int ltmActionSize()
Return a count of the number of nodes in action long-term memory.


getActionLtmAverageDepth

public double getActionLtmAverageDepth()
Return the average depth of nodes in action long-term memory.


isExperienced

public boolean isExperienced()
Model is 'experienced' if it has at least 2000 nodes in LTM. This parameter is taken from de Groot and Gobet (1996) to indicate point when master-level eye heuristics are used instead of novice ones.


constructTemplates

public void constructTemplates()
Instruct model to construct templates, if the 'constructTemplates' flag is true. This method should be called at the end of the learning process. Note, the template construction process only currently works for visual patterns using the ItemSquarePattern primitive.


countTemplates

public int countTemplates()
Return a count of the number of templates in the model's visual LTM.


getLtmByModality

public Node getLtmByModality(ListPattern pattern)
Return the root node of the long-term memory which the given pattern would be sorted through, based on its modality.


freeze

public void freeze()
Instruct model not to update observers.


unfreeze

public void unfreeze()
Instruct model to now update observers for future changes. Also triggers an immediate update of current observers.


getContentCounts

public java.util.Map<java.lang.Integer,java.lang.Integer> getContentCounts()
Return a map from content sizes to frequencies for the model's LTM.


getImageCounts

public java.util.Map<java.lang.Integer,java.lang.Integer> getImageCounts()
Return a map from image sizes to frequencies for the model's LTM.


getSemanticLinkCounts

public java.util.Map<java.lang.Integer,java.lang.Integer> getSemanticLinkCounts()
Return a map from number of semantic links to frequencies for the model's LTM.


getPerceiver

public Perceiver getPerceiver()
Accessor to retrieve the model's perceiver object.


recognise

public Node recognise(ListPattern pattern)
Retrieve a node in long-term memory using the given ListPattern. The sorting process works through the children of the currentNode. If the link's test matches the remaining part of the pattern, then the current node is updated, and searching continues through the children of the new node.


recogniseAndLearn

public Node recogniseAndLearn(ListPattern pattern,
                              int time)
Use given ListPattern to perform a step of learning within the network. First, the pattern is sorted. Then, if the retrieved node is the root node or its image mismatches the pattern, discrimination is used to extend the network. Otherwise, new information will be added to the image using the pattern.


recogniseAndLearn

public Node recogniseAndLearn(ListPattern pattern)
Used to learn about a new pattern. Returns the node learnt.


associateAndLearn

public Node associateAndLearn(ListPattern pattern1,
                              ListPattern pattern2,
                              int time)
Used to learn an association between two patterns. The two patterns may be of the same or different modality. Returns the node learnt for the first pattern.


associateAndLearn

public Node associateAndLearn(ListPattern pattern1,
                              ListPattern pattern2)

recallPattern

public ListPattern recallPattern(ListPattern pattern)
Asks Chrest to return the image of the node obtained by sorting given pattern through the network.


associatePattern

public ListPattern associatePattern(ListPattern pattern)
Asks Chrest to return the image of the node which is associated with the node obtained by sorting given pattern through the network.


namePattern

public ListPattern namePattern(ListPattern pattern)
Asks Chrest to return the image of the node which names the node obtained by sorting given pattern through the network.


learnAndNamePatterns

public void learnAndNamePatterns(ListPattern pattern1,
                                 ListPattern pattern2,
                                 int time)
Learn and link a visual and verbal pattern with a naming link.


learnAndNamePatterns

public void learnAndNamePatterns(ListPattern pattern1,
                                 ListPattern pattern2)

learnScene

public void learnScene(Scene scene,
                       int numFixations)

learnSceneAndMove

public void learnSceneAndMove(Scene scene,
                              Move move,
                              int numFixations)
Learn a scene with an attached next move. The move is linked to any chunks in visual STM. TODO: think about if there should be limitations on this.


getMovePredictions

public java.util.Map<ListPattern,java.lang.Integer> getMovePredictions(Scene scene,
                                                                       int numFixations,
                                                                       java.lang.String colour)
Return a map of moves vs frequencies.


predictMove

public Move predictMove(Scene scene,
                        int numFixations)
Predict a move using a CHUMP-like mechanism. TODO: Improve the heuristics here.


predictMove

public Move predictMove(Scene scene,
                        int numFixations,
                        java.lang.String colour)
Predict a move using a CHUMP-like mechanism. TODO: Improve the heuristics here.


scanScene

public Scene scanScene(Scene scene,
                       int numFixations)
Scan given scene, then return a scene which would be recalled. Default behaviour is to clear STM before scanning a scene.


scanScene

public Scene scanScene(Scene scene,
                       int numFixations,
                       boolean clearStm)
Scan given scene, then return a scene which would be recalled.


clear

public void clear()
Clear the STM and LTM of the model.


writeModelAsVna

public void writeModelAsVna(java.io.Writer writer)
                     throws java.io.IOException
Write model to given Writer object in VNA format

Throws:
java.io.IOException

writeModelSemanticLinksAsVna

public void writeModelSemanticLinksAsVna(java.io.Writer writer)
                                  throws java.io.IOException
Write model semantic links to given Writer object in VNA format

Throws:
java.io.IOException

setDefaultAlpha

public void setDefaultAlpha(double alpha)

getEmotionAssociator

public EmotionAssociator getEmotionAssociator()
Accessor for Emotion Associator.


emoteAndPropagateAcrossModalities

public void emoteAndPropagateAcrossModalities(java.lang.Object stmsobject)
Propagate emotion across all the given STMs.


assignEmotionToCurrentItem

public void assignEmotionToCurrentItem(Stm stm,
                                       Emotion emotion)
Attach given emotion to top item in STM, if present.


getCurrentEmotion

public Emotion getCurrentEmotion(Stm stm)
Accessor for the emotion associated with the topmost item in STM.


getCurrentFollowedByEmotion

public Emotion getCurrentFollowedByEmotion(Stm stm)