weka.classifiers
Class ClassificationViaRegression

java.lang.Object
  |
  +--weka.classifiers.Classifier
        |
        +--weka.classifiers.DistributionClassifier
              |
              +--weka.classifiers.ClassificationViaRegression
All Implemented Interfaces:
java.lang.Cloneable, OptionHandler, java.io.Serializable

public class ClassificationViaRegression
extends DistributionClassifier
implements OptionHandler

Class for doing classification using regression methods. For more information, see

E. Frank, Y. Wang, S. Inglis, G. Holmes, and I.H. Witten (1998) "Using model trees for classification", Machine Learning, Vol.32, No.1, pp. 63-76.

Valid options are:

-W classname
Specify the full class name of a numeric predictor as the basis for the classifier (required).

Author:
Eibe Frank (eibe@cs.waikato.ac.nz), Len Trigg (trigg@cs.waikato.ac.nz)
See Also:
Serialized Form

Constructor Summary
ClassificationViaRegression()
           
 
Method Summary
 void buildClassifier(Instances insts)
          Builds the classifiers.
 double[] distributionForInstance(Instance inst)
          Returns the distribution for an instance.
 Classifier getClassifier()
          Get the base classifier (regression scheme) used as the classifier
 java.lang.String[] getOptions()
          Gets the current settings of the Classifier.
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options
static void main(java.lang.String[] argv)
          Main method for testing this class.
 void setClassifier(Classifier newClassifier)
          Set the base classifier.
 void setOptions(java.lang.String[] options)
          Sets a given list of options.
 java.lang.String toString()
          Prints the classifiers.
 
Methods inherited from class weka.classifiers.DistributionClassifier
classifyInstance
 
Methods inherited from class weka.classifiers.Classifier
forName, makeCopies
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassificationViaRegression

public ClassificationViaRegression()
Method Detail

buildClassifier

public void buildClassifier(Instances insts)
                     throws java.lang.Exception
Builds the classifiers.
Overrides:
buildClassifier in class Classifier
Parameters:
insts - the training data.
Throws:
java.lang.Exception - if a classifier can't be built

distributionForInstance

public double[] distributionForInstance(Instance inst)
                                 throws java.lang.Exception
Returns the distribution for an instance.
Overrides:
distributionForInstance in class DistributionClassifier
Throws:
java.lang.Exception - if the distribution can't be computed successfully

toString

public java.lang.String toString()
Prints the classifiers.
Overrides:
toString in class java.lang.Object

listOptions

public java.util.Enumeration listOptions()
Returns an enumeration describing the available options
Specified by:
listOptions in interface OptionHandler
Returns:
an enumeration of all the available options

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Sets a given list of options. Valid options are:

-W classname
Specify the full class name of a numeric predictor as the basis for the classifier (required).

Specified by:
setOptions in interface OptionHandler
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported

getOptions

public java.lang.String[] getOptions()
Gets the current settings of the Classifier.
Specified by:
getOptions in interface OptionHandler
Returns:
an array of strings suitable for passing to setOptions

setClassifier

public void setClassifier(Classifier newClassifier)
Set the base classifier.
Parameters:
newClassifier - the Classifier to use.

getClassifier

public Classifier getClassifier()
Get the base classifier (regression scheme) used as the classifier
Returns:
the classifier used as the classifier

main

public static void main(java.lang.String[] argv)
Main method for testing this class.
Parameters:
argv - the options for the learner