|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcosc575.p1.Attributes
public class Attributes
Stores the attributes information for data sets for machine learning.
| Field Summary | |
|---|---|
private java.util.ArrayList<Attribute> |
attributes
a list of attribute names |
private int |
classIndex
stores the position of the class label |
(package private) boolean |
hasDiscreteAttributes
a flag indicating that the data set has one or more discrete attributes |
(package private) boolean |
hasNominalAttributes
a flag indicating that the data set has one or more nominal attributes |
(package private) boolean |
hasNumericAttributes
a flag indicating that the data set has one or more numeric attributes |
| Constructor Summary | |
|---|---|
Attributes()
Default constructor. |
|
Attributes(java.util.Scanner scanner)
Explicit constructor. |
|
| Method Summary | |
|---|---|
void |
add(Attribute attribute)
Adds a new attribute to this set of attributes. |
Attribute |
get(int i)
Returns the ith attribute in this set of attributes. |
Attribute |
getClassAttribute()
Returns the class attribute. |
int |
getClassIndex()
Returns the index of the class label. |
boolean |
getHasDiscreteAttributes()
Returns true if this set of attributes has one or more discrete attributes; returns false otherwise. |
boolean |
getHasNominalAttributes()
Returns true if this set of attributes has one or more nominal attributes; returns false otherwise. |
boolean |
getHasNumericAttributes()
Returns true if this set of attributes has one or more numeric attributes; returns false otherwise. |
int |
getIndex(java.lang.String name)
Returns the attribute's index. |
int |
getSize()
Returns the number of attributes. |
private void |
initialize()
Initializes the names, types, and domains lists. |
static void |
main(java.lang.String[] args)
|
private void |
parse(java.util.Scanner scanner)
Parses the attribute declarations in the specified scanner. |
void |
setClassIndex(int classIndex)
Sets the class index for this set of attributes. |
java.lang.String |
toString()
Returns a string representation of the names structure. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private java.util.ArrayList<Attribute> attributes
boolean hasNumericAttributes
boolean hasNominalAttributes
boolean hasDiscreteAttributes
private int classIndex
| Constructor Detail |
|---|
Attributes()
Attributes(java.util.Scanner scanner)
throws java.lang.Exception
scanner - a Scanner containing the data set's tokens
java.lang.Exception - if an exception occurs| Method Detail |
|---|
private void initialize()
public int getClassIndex()
public void setClassIndex(int classIndex)
throws java.lang.Exception
classIndex - the new class index
java.lang.Exception - if an exception occurspublic boolean getHasNumericAttributes()
public boolean getHasDiscreteAttributes()
public boolean getHasNominalAttributes()
public Attribute get(int i)
throws java.lang.Exception
i - the index of the specified attribute
java.lang.Exception - if an exception occurs
public Attribute getClassAttribute()
throws java.lang.Exception
java.lang.Exception - if an exception occurspublic int getSize()
public int getIndex(java.lang.String name)
throws java.lang.Exception
name - the attribute's name
java.lang.Exception - if an exception occurs
public void add(Attribute attribute)
throws java.lang.Exception
attribute - the attribute's name
java.lang.Exception - if an exception occurs
private void parse(java.util.Scanner scanner)
throws java.lang.Exception
scanner - a Scanner containing the data set's tokens
java.lang.Exception - if an exception occurspublic java.lang.String toString()
toString in class java.lang.Objectpublic static void main(java.lang.String[] args)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||