classification
Class DataSet

java.lang.Object
  extended by classification.DataSet

public class DataSet
extends java.lang.Object

This class represents a set of data


Constructor Summary
DataSet(int id, java.lang.String name, java.lang.String filename)
          Creates a new data set with contents loaded from an XML file.
 
Method Summary
 double comparePredictionSets(PredictionSet set1, PredictionSet set2, java.lang.String attrName, boolean forData)
          Compares two sets of predictions to determine how similar they are, also giving an indication of which is more accurate.
 int getId()
           
 java.lang.String getName()
           
 boolean judgePrediction(Prediction p, boolean forData)
          Checks if a given prediction matches its corresponding value in the data set.
 double judgePredictionSet(PredictionSet pSet, java.lang.String attrName, boolean forData)
          Judges the accuracy of a set of predictions for this data set.
 void parseXML(java.lang.String filename)
          This method parses an XML file containing a data set, and adds the data to this DataSet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataSet

public DataSet(int id,
               java.lang.String name,
               java.lang.String filename)
        throws org.xml.sax.SAXException
Creates a new data set with contents loaded from an XML file.

Parameters:
id - The id number for the data set
name - The set's name
filename - The name of the file to read from (must include .xml)
Throws:
org.xml.sax.SAXException
Method Detail

judgePrediction

public boolean judgePrediction(Prediction p,
                               boolean forData)
Checks if a given prediction matches its corresponding value in the data set.

Parameters:
p - The prediction to check
forData - Should be true if p is a Data prediction, false if p is a Test prediction
Returns:
True if the prediction value is equal to the data value, else false

judgePredictionSet

public double judgePredictionSet(PredictionSet pSet,
                                 java.lang.String attrName,
                                 boolean forData)
                          throws java.lang.Exception
Judges the accuracy of a set of predictions for this data set.

Parameters:
pSet - A set of predictions to judge
attrName - The data attribute to judge the predictions for
forData - Should be true if pSet contains Data predictions, false for Test predictions
Returns:
The percentage of the predictions that were correct [0.0, 100.0]
Throws:
java.lang.Exception - if the prediction set is the wrong size or for different data

comparePredictionSets

public double comparePredictionSets(PredictionSet set1,
                                    PredictionSet set2,
                                    java.lang.String attrName,
                                    boolean forData)
                             throws java.lang.Exception
Compares two sets of predictions to determine how similar they are, also giving an indication of which is more accurate.

Parameters:
set1 - A set of predictions for this data set
set2 - Another set of predictions for this data set
attrName - The data attribute to compare the sets for
forData - Should be true to compare Data predictions, false for Test predictions
Returns:
The percentage of predictions that are identical between the sets. [0.0, 100] A positive result indicates set1 is more accurate, a negative result indicates set2 is.
Throws:
java.lang.Exception - If the predictions are not compatible with the data or each other

getId

public int getId()

getName

public java.lang.String getName()

parseXML

public final void parseXML(java.lang.String filename)
                    throws org.xml.sax.SAXException
This method parses an XML file containing a data set, and adds the data to this DataSet.

Parameters:
filename - The name/path of the XML prediction file to parse
Throws:
org.xml.sax.SAXException