Package weka.classifiers.meta
Class Corr
- java.lang.Object
-
- weka.classifiers.AbstractClassifier
-
- weka.classifiers.SingleClassifierEnhancer
-
- weka.classifiers.meta.Corr
-
- All Implemented Interfaces:
Serializable
,Cloneable
,weka.classifiers.Classifier
,weka.core.BatchPredictor
,weka.core.CapabilitiesHandler
,weka.core.CapabilitiesIgnorer
,weka.core.CommandlineRunnable
,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$
- Author:
- ???
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_classIndex
protected double[]
m_coeffs
protected int
m_k
protected weka.filters.unsupervised.attribute.Remove
m_remove
protected int[]
m_subset
-
Constructor Summary
Constructors Constructor Description Corr()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, defaultClassifierOptions, getCapabilities, getClassifier, getClassifierSpec, postExecution, preExecution, setClassifier
-
Methods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, debugTipText, distributionForInstance, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
-
-
-
Method Detail
-
defaultClassifierString
protected String defaultClassifierString()
String describing default classifier.- Overrides:
defaultClassifierString
in classweka.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 interfaceweka.core.OptionHandler
- Overrides:
listOptions
in classweka.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 interfaceweka.core.OptionHandler
- Overrides:
setOptions
in classweka.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 interfaceweka.core.OptionHandler
- Overrides:
getOptions
in classweka.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 interfaceweka.classifiers.Classifier
- Parameters:
data
- the training data- Throws:
Exception
- if something goes wrong
-
classifyInstance
public double classifyInstance(weka.core.Instance instance) throws Exception
Returns the prediction.- Specified by:
classifyInstance
in interfaceweka.classifiers.Classifier
- Overrides:
classifyInstance
in classweka.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.
-
getRevision
public String getRevision()
- Specified by:
getRevision
in interfaceweka.core.RevisionHandler
- Overrides:
getRevision
in classweka.classifiers.AbstractClassifier
-
-