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 Object
implements Cloneable, Serializable
Abstract classifier. All schemes for numeric or nominal prediction in Weka extend this class.

Version:
$Revision: 1.4 $
Author:
Eibe Frank (eibe@cs.waikato.ac.nz), Len Trigg (trigg@cs.waikato.ac.nz)

Constructor Index

 o Classifier()

Method Index

 o buildClassifier(Instances)
Generates a classifier.
 o classifyInstance(Instance)
Classifies a given instance.
 o 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.
 o makeCopies(Classifier, int)
Creates copies of the current classifier, which can then be used for boosting etc.

Constructors

 o Classifier
 public Classifier()

Methods

 o buildClassifier
 public abstract void buildClassifier(Instances data) throws 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: Exception
if the classifier has not been generated successfully
 o classifyInstance
 public abstract double classifyInstance(Instance instance) throws 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: Exception
if instance could not be classified successfully
 o forName
 public static Classifier forName(String classifierName,
                                  String options[]) throws 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: Exception
if the classifier name is invalid, or the options supplied are not acceptable to the classifier
 o makeCopies
 public static Classifier[] makeCopies(Classifier model,
                                       int num) throws Exception
Creates copies of the current classifier, which can then be used for boosting etc.

Parameters:
model - an example classifier to copy
num - the number of classifiers copies to create.
Returns:
an array of classifiers.
Throws: Exception
if an error occurs

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home