Class AttributeSet

java.lang.Object
  extended by AttributeSet

public class AttributeSet
extends java.lang.Object

An AttributeSet object encapsulates the set of attributes for a given machine learning problem. The attributes are stored in a fixed order, and several of the methods access attributes by their index in this ordering. As is usual with machine learning problems, one of the attributes is designated as a class attribute -- this is the attribute that determines which class an instance belongs to. However, to avoid confusion with the Java keyword "class", in all documentation we refer instead to the classification attribute, and the classification of an instance.

Author:
John MacCormick

Constructor Summary
AttributeSet()
          Construct a new AttributeSet with an empty set of attributes.
 
Method Summary
 void addAttribute(Attribute attribute)
          Add the given attribute to the attribute set.
 Attribute getAttribute(java.lang.String name)
          Get the attribute with the given name.
 int getAttributeIndex(Attribute attribute)
          Get the index of the given attribute in the attribute set's ordering.
 int getAttributeIndex(java.lang.String name)
          Get the index of the given attribute in the attribute set's ordering.
 java.util.ArrayList<Attribute> getAttributes()
          Get a list of attributes in the attribute set.
 Attribute getClassAttribute()
          Get the classification attribute for this attribute set.
 java.lang.String getClassAttributeAsString()
          Get the name of the classification attribute for this attribute set.
 int getClassAttributeIndex()
          Get the index of the classification attribute in this attribute set's ordering of attributes
 void print()
          Print a legible version of the attribute set.
 void setClassAttribute(java.lang.String name)
          Set the classification attribute to the attribute with the given name
 void setDefaultClassAttribute()
          The classification attribute is the final attribute, by default; this method is used to set this default.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AttributeSet

public AttributeSet()
Construct a new AttributeSet with an empty set of attributes.

Method Detail

addAttribute

public void addAttribute(Attribute attribute)
Add the given attribute to the attribute set.

Parameters:
attribute - the attribute to be added to this attribute set

setClassAttribute

public void setClassAttribute(java.lang.String name)
Set the classification attribute to the attribute with the given name

Parameters:
name - a string naming the classification attribute

getAttributeIndex

public int getAttributeIndex(Attribute attribute)
Get the index of the given attribute in the attribute set's ordering.

Parameters:
attribute - the attribute whose index is desired
Returns:
the attribute's index in this class's array list

getAttributeIndex

public int getAttributeIndex(java.lang.String name)
Get the index of the given attribute in the attribute set's ordering.

Parameters:
name - the name of the attribute whose index is desired
Returns:
the attribute's index in this class's array list

getAttribute

public Attribute getAttribute(java.lang.String name)
Get the attribute with the given name.

Parameters:
name - the name of the desired attribute
Returns:
the attribute corresponding to the given name

getClassAttribute

public Attribute getClassAttribute()
Get the classification attribute for this attribute set.

Returns:
the classification attribute for this attribute set

getClassAttributeAsString

public java.lang.String getClassAttributeAsString()
Get the name of the classification attribute for this attribute set.

Returns:
the name of the classification attribute for this attribute set

setDefaultClassAttribute

public void setDefaultClassAttribute()
The classification attribute is the final attribute, by default; this method is used to set this default.


print

public void print()
Print a legible version of the attribute set.


getAttributes

public java.util.ArrayList<Attribute> getAttributes()
Get a list of attributes in the attribute set. Attributes are returned in their fixed ordering defined by the attribute set.

Returns:
the attributes in the attribute set

getClassAttributeIndex

public int getClassAttributeIndex()
Get the index of the classification attribute in this attribute set's ordering of attributes

Returns:
the index of the classification attribute in this attribute set's ordering of attributes