uk.ac.ed.inf.enzml.mulan.attributesfilter
Class AttributesFilter
java.lang.Object
uk.ac.ed.inf.utils.Initialised
uk.ac.ed.inf.enzml.mulan.attributesfilter.AttributesFilter
- All Implemented Interfaces:
- uk.ac.ed.inf.utils.Initialisable
public class AttributesFilter
- extends uk.ac.ed.inf.utils.Initialised
This class filters the attributes of a dataset (the test set) to make it
compatible with another dataset (the train set). The result is a new dataset
that can be used as test set for the specified train set.
Main operations: 1. Attributes: only attributes present in the train set can
appear in the test set (& all of them must be present) 2. Class attributes:
all the classes of the train set *and* the test set must be conserved, to
allow for train/test evaluation. This means that also the train arff must be
regenerated to include all the classes present in the test set (the class
numbering will change). 3. Mulan XML file (class labels): cannot be the same
XML file of the training set, must also include all the classes in the test
set. 4. New test ARFF File: the new test set arff file name should mention
the original files and which attributes and classes were used for filtering
(that is, left in the file or added to the file). 5. New train ARFF file:
(including also the test classes) 'trainset id' + 'including_classes_of' +
'test_set id' + '.arff' 6. New test ARFF record: when stored in the database,
should contain trace (id/props file path) of the original training set and
the "old" test set used to generate the "new", filtered, test set.
- Version:
- 3 Sep 2010
- Author:
- Luna De Ferrari luna.deferrari-at-ed.ac.uk
| Fields inherited from class uk.ac.ed.inf.utils.Initialised |
m_initialisationIsCorrect |
|
Constructor Summary |
AttributesFilter(int oldTrainArffId,
int oldTestArffId,
java.lang.String dataDatabaseProps,
java.lang.String arffAndResultsPropsFileName)
|
| Methods inherited from class uk.ac.ed.inf.utils.Initialised |
initialisationIsCorrect, setInitialisationIsCorrect |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AttributesFilter
public AttributesFilter(int oldTrainArffId,
int oldTestArffId,
java.lang.String dataDatabaseProps,
java.lang.String arffAndResultsPropsFileName)
createNewArff
public int createNewArff(int oldArffRecordId)
- Parameters:
oldArffRecordId - the database id of the old arff file
- Returns:
- the database id of the new, filtered arff file
createNewTestArff
public void createNewTestArff()
createNewTrainArff
public void createNewTrainArff()
getArffAndResultsProperties
public java.lang.String getArffAndResultsProperties()
getArffRecordsDbManager
public uk.ac.ed.inf.utils.database.DbManager getArffRecordsDbManager()
getArffTableReader
public ArffPropsTableReader getArffTableReader()
getDataDbManager
public uk.ac.ed.inf.utils.database.DbManager getDataDbManager()
getDataDbPath
public java.lang.String getDataDbPath()
getNewTestArffId
public int getNewTestArffId()
getNewTrainArffId
public int getNewTrainArffId()
getOldTestArffId
public int getOldTestArffId()
getOldTrainArffId
public int getOldTrainArffId()
- public MulanArff getTrainArff() { return m_trainArff; }
getTrainAttributesAndTrainTestClasses
public java.util.TreeSet<java.lang.String> getTrainAttributesAndTrainTestClasses()
getTrainXmlPath
public java.lang.String getTrainXmlPath()
getXmlPathById
public java.lang.String getXmlPathById(int arffId)
getXmlQueryById
public java.lang.String getXmlQueryById(int arffId)
main
public static void main(java.lang.String[] args)
run
public static int[] run(int oldTrainArffId,
int oldTestArffId,
java.lang.String dataDbPropsFile,
java.lang.String resultsPropsFileName)
- Filter the old test arff by the train arff given and regenerate the old
train set using all train+test classes.
- Parameters:
oldTrainArffId - the record id of the original training arffoldTestArffId - the record id of the original test arffresultsPropsFileName - the database where to write the new arff recordsdataDbPropsFile - the database where to read the data to rebuild the arff files
- Returns:
- the identifiers of the new train and test arff records in the
database