edu.uiuc.ge.illigal.gale.agents
Class DTAgent

java.lang.Object
  |
  +--edu.uiuc.ge.illigal.gale.agents.DTAgent
All Implemented Interfaces:
Agent, java.lang.Cloneable, java.io.Serializable

public class DTAgent
extends java.lang.Object
implements Agent, java.io.Serializable, java.lang.Cloneable

Implements the generic handle to Agents for Induction Trees.

Since:
0.9alpha
Version:
0.9alpha
Author:
Xavier Llorà <xllora@illigal.ge.uiuc.edu>
See Also:
Serialized Form

Field Summary
protected  edu.uiuc.ge.illigal.gale.data.Attribute aAtt
          The attribute used
protected  edu.uiuc.ge.illigal.gale.agents.AgentPerformance agnPer
          Agent Performance object
protected  edu.uiuc.ge.illigal.gale.data.AttributeSet attCnf
          The attributes set information object
protected  float fThres
          The threshold for real attribute classification
protected  edu.uiuc.ge.illigal.gale.config.GALEConfiguration galeCnf
          The GALE environment configuration object
protected  int iCls
          The class if the node is a leaf
protected  int iIndex
          The index of the attribute used
protected  java.util.Random rnd
          Random number generator object
protected  java.util.Vector vecChild
          The Agent's children
 
Constructor Summary
DTAgent()
          Builds a simple agent with null information
DTAgent(edu.uiuc.ge.illigal.gale.config.GALEConfiguration gale, edu.uiuc.ge.illigal.gale.data.AttributeSet att)
          Builds a simple agent.
 
Method Summary
protected  void addChild(edu.uiuc.ge.illigal.gale.agents.DTAgent agnChild)
          Adds a new Agent child.
protected  void addChild(edu.uiuc.ge.illigal.gale.agents.DTAgent agnChild, int iPos)
          Adds a new Agent child.
protected  float boundedFloat(float lb, float ub)
          Generates a random bounded float using the random number generator.
 edu.uiuc.ge.illigal.gale.agents.Agent buildAgent(edu.uiuc.ge.illigal.gale.config.GALEConfiguration galeCnf, edu.uiuc.ge.illigal.gale.data.AttributeSet att)
          Returns a random builded agent.
protected static edu.uiuc.ge.illigal.gale.agents.DTAgent buildDTAgent(edu.uiuc.ge.illigal.gale.config.GALEConfiguration galeCnf, edu.uiuc.ge.illigal.gale.data.AttributeSet attSet, int iDepth)
          Builds an Agent Hierarchical Aggregate.
 int classify(edu.uiuc.ge.illigal.gale.data.Instance ins)
          Classifies the given instance
 java.lang.Object clone()
          Clones the handled agent.
 float complexity()
          Returns a complexity measure.
protected  int countLeafNodes()
          Count the number of leaf agents in the tree
protected  int countNodes()
          Count the number of nodes in the tree
protected  edu.uiuc.ge.illigal.gale.agents.DTAgent getChild(int iChild)
          Returns the requested child.
protected  int getChildNumber()
          Returns the number of agent childs.
protected  edu.uiuc.ge.illigal.gale.agents.DTAgent getIthNode(edu.uiuc.ge.illigal.gale.agents.DTAgent agn, int iNode)
          Returns the ith agent in the tree
 edu.uiuc.ge.illigal.gale.agents.AgentPerformance getPerformance()
          Provides the classification performance information.
protected  java.lang.String getStarTree()
          Returns the star tree.
protected  java.lang.String getStringModel(java.lang.String pre)
          Returns the stringfied model for the agent.
static void main(java.lang.String[] sArgs)
           
 edu.uiuc.ge.illigal.gale.agents.Agent merge(edu.uiuc.ge.illigal.gale.agents.Agent agn)
          Merges two agents.
protected  void mutateGenotype()
          Mutates the genetic information contained in the tree
 edu.uiuc.ge.illigal.gale.agents.Agent prune()
          Clean spurious issues.
protected  void removeAllChilds()
          Remove all children
protected  void removeChild(int iPos)
          Remove the ith Child.
 void resetPerformance()
          Resets the agents' performance.
 edu.uiuc.ge.illigal.gale.agents.Agent split()
          Splits an agent
protected  void swapChildren(edu.uiuc.ge.illigal.gale.agents.DTAgent agn)
          Exchange children
 java.lang.String toString()
          Returns the stringfied form of the agent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

galeCnf

protected edu.uiuc.ge.illigal.gale.config.GALEConfiguration galeCnf
The GALE environment configuration object


attCnf

protected edu.uiuc.ge.illigal.gale.data.AttributeSet attCnf
The attributes set information object


fThres

protected float fThres
The threshold for real attribute classification


aAtt

protected edu.uiuc.ge.illigal.gale.data.Attribute aAtt
The attribute used


iIndex

protected int iIndex
The index of the attribute used


iCls

protected int iCls
The class if the node is a leaf


vecChild

protected java.util.Vector vecChild
The Agent's children


agnPer

protected edu.uiuc.ge.illigal.gale.agents.AgentPerformance agnPer
Agent Performance object


rnd

protected java.util.Random rnd
Random number generator object

Constructor Detail

DTAgent

public DTAgent()
Builds a simple agent with null information


DTAgent

public DTAgent(edu.uiuc.ge.illigal.gale.config.GALEConfiguration gale,
               edu.uiuc.ge.illigal.gale.data.AttributeSet att)
Builds a simple agent. The Agent is build using the GALE configuration object.

Parameters:
gale - The GALE configuration
att - The instance data information used
Method Detail

buildAgent

public edu.uiuc.ge.illigal.gale.agents.Agent buildAgent(edu.uiuc.ge.illigal.gale.config.GALEConfiguration galeCnf,
                                                        edu.uiuc.ge.illigal.gale.data.AttributeSet att)
Description copied from interface: Agent
Returns a random builded agent.

Specified by:
buildAgent in interface Agent
Parameters:
galeCnf - The GALE configuration object
att - The attributes set information object
Returns:
The agent

buildDTAgent

protected static edu.uiuc.ge.illigal.gale.agents.DTAgent buildDTAgent(edu.uiuc.ge.illigal.gale.config.GALEConfiguration galeCnf,
                                                                      edu.uiuc.ge.illigal.gale.data.AttributeSet attSet,
                                                                      int iDepth)
Builds an Agent Hierarchical Aggregate.

Parameters:
galeCnf - The GALE environment configuration object
attSet - The attribute set information object
iDepth - The Agent depth
Returns:
The Random Agent build

getPerformance

public edu.uiuc.ge.illigal.gale.agents.AgentPerformance getPerformance()
Description copied from interface: Agent
Provides the classification performance information.

Specified by:
getPerformance in interface Agent
Returns:
The handle to the classification performance

resetPerformance

public void resetPerformance()
Description copied from interface: Agent
Resets the agents' performance.

Specified by:
resetPerformance in interface Agent

merge

public edu.uiuc.ge.illigal.gale.agents.Agent merge(edu.uiuc.ge.illigal.gale.agents.Agent agn)
Description copied from interface: Agent
Merges two agents.

Specified by:
merge in interface Agent
Parameters:
agn - The second agent to be merged
Returns:
The merged agent

swapChildren

protected void swapChildren(edu.uiuc.ge.illigal.gale.agents.DTAgent agn)
Exchange children

Parameters:
agn - The other DTAgent to exchange children

getIthNode

protected edu.uiuc.ge.illigal.gale.agents.DTAgent getIthNode(edu.uiuc.ge.illigal.gale.agents.DTAgent agn,
                                                             int iNode)
Returns the ith agent in the tree

Returns:
the ith agent in breadth first search

split

public edu.uiuc.ge.illigal.gale.agents.Agent split()
Description copied from interface: Agent
Splits an agent

Specified by:
split in interface Agent
Returns:
The splitted agent

mutateGenotype

protected void mutateGenotype()
Mutates the genetic information contained in the tree


clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Description copied from interface: Agent
Clones the handled agent.

Specified by:
clone in interface Agent
Overrides:
clone in class java.lang.Object
Returns:
The cloned agent
Throws:
java.lang.CloneNotSupportedException - Thrown when the agent cannot be cloned

complexity

public float complexity()
Description copied from interface: Agent
Returns a complexity measure.

Specified by:
complexity in interface Agent
Returns:
The complexity measure

prune

public edu.uiuc.ge.illigal.gale.agents.Agent prune()
Description copied from interface: Agent
Clean spurious issues.

Specified by:
prune in interface Agent

classify

public int classify(edu.uiuc.ge.illigal.gale.data.Instance ins)
Description copied from interface: Agent
Classifies the given instance

Specified by:
classify in interface Agent
Returns:
The predicted class

toString

public java.lang.String toString()
Description copied from interface: Agent
Returns the stringfied form of the agent

Specified by:
toString in interface Agent
Overrides:
toString in class java.lang.Object
Returns:
The stringfied agent

getStringModel

protected java.lang.String getStringModel(java.lang.String pre)
Returns the stringfied model for the agent.

Parameters:
pre - the current prefix
Returns:
the stringfied model

getStarTree

protected java.lang.String getStarTree()
Returns the star tree.

Returns:
the stringfied star tree

boundedFloat

protected float boundedFloat(float lb,
                             float ub)
Generates a random bounded float using the random number generator.

Parameters:
lb - lower bound
ub - upper bound

addChild

protected void addChild(edu.uiuc.ge.illigal.gale.agents.DTAgent agnChild)
Adds a new Agent child. Links the agnChild to the current agent.

Parameters:
agnChild - The Agent to be added

addChild

protected void addChild(edu.uiuc.ge.illigal.gale.agents.DTAgent agnChild,
                        int iPos)
Adds a new Agent child. Links the agnChild to the current agent.

Parameters:
agnChild - The Agent to be added
iPos - The child position to be added

removeChild

protected void removeChild(int iPos)
Remove the ith Child.

Parameters:
iPos - The child position to be removed

removeAllChilds

protected void removeAllChilds()
Remove all children


getChild

protected edu.uiuc.ge.illigal.gale.agents.DTAgent getChild(int iChild)
Returns the requested child. Returns the i child of the Agent.

Parameters:
iChild - The requested Agent child
Returns:
The Agent child

getChildNumber

protected int getChildNumber()
Returns the number of agent childs.

Returns:
The Agent child number

countNodes

protected int countNodes()
Count the number of nodes in the tree

Returns:
The number of nodes

countLeafNodes

protected int countLeafNodes()
Count the number of leaf agents in the tree

Returns:
The number of leaves in the tree

main

public static void main(java.lang.String[] sArgs)