|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--LGames.Agent | +--LGames.CompositionalAgent2
The CompositionalAgent class is a descendant of the Agent class. It implements the agent's structure and behaviours for the compositionality experiments. It is constructed, initialised and controlled from the thsim main class.
Copyright (c) 2004 Paul Vogt
Field Summary | |
protected int |
DG
|
protected double |
eta
|
protected double |
etaN
|
protected double |
etaS
|
protected int |
gamesPlayed
|
protected int |
iMeaning
|
protected int |
iSymbols
|
protected java.util.List |
lexicon
|
protected double[][] |
lScore
|
protected int[][] |
lUse
|
protected int |
maxMeanings
|
protected int |
maxNSymbols
|
protected java.lang.String |
mString
|
protected int |
nMeanings
|
protected int |
nrDGSuccess
|
protected int |
nSymbols
|
protected java.util.List |
ontology
|
protected boolean |
success
|
protected double |
thresholdForgetting
|
protected double |
thresholdForgettingS
|
protected int |
utteranceID
|
Fields inherited from class LGames.Agent |
age, cxt, dimension, id, topic, TOPIC, topicID, utterance |
Constructor Summary | |
CompositionalAgent2()
Empty constructor |
|
CompositionalAgent2(boolean g,
java.util.List CS)
Constructor of CA for an artificially created language. |
|
CompositionalAgent2(CompositionalAgent2 a)
Copy constructor |
|
CompositionalAgent2(HolisticAgent a,
boolean[] fv,
int nl,
int as)
Constructor that converts a holistic agent into a compositional agent (CA). |
|
CompositionalAgent2(int n,
int a,
double e,
double s,
boolean[] fv,
int as)
Constructor to initialise the compositional agent (CA). |
|
CompositionalAgent2(int n,
int a,
double e,
double s,
boolean[] fv,
int nl,
int as)
Constructor to initialise the compositional agent (CA). |
|
CompositionalAgent2(java.util.List ont)
Constructor that initialises the agent with a predefined semantics. |
Method Summary | |
void |
adaptLexiconHearer(Symbols u,
int T,
char type,
char utype)
Function to adapt the scores for the hearer |
void |
adaptLexiconSpeaker(Symbols u,
int T,
char type,
char utype)
Function to adapt the scores for the speaker |
double |
compareAgents(CompositionalAgent2 adult)
Function used to calculate the similarity measure. |
protected void |
forget(char type)
This function is not implemented |
protected void |
forget(char type,
char rc,
int n)
This function is not implemented |
double |
getCompositionSuccess()
Returns a 1 if the found rule is compositional. |
double |
getDS()
Returns the discrimination success in this game |
java.lang.String |
getGame()
Constructs a string that can be written to the logfile |
int |
getGrammarSize()
Returns the size of the grammar |
int |
getHolistic()
Returns the number of holistic rules in the grammar. |
java.lang.String |
getNewRule()
Returns a string "new " in case a new rule was added to the grammar, otherwise the string is empty. |
java.util.List |
getOntology()
Returns the ontology |
java.lang.String[] |
getParts()
Returns the utterance in its parts. |
Rules2 |
getRule()
Return the encoded, decoded or induced rule |
java.util.List |
getRules()
Returns the entire grammar. |
Meaning |
getTOPIC()
Returns the Meaning representation of the topic. |
java.lang.String |
getUtterance()
Returns the decoded or encoded utterance. |
Symbols |
guess(Symbols u,
char type)
This function calls itself with an extra argument (induce=true) |
Symbols |
guess(Symbols u,
char type,
boolean induce)
The function for guessing the reference of an utterance |
Symbols |
hear(Symbols u,
char type)
Function that calls itself with an extra argument (induce=true) |
Symbols |
hear(Symbols u,
char type,
boolean induce)
Function for the hearer part of the observational game. |
void |
initDCS()
Function to clear the initial set of distinctive categories |
void |
playDGame(char type,
char uType,
boolean b)
This function is not implemented... |
void |
playDGame(char type,
char uType,
int n,
boolean adapt)
This function lets the agent play a discrimination game |
void |
print(java.io.PrintWriter ofile,
char type)
This function is not implemented |
void |
printGrammar()
Prints the grammar to the standard output. |
void |
printGrammar(java.io.PrintWriter ofile,
char type)
printGrammar() is used to print the agent's grammar into a file |
void |
printGrammarStats()
Prints some statistics about the grammar to the standard output. |
protected Symbols |
produce_utterance(double pWC,
char type)
This function produces an utterance. |
void |
setDCS(IntArray dcs)
Function to set the distinctive category. |
void |
setRule(int r)
Function to set the rule index. |
void |
setTopic(int t)
Function used to set the topic, the distinctive category and the Meaning representation of the topic. |
Symbols |
speak(double probability,
char type)
Function to call itself with an extra argument (change=true). |
Symbols |
speak(double probability,
char type,
boolean change)
Function to call produce utterance and the generalise & merge |
Methods inherited from class LGames.Agent |
context_member, getAge, getDim, getFV, getID, getLabels, getMaxLayer, getMeaning, getMeanings, getTopic, getWords, getWords, initDGame, initialise, merge, playDGame, print, printLexiconColumns, printLexiconLatexTabel, printScore, setContext |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.util.List ontology
protected java.util.List lexicon
protected final int maxMeanings
protected final int maxNSymbols
protected int[][] lUse
protected double[][] lScore
protected int iSymbols
protected int iMeaning
protected int nMeanings
protected int nSymbols
protected int nrDGSuccess
protected int DG
protected int utteranceID
protected double eta
protected double etaS
protected double etaN
protected final double thresholdForgetting
protected final double thresholdForgettingS
protected int gamesPlayed
protected boolean success
protected java.lang.String mString
Constructor Detail |
public CompositionalAgent2()
public CompositionalAgent2(CompositionalAgent2 a)
a
- Agent to be copiedpublic CompositionalAgent2(java.util.List ont)
public CompositionalAgent2(int n, int a, double e, double s, boolean[] fv, int as)
n
- identity of CAa
- `birthyear' (i.e. lg) in which agent is createde
- learning rate etas
- learning rate eta (for speakers)fv
- array indicating which quality dimensions are usedas
- alphabet sizepublic CompositionalAgent2(HolisticAgent a, boolean[] fv, int nl, int as)
a
- the holistic agentfv
- array indicating which quality dimensions are usednl
- number of games before the CA starts inducing grammaras
- alphabet sizepublic CompositionalAgent2(int n, int a, double e, double s, boolean[] fv, int nl, int as)
n
- identity of CAa
- `birthyear' (i.e. lg) in which agent is createde
- learning rate etas
- learning rate eta (for speakers)fv
- array indicating which quality dimensions are usednl
- number of games before the CA starts inducing grammaras
- alphabet sizepublic CompositionalAgent2(boolean g, java.util.List CS)
g
- boolean to indicate whether the grammar is initialised or notCS
- the list of meanings that is constructedMethod Detail |
protected void forget(char type, char rc, int n)
forget
in class Agent
type
- type of the game that is being playedrc
- indicates whether it concerns a category (o) or symbol (otherwise)n
- the index of the element to be removedprotected void forget(char type)
forget
in class Agent
type
- type of game that is being playedprotected Symbols produce_utterance(double pWC, char type)
type
- the score-update type (s - score-based, u - usage-based)
public Symbols speak(double probability, char type)
speak
in class Agent
probability
- word-creation probability pWCtype
- game type
public Symbols speak(double probability, char type, boolean change)
probability
- word-creation probability pWCtype
- game typechange
- boolean to indicate whether the agent is allowed to change the grammar
(false when testing the population).public Symbols guess(Symbols u, char type)
guess
in class Agent
u
- the symbol to be guessedtype
- the score-update type (not used)
public Symbols guess(Symbols u, char type, boolean induce)
u
- the symbol to be guessedtype
- the score-update type (not used)induce
- boolean to indicate whether learning is on or off
(=false during testing of the population)public Symbols hear(Symbols u, char type)
hear
in class Agent
u
- the symbol to be guessedtype
- the score-update type (not used)
public Symbols hear(Symbols u, char type, boolean induce)
u
- the symbol to be guessedtype
- the score-update type (not used)induce
- boolean to indicate whether learning is on or off
(=false during testing of the population)public void adaptLexiconSpeaker(Symbols u, int T, char type, char utype)
adaptLexiconSpeaker
in class Agent
u
- utterance of the hearerT
- the topictype
- the type of gameutype
- the score-update typepublic void adaptLexiconHearer(Symbols u, int T, char type, char utype)
adaptLexiconHearer
in class Agent
u
- utterance of the speakerT
- the topictype
- the type of gameutype
- the score-update typepublic Rules2 getRule()
public java.lang.String getNewRule()
public java.lang.String[] getParts()
public java.util.List getRules()
public void playDGame(char type, char uType, boolean b)
playDGame
in class Agent
type
- the type of gameuType
- the type of update score- or usage-basedb
- boolean to indicate whether or not to adapt the ontologypublic void playDGame(char type, char uType, int n, boolean adapt)
playDGame
in class Agent
type
- not useduType
- type of method with prototypes are shifted (default: centre-of-mass)n
- language game numberadapt
- wether or not the learning is on or off.public Meaning getTOPIC()
getTOPIC
in class Agent
public void initDCS()
public void setDCS(IntArray dcs)
public void setTopic(int t)
setTopic
in class Agent
t
- the topic number to be setpublic void setRule(int r)
public double compareAgents(CompositionalAgent2 adult)
Basically, it calculates the fraction of this agent's grammar that coincides with the grammar of the adult
adult
- The other agentpublic java.lang.String getGame()
getGame
in class Agent
public int getGrammarSize()
public int getHolistic()
public double getCompositionSuccess()
public java.lang.String getUtterance()
getUtterance
in class Agent
public double getDS()
getDS
in class Agent
public java.util.List getOntology()
public void printGrammar(java.io.PrintWriter ofile, char type)
public void printGrammarStats()
public void printGrammar()
public void print(java.io.PrintWriter ofile, char type)
print
in class Agent
ofile
- The file to which the data is writtentype
- the type of update (score- or usage-based)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |