All Packages Class Hierarchy This Package Previous Next Index WEKA's home
Class weka.classifiers.Classifier
java.lang.Object
|
+----weka.classifiers.Classifier
- public abstract class Classifier
- extends java.lang.Object
- implements java.lang.Cloneable, java.io.Serializable
Abstract classifier. All schemes for numeric or nominal prediction in
Weka extend this class.
- Version:
- $Revision: 1.8 $
- Author:
- Eibe Frank (eibe@cs.waikato.ac.nz)
- Author:
- Len Trigg (trigg@cs.waikato.ac.nz)
Classifier()
-
buildClassifier(Instances)
- Generates a classifier.
classifyInstance(Instance)
- Classifies a given instance.
forName(String, String[])
- Creates a new instance of a classifier given it's class name and
(optional) arguments to pass to it's setOptions method.
makeCopies(Classifier, int)
- Creates copies of the current classifier, which can then
be used for boosting etc.
Classifier
public Classifier()
buildClassifier
public abstract void buildClassifier(Instances data) throws java.lang.Exception
Generates a classifier. Must initialize all fields of the classifier
that are not being set via options (ie. multiple calls of buildClassifier
must always lead to the same result). Must not change the dataset
in any way.
- Parameters:
data
- set of instances serving as training data
- Throws:
- java.lang.Exception - if the classifier has not been
generated successfully
classifyInstance
public abstract double classifyInstance(Instance instance) throws java.lang.Exception
Classifies a given instance.
- Parameters:
instance
- the instance to be classified
- Returns:
- index of the predicted class as a double
if the class is nominal, otherwise the predicted value
- Throws:
- java.lang.Exception - if instance could not be classified
successfully
forName
public static Classifier forName(java.lang.String classifierName,
java.lang.String options[]) throws java.lang.Exception
Creates a new instance of a classifier given it's class name and
(optional) arguments to pass to it's setOptions method. If the
classifier implements OptionHandler and the options parameter is
non-null, the classifier will have it's options set.
- Parameters:
classifierName
- the fully qualified class name of the classifier
options
- an array of options suitable for passing to setOptions. May
be null.
- Returns:
- the newly created classifier, ready for use.
- Throws:
- java.lang.Exception - if the classifier name is invalid, or the options
supplied are not acceptable to the classifier
makeCopies
public static Classifier[] makeCopies(Classifier model,
int num) throws java.lang.Exception
Creates copies of the current classifier, which can then
be used for boosting etc. Note that this method now uses
Serialization to perform a deep copy, so the Classifier
object must be fully Serializable. Any currently built model
will now be copied as well.
- Parameters:
model
- an example classifier to copy
num
- the number of classifiers copies to create.
- Returns:
- an array of classifiers.
- Throws:
- java.lang.Exception - if an error occurs
All Packages Class Hierarchy This Package Previous Next Index WEKA's home