public class PrincipalComponents extends UnsupervisedAttributeEvaluator implements AttributeTransformer, OptionHandler
-C Center (rather than standardize) the data and compute PCA using the covariance (rather than the correlation) matrix.
-R Retain enough PC attributes to account for this proportion of variance in the original data. (default = 0.95)
-O Transform through the PC space and back to the original space.
-A Maximum number of attributes to include in transformed attribute names. (-1 = include all)
Constructor and Description |
---|
PrincipalComponents() |
Modifier and Type | Method and Description |
---|---|
void |
buildEvaluator(Instances data)
Initializes principal components and performs the analysis
|
String |
centerDataTipText()
Returns the tip text for this property
|
Instance |
convertInstance(Instance instance)
Transform an instance in original (unormalized) format.
|
double |
evaluateAttribute(int att)
Evaluates the merit of a transformed attribute.
|
Capabilities |
getCapabilities()
Returns the capabilities of this evaluator.
|
boolean |
getCenterData()
Get whether to center (rather than standardize)
the data.
|
int |
getMaximumAttributeNames()
Gets maximum number of attributes to include in
transformed attribute names.
|
String[] |
getOptions()
Gets the current settings of PrincipalComponents
|
String |
getRevision()
Returns the revision string.
|
boolean |
getTransformBackToOriginal()
Gets whether the data is to be transformed back to the original
space.
|
double |
getVarianceCovered()
Gets the proportion of total variance to account for when
retaining principal components
|
String |
globalInfo()
Returns a string describing this attribute transformer
|
Enumeration |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(String[] argv)
Main method for testing this class
|
String |
maximumAttributeNamesTipText()
Returns the tip text for this property
|
void |
setCenterData(boolean center)
Set whether to center (rather than standardize)
the data.
|
void |
setMaximumAttributeNames(int m)
Sets maximum number of attributes to include in
transformed attribute names.
|
void |
setOptions(String[] options)
Parses a given list of options.
|
void |
setTransformBackToOriginal(boolean b)
Sets whether the data should be transformed back to the original
space
|
void |
setVarianceCovered(double vc)
Sets the amount of variance to account for when retaining
principal components
|
String |
toString()
Returns a description of this attribute transformer
|
String |
transformBackToOriginalTipText()
Returns the tip text for this property
|
Instances |
transformedData(Instances data)
Gets the transformed training data.
|
Instances |
transformedHeader()
Returns just the header for the transformed data (ie.
|
String |
varianceCoveredTipText()
Returns the tip text for this property
|
forName, makeCopies, postProcess, runEvaluator
public String globalInfo()
public Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(String[] options) throws Exception
-C Center (rather than standardize) the data and compute PCA using the covariance (rather than the correlation) matrix.
-R Retain enough PC attributes to account for this proportion of variance in the original data. (default = 0.95)
-O Transform through the PC space and back to the original space.
-A Maximum number of attributes to include in transformed attribute names. (-1 = include all)
setOptions
in interface OptionHandler
options
- the list of options as an array of stringsException
- if an option is not supportedpublic String centerDataTipText()
public void setCenterData(boolean center)
center
- true if the data is to be
centered rather than standardizedpublic boolean getCenterData()
public String varianceCoveredTipText()
public void setVarianceCovered(double vc)
vc
- the proportion of total variance to account forpublic double getVarianceCovered()
public String maximumAttributeNamesTipText()
public void setMaximumAttributeNames(int m)
m
- the maximum number of attributespublic int getMaximumAttributeNames()
public String transformBackToOriginalTipText()
public void setTransformBackToOriginal(boolean b)
b
- true if the data should be transformed back to the
original spacepublic boolean getTransformBackToOriginal()
public String[] getOptions()
getOptions
in interface OptionHandler
public Capabilities getCapabilities()
getCapabilities
in interface CapabilitiesHandler
getCapabilities
in class ASEvaluation
Capabilities
public void buildEvaluator(Instances data) throws Exception
buildEvaluator
in class ASEvaluation
data
- the instances to analyse/transformException
- if analysis failspublic Instances transformedHeader() throws Exception
transformedHeader
in interface AttributeTransformer
Exception
- if the header of the transformed data can't
be determined.public Instances transformedData(Instances data) throws Exception
transformedData
in interface AttributeTransformer
Exception
- if transformed data can't be returnedpublic double evaluateAttribute(int att) throws Exception
evaluateAttribute
in interface AttributeEvaluator
att
- the attribute to be evaluatedException
- if attribute can't be evaluatedpublic String toString()
public Instance convertInstance(Instance instance) throws Exception
convertInstance
in interface AttributeTransformer
instance
- an instance in the original (unormalized) formatException
- if instance cant be transformedpublic String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class ASEvaluation
public static void main(String[] argv)
argv
- should contain the command line arguments to the
evaluator/transformer (see AttributeSelection)Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.