|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.EnsembleLibrary
weka.classifiers.meta.ensembleSelection.EnsembleSelectionLibrary
public class EnsembleSelectionLibrary
This class represents an ensemble library. That is a collection of models that will be combined via the ensemble selection algorithm. This class is responsible for tracking all of the unique model specifications in the current library and trainined them when asked. There are also methods to save/load library model list files.
Field Summary | |
---|---|
boolean |
m_Debug
Whether we should print debug messages. |
Fields inherited from class weka.classifiers.EnsembleLibrary |
---|
FLAT_FILE_EXTENSION, m_Models, XML_FILE_EXTENSION |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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(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(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(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.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. |
Instances |
trainAll(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). |
Methods inherited from class weka.classifiers.EnsembleLibrary |
---|
addModel, addModel, addPropertyChangeListener, clearModels, getModels, loadLibrary, loadLibrary, loadLibrary, removeModel, saveLibrary, setModels, size |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public transient boolean m_Debug
Constructor Detail |
---|
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 streamMethod Detail |
---|
public 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 Instances trainAll(Instances data, java.lang.String directory, int algorithm) throws java.lang.Exception
data
- the data to work ondirectory
- the working directoryalgorithm
- the type of algorithm
java.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(Classifier classifier)
createModel
in class EnsembleLibrary
classifier
- the classifier to use
public EnsembleLibraryModel createModel(java.lang.String modelString)
createModel
in class EnsembleLibrary
modelString
- the classifier definition
public static java.lang.String getInstancesChecksum(Instances instances)
instances
- the data to get the checksum for
public static java.lang.String getDataDirectoryName(Instances instances)
instances
- the data to get the directory for
public void addWorkingDirectoryListener(java.beans.PropertyChangeListener listener)
listener
- a new listener to add to the list
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |