weka.classifiers.meta
Class Corr

java.lang.Object
  extended by weka.classifiers.AbstractClassifier
      extended by weka.classifiers.SingleClassifierEnhancer
          extended by weka.classifiers.meta.Corr
All Implemented Interfaces:
Serializable, Cloneable, weka.classifiers.Classifier, weka.core.CapabilitiesHandler, weka.core.OptionHandler, weka.core.RevisionHandler, weka.core.WeightedInstancesHandler

public class Corr
extends weka.classifiers.SingleClassifierEnhancer
implements weka.core.WeightedInstancesHandler

Assume NO MISSING VALUES, all attributes must be NUMERIC (or 0/1 maybe ...). Simple attribute selection for regression: select k most correlated attrs ...

Valid options are:

 -D
  If set, classifier is run in debug mode and
  may output additional info to the console
 -W
  Full name of base classifier.
  (default: weka.classifiers.functions.LinearRegression)
 Options specific to classifier weka.classifiers.rules.ZeroR:
 
 -D
  If set, classifier is run in debug mode and
  may output additional info to the console
 -K <int>
  The number of attrs. (default: 0 = numEx/2)

Version:
$Revision: 4521 $
Author:
???
See Also:
Serialized Form

Field Summary
protected  int m_classIndex
           
protected  double[] m_coeffs
           
protected  int m_k
           
protected  weka.filters.unsupervised.attribute.Remove m_remove
           
protected  int[] m_subset
           
 
Fields inherited from class weka.classifiers.SingleClassifierEnhancer
m_Classifier
 
Fields inherited from class weka.classifiers.AbstractClassifier
m_Debug
 
Constructor Summary
Corr()
           
 
Method Summary
 void buildClassifier(weka.core.Instances data)
          Builds the classifier.
 double classifyInstance(weka.core.Instance instance)
          Returns the prediction.
protected  String defaultClassifierString()
          String describing default classifier.
 double[] getCoeffs()
           
 int getNumattrs()
           
 String[] getOptions()
          Gets the current settings of the Classifier.
 String getRevision()
           
 int[] getSubset()
           
 weka.core.Instances getSubset(weka.core.Instances data)
           
 String globalInfo()
          Returns a string describing classifier.
 String keepIndices(weka.core.Instances data)
           
 String keepIndicesBasedOnCorrelation(weka.core.Instances data)
           
 Enumeration listOptions()
          Returns an enumeration describing the available options.
static void main(String[] argv)
          Main method for testing this class.
 double[] means(weka.core.Instances data)
           
 double[] msq(weka.core.Instances data)
           
 String numattrsTipText()
          Returns the tip text for this property.
 double[] sampleCorrs(weka.core.Instances data)
           
 double[] sampleDevs(weka.core.Instances data, double[] mean)
           
 void saveObject(Object o)
           
 void setNumattrs(int k)
           
 void setOptions(String[] options)
          Parses a given list of options.
 double[] sumXY(weka.core.Instances data)
           
 String toString()
          Returns description of classifier.
 
Methods inherited from class weka.classifiers.SingleClassifierEnhancer
classifierTipText, getCapabilities, getClassifier, getClassifierSpec, setClassifier
 
Methods inherited from class weka.classifiers.AbstractClassifier
debugTipText, distributionForInstance, forName, getDebug, makeCopies, makeCopy, runClassifier, setDebug
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_remove

protected weka.filters.unsupervised.attribute.Remove m_remove

m_classIndex

protected int m_classIndex

m_k

protected int m_k

m_subset

protected int[] m_subset

m_coeffs

protected double[] m_coeffs
Constructor Detail

Corr

public Corr()
Method Detail

defaultClassifierString

protected String defaultClassifierString()
String describing default classifier.

Overrides:
defaultClassifierString in class weka.classifiers.SingleClassifierEnhancer
Returns:
the default classifier

globalInfo

public String globalInfo()
Returns a string describing classifier.

Returns:
a description suitable for displaying in the explorer/experimenter gui

listOptions

public Enumeration listOptions()
Returns an enumeration describing the available options.

Specified by:
listOptions in interface weka.core.OptionHandler
Overrides:
listOptions in class weka.classifiers.SingleClassifierEnhancer
Returns:
an enumeration of all the available options.

setOptions

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

 -D
  If set, classifier is run in debug mode and
  may output additional info to the console
 -W
  Full name of base classifier.
  (default: weka.classifiers.functions.LinearRegression)
 Options specific to classifier weka.classifiers.rules.ZeroR:
 
 -D
  If set, classifier is run in debug mode and
  may output additional info to the console
 -K <int>
  The number of attrs. (default: 0 = numEx/2)

Specified by:
setOptions in interface weka.core.OptionHandler
Overrides:
setOptions in class weka.classifiers.SingleClassifierEnhancer
Parameters:
options - the list of options as an array of strings
Throws:
Exception - if an option is not supported

getOptions

public String[] getOptions()
Gets the current settings of the Classifier.

Specified by:
getOptions in interface weka.core.OptionHandler
Overrides:
getOptions in class weka.classifiers.SingleClassifierEnhancer
Returns:
an array of strings suitable for passing to setOptions

getNumattrs

public int getNumattrs()

setNumattrs

public void setNumattrs(int k)

numattrsTipText

public String numattrsTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui

sampleCorrs

public double[] sampleCorrs(weka.core.Instances data)

sumXY

public double[] sumXY(weka.core.Instances data)

sampleDevs

public double[] sampleDevs(weka.core.Instances data,
                           double[] mean)

msq

public double[] msq(weka.core.Instances data)

means

public double[] means(weka.core.Instances data)

keepIndices

public String keepIndices(weka.core.Instances data)

keepIndicesBasedOnCorrelation

public String keepIndicesBasedOnCorrelation(weka.core.Instances data)

getSubset

public weka.core.Instances getSubset(weka.core.Instances data)
                              throws Exception
Throws:
Exception

buildClassifier

public void buildClassifier(weka.core.Instances data)
                     throws Exception
Builds the classifier.

Specified by:
buildClassifier in interface weka.classifiers.Classifier
Parameters:
data - the training data
Throws:
Exception - if something goes wrong

saveObject

public void saveObject(Object o)
                throws Exception
Throws:
Exception

classifyInstance

public double classifyInstance(weka.core.Instance instance)
                        throws Exception
Returns the prediction.

Specified by:
classifyInstance in interface weka.classifiers.Classifier
Overrides:
classifyInstance in class weka.classifiers.AbstractClassifier
Parameters:
instance - the instance to classify
Returns:
the prediction
Throws:
Exception - if prediction fails

getCoeffs

public double[] getCoeffs()

getSubset

public int[] getSubset()

toString

public String toString()
Returns description of classifier.

Overrides:
toString in class Object
Returns:
the model

getRevision

public String getRevision()
Specified by:
getRevision in interface weka.core.RevisionHandler
Overrides:
getRevision in class weka.classifiers.AbstractClassifier

main

public static void main(String[] argv)
                 throws Exception
Main method for testing this class.

Parameters:
argv - the options
Throws:
Exception


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.