EnsembleLibrary

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.classifiers
Class EnsembleLibrary

    java.lang.Object
      weka.classifiers.EnsembleLibrary

All Implemented Interfaces:
  java.io.Serializable, RevisionHandler

Direct Known Subclasses:
  EnsembleSelectionLibrary

    public class EnsembleLibrary

extends java.lang.Object
implements java.io.Serializable, RevisionHandler

This class represents a library of classifiers. This class follows the factory design pattern of creating LibraryModels when asked. It also has the methods necessary for saving and loading models from lists.

Version:
  $Revision: 1.2 $
Author:
  Robert Jung (mrbobjung@gmail.com)
See Also:
  Serialized Form

Field Summary
`static java.lang.String` | `FLAT_FILE_EXTENSION` The flat file extension for model list files
`java.util.TreeSet` | `m_Models` the set of classifiers that constitute the library
`static java.lang.String` | `XML_FILE_EXTENSION` The default file extension for model list files

Constructor Summary
`EnsembleLibrary()` Constructor is responsible for initializing the data structure hoilding all of the models

Method Summary
`void` | `addModel(EnsembleLibraryModel model)` adds a LibraryModel to the Library
`void` | `addModel(java.lang.String modelString)` adds a LibraryModel to the Library
`void` | `addPropertyChangeListener(java.beans.PropertyChangeListener listener)` Adds an object to the list of those that wish to be informed when the library changes.
`void` | `clearModels()` removes all models from the current library
`EnsembleLibraryModel` | `createModel(Classifier classifier)` creates a LibraryModel from a string representing the command line invocation
`EnsembleLibraryModel` | `createModel(java.lang.String modelString)` This method takes a String argument defining a classifier and uses it to create a base Classifier.
`java.util.TreeSet` | `getModels()` getter for the set of models in this library
`java.lang.String` | `getRevision()` Returns the revision string.
`static void` | `loadLibrary(java.io.File selectedFile, EnsembleLibrary library)` This method takes a model list file and a library object as arguments and Instantiates all of the models in the library list file.
`static void` | `loadLibrary(java.io.File selectedFile, javax.swing.JComponent dialogParent, EnsembleLibrary library)` Loads and returns a library from the specified file
`static void` | `loadLibrary(java.io.InputStream stream, EnsembleLibrary library)` This method takes an XML input stream and a library object as arguments and Instantiates all of the models in the stream.
`void` | `removeModel(EnsembleLibraryModel model)` removes a LibraryModel from the Library
`static void` | `saveLibrary(java.io.File selectedFile, EnsembleLibrary library, javax.swing.JComponent dialogParent)` Saves the given library in the specified file.
`void` | `setModels(java.util.TreeSet models)` setter for the set of models in this library
`int` | `size()` Returns the number of models in the ensemble library

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### XML_FILE_EXTENSION

    public static final java.lang.String XML_FILE_EXTENSION

  The default file extension for model list files

  See Also:
    Constant Field Values

### FLAT_FILE_EXTENSION

    public static final java.lang.String FLAT_FILE_EXTENSION

  The flat file extension for model list files

  See Also:
    Constant Field Values

### m_Models

    public java.util.TreeSet m_Models

  the set of classifiers that constitute the library

Constructor Detail

### EnsembleLibrary

    public EnsembleLibrary()

  Constructor is responsible for initializing the data structure hoilding all of the models

Method Detail

### size

    public int size()

  Returns the number of models in the ensemble library

  Returns:
    the number of models

### addModel

    public void addModel(EnsembleLibraryModel model)

  adds a LibraryModel to the Library

  Parameters:
    `model` - the model to add

### addModel

    public void addModel(java.lang.String modelString)

  adds a LibraryModel to the Library

  Parameters:
    `modelString` - the model to add

### removeModel

    public void removeModel(EnsembleLibraryModel model)

  removes a LibraryModel from the Library

  Parameters:
    `model` - the model to remove

### createModel

    public EnsembleLibraryModel createModel(Classifier classifier)

  creates a LibraryModel from a string representing the command line invocation

  Parameters:
    `classifier` - the classifier to create a model from
  Returns:
    the generated model

### createModel

    public EnsembleLibraryModel createModel(java.lang.String modelString)

  This method takes a String argument defining a classifier and uses it to create a base Classifier.

  Parameters:
    `modelString` - the classifier string
  Returns:
    the generated model

### getModels

    public java.util.TreeSet getModels()

  getter for the set of models in this library

  Returns:
    the current models

### setModels

    public void setModels(java.util.TreeSet models)

  setter for the set of models in this library

  Parameters:
    `models` - the models to use

### clearModels

    public void clearModels()

  removes all models from the current library

### loadLibrary

    public static void loadLibrary(java.io.File selectedFile,
                                   javax.swing.JComponent dialogParent,
                                   EnsembleLibrary library)

  Loads and returns a library from the specified file

  Parameters:
    `selectedFile` - the file to load from
    `dialogParent` - the parent component
    `library` - will contain the data after loading

### loadLibrary

    public static void loadLibrary(java.io.File selectedFile,
                                   EnsembleLibrary library)
                            throws java.lang.Exception

  This method takes a model list file and a library object as arguments and Instantiates all of the models in the library list file. It is assumed that the passed library was an associated working directory and can take care of creating the model objects itself.

  Parameters:
    `selectedFile` - the file to load
    `library` - the library
  Throws:
    `java.lang.Exception` - if something goes wrong

### loadLibrary

    public static void loadLibrary(java.io.InputStream stream,
                                   EnsembleLibrary library)
                            throws java.lang.Exception

  This method takes an XML input stream and a library object as arguments and Instantiates all of the models in the stream. It is assumed that the passed library was an associated working directory and can take care of creating the model objects itself.

  Parameters:
    `stream` - the XML stream to load
    `library` - the library
  Throws:
    `java.lang.Exception` - if something goes wrong

### saveLibrary

    public static void saveLibrary(java.io.File selectedFile,
                                   EnsembleLibrary library,
                                   javax.swing.JComponent dialogParent)

  Saves the given library in the specified file. This saves only the specification of the models as a model list.

  Parameters:
    `selectedFile` - the file to save to
    `library` - the library to save
    `dialogParent` - the component parent

### addPropertyChangeListener

    public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)

  Adds an object to the list of those that wish to be informed when the library changes.

  Parameters:
    `listener` - a new listener to add to the list

### getRevision

    public java.lang.String getRevision()

  Returns the revision string.

  Specified by:
    `getRevision` in interface `RevisionHandler`
  Returns:
    the revision

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD