public class EnsembleSelectionLibrary extends EnsembleLibrary implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
boolean |
m_Debug
Whether we should print debug messages.
|
FLAT_FILE_EXTENSION, m_Models, XML_FILE_EXTENSION
Constructor and Description |
---|
EnsembleSelectionLibrary()
Creates a default libary.
|
EnsembleSelectionLibrary(java.io.InputStream stream)
This constructor will create a library from the given XML stream.
|
EnsembleSelectionLibrary(java.lang.String libraryFileName)
This constructor will create a library from a model
list file given by the file name argument
|
EnsembleSelectionLibrary(java.lang.String dir,
int seed,
int folds,
double validationRatio)
Creates a default libary.
|
Modifier and Type | Method and Description |
---|---|
void |
addWorkingDirectoryListener(java.beans.PropertyChangeListener listener)
Adds an object to the list of those that wish to be informed when the
eotking directory changes.
|
EnsembleLibraryModel |
createModel(weka.classifiers.Classifier classifier)
creates a LibraryModel from a set of arguments
|
EnsembleLibraryModel |
createModel(java.lang.String modelString)
This method takes a String argument defining a classifier and
uses it to create a base Classifier.
|
void |
createWorkingDirectory(java.lang.String dirName)
Creates the working directory associated with this library
|
static java.lang.String |
getDataDirectoryName(weka.core.Instances instances)
Returns the unique name for the set of instances supplied.
|
double[][][] |
getHillclimbPredictions()
This method will get the predictions for all the models in the
ensemble library.
|
static java.lang.String |
getInstancesChecksum(weka.core.Instances instances)
This method takes an Instances object and returns a checksum of its
toString method - that is the checksum of the .arff file that would
be created if the Instances object were transformed into an arff file
in the file system.
|
java.lang.String |
getModelListFile()
Gets the model list file that holds the list of models
in the ensemble library.
|
java.util.Set |
getModelNames()
This method will return a Set object containing all the
String representations of the models.
|
java.lang.String |
getRevision()
Returns the revision string.
|
java.io.File |
getWorkingDirectory()
Gets the working Directory of the ensemble library.
|
void |
removeModel(java.lang.String modelKey)
This will remove the model associated with the given String
from the model libraryHashMap
|
void |
setDebug(boolean debug)
Set debug flag for the library and all its models.
|
void |
setModelListFile(java.lang.String modelListFile)
Sets the model list file that holds the list of models
in the ensemble library.
|
void |
setNumFolds(int numFolds)
Set the number of folds for cross validation.
|
void |
setValidationRatio(double validationRatio)
Sets the validation-set ratio.
|
void |
setWorkingDirectory(java.io.File workingDirectory)
Sets the working Directory of the ensemble library.
|
weka.core.Instances |
trainAll(weka.core.Instances data,
java.lang.String directory,
int algorithm)
This method will iterate through the TreeMap of models and
train all models that do not currently exist (are not
yet trained).
|
addModel, addModel, addPropertyChangeListener, clearModels, getModels, loadLibrary, loadLibrary, loadLibrary, removeModel, saveLibrary, setModels, size
public EnsembleSelectionLibrary()
public EnsembleSelectionLibrary(java.lang.String dir, int seed, int folds, double validationRatio)
dir
- the working directory form the ensemble libraryseed
- the seed valuefolds
- the number of foldsvalidationRatio
- the ratio to usepublic EnsembleSelectionLibrary(java.lang.String libraryFileName)
libraryFileName
- the library filenamepublic EnsembleSelectionLibrary(java.io.InputStream stream)
stream
- the XML library streampublic void setDebug(boolean debug)
debug
- if true debug mode is onpublic void setValidationRatio(double validationRatio)
validationRatio
- the new ratiopublic void setNumFolds(int numFolds)
numFolds
- the number of folds to usepublic weka.core.Instances trainAll(weka.core.Instances data, java.lang.String directory, int algorithm) throws java.lang.Exception
data
- the data to work ondirectory
- the working directoryalgorithm
- the type of algorithmjava.lang.Exception
- if something goes wrongpublic void createWorkingDirectory(java.lang.String dirName)
dirName
- the new directorypublic void removeModel(java.lang.String modelKey)
modelKey
- the key of the modelpublic java.util.Set getModelNames()
public double[][][] getHillclimbPredictions()
public java.io.File getWorkingDirectory()
public void setWorkingDirectory(java.io.File workingDirectory)
workingDirectory
- the working directory to use.public java.lang.String getModelListFile()
public void setModelListFile(java.lang.String modelListFile)
modelListFile
- the model list file to usepublic EnsembleLibraryModel createModel(weka.classifiers.Classifier classifier)
createModel
in class EnsembleLibrary
classifier
- the classifier to usepublic EnsembleLibraryModel createModel(java.lang.String modelString)
createModel
in class EnsembleLibrary
modelString
- the classifier definitionpublic static java.lang.String getInstancesChecksum(weka.core.Instances instances)
instances
- the data to get the checksum forpublic static java.lang.String getDataDirectoryName(weka.core.Instances instances)
instances
- the data to get the directory forpublic void addWorkingDirectoryListener(java.beans.PropertyChangeListener listener)
listener
- a new listener to add to the listpublic java.lang.String getRevision()
getRevision
in interface weka.core.RevisionHandler
getRevision
in class EnsembleLibrary