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

Class weka.attributeSelection.PrincipalComponents

java.lang.Object
    |
    +----weka.attributeSelection.ASEvaluation
            |
            +----weka.attributeSelection.AttributeEvaluator
                    |
                    +----weka.attributeSelection.PrincipalComponents

public class PrincipalComponents
extends AttributeEvaluator
implements AttributeTransformer, OptionHandler
Class for performing principal components analysis/transformation.

Version:
$Revision: 1.16 $
Author:
Mark Hall (mhall@cs.waikato.ac.nz)

Constructor Index

 o PrincipalComponents()
 

Method Index

 o buildEvaluator(Instances)
Initializes principal components and performs the analysis
 o convertInstance(Instance)
Transform an instance in original (unormalized) format.
 o evaluateAttribute(int)
Evaluates the merit of a transformed attribute.
 o getNormalize()
Gets whether or not input data is to be normalized
 o getOptions()
Gets the current settings of PrincipalComponents
 o getTransformBackToOriginal()
Gets whether the data is to be transformed back to the original space.
 o getVarianceCovered()
Gets the proportion of total variance to account for when retaining principal components
 o globalInfo()
Returns a string describing this attribute transformer
 o listOptions()
Returns an enumeration describing the available options

-N Don't normalize the input data.

 o main(String[])
Main method for testing this class
 o normalizeTipText()
Returns the tip text for this property
 o setNormalize(boolean)
Set whether input data will be normalized.
 o setOptions(String[])
Parses a given list of options.
 o setTransformBackToOriginal(boolean)
Sets whether the data should be transformed back to the original space
 o setVarianceCovered(double)
Sets the amount of variance to account for when retaining principal components
 o toString()
Returns a description of this attribute transformer
 o transformBackToOriginalTipText()
Returns the tip text for this property
 o transformedData()
Gets the transformed training data.
 o transformedHeader()
Returns just the header for the transformed data (ie.
 o varianceCoveredTipText()
Returns the tip text for this property

Constructor Detail

 o PrincipalComponents
public PrincipalComponents()

Method Detail

 o globalInfo
public java.lang.String globalInfo()
          Returns a string describing this attribute transformer
Returns:
a description of the evaluator suitable for displaying in the explorer/experimenter gui
 o listOptions
public java.util.Enumeration listOptions()
          Returns an enumeration describing the available options

-N Don't normalize the input data.

Returns:
an enumeration of all the available options
 o setOptions
public void setOptions(java.lang.String options[]) throws java.lang.Exception
          Parses a given list of options. Valid options are:

-N Don't normalize the input data.

Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported
 o normalizeTipText
public java.lang.String normalizeTipText()
          Returns the tip text for this property
Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui
 o setNormalize
public void setNormalize(boolean n)
          Set whether input data will be normalized.
Parameters:
n - true if input data is to be normalized
 o getNormalize
public boolean getNormalize()
          Gets whether or not input data is to be normalized
Returns:
true if input data is to be normalized
 o varianceCoveredTipText
public java.lang.String varianceCoveredTipText()
          Returns the tip text for this property
Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui
 o setVarianceCovered
public void setVarianceCovered(double vc)
          Sets the amount of variance to account for when retaining principal components
Parameters:
vc - the proportion of total variance to account for
 o getVarianceCovered
public double getVarianceCovered()
          Gets the proportion of total variance to account for when retaining principal components
Returns:
the proportion of variance to account for
 o transformBackToOriginalTipText
public java.lang.String transformBackToOriginalTipText()
          Returns the tip text for this property
Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui
 o setTransformBackToOriginal
public void setTransformBackToOriginal(boolean b)
          Sets whether the data should be transformed back to the original space
Parameters:
b - true if the data should be transformed back to the original space
 o getTransformBackToOriginal
public boolean getTransformBackToOriginal()
          Gets whether the data is to be transformed back to the original space.
Returns:
true if the data is to be transformed back to the original space
 o getOptions
public java.lang.String[] getOptions()
          Gets the current settings of PrincipalComponents
Returns:
an array of strings suitable for passing to setOptions()
 o buildEvaluator
public void buildEvaluator(Instances data) throws java.lang.Exception
          Initializes principal components and performs the analysis
Parameters:
data - the instances to analyse/transform
Throws:
java.lang.Exception - if analysis fails
Overrides:
buildEvaluator in class ASEvaluation
 o transformedHeader
public Instances transformedHeader() throws java.lang.Exception
          Returns just the header for the transformed data (ie. an empty set of instances. This is so that AttributeSelection can determine the structure of the transformed data without actually having to get all the transformed data through getTransformedData().
Returns:
the header of the transformed data.
Throws:
java.lang.Exception - if the header of the transformed data can't be determined.
 o transformedData
public Instances transformedData() throws java.lang.Exception
          Gets the transformed training data.
Returns:
the transformed training data
Throws:
java.lang.Exception - if transformed data can't be returned
 o evaluateAttribute
public double evaluateAttribute(int att) throws java.lang.Exception
          Evaluates the merit of a transformed attribute. This is defined to be 1 minus the cumulative variance explained. Merit can't be meaningfully evaluated if the data is to be transformed back to the original space.
Parameters:
att - the attribute to be evaluated
Returns:
the merit of a transformed attribute
Throws:
java.lang.Exception - if attribute can't be evaluated
Overrides:
evaluateAttribute in class AttributeEvaluator
 o toString
public java.lang.String toString()
          Returns a description of this attribute transformer
Returns:
a String describing this attribute transformer
Overrides:
toString in class java.lang.Object
 o convertInstance
public Instance convertInstance(Instance instance) throws java.lang.Exception
          Transform an instance in original (unormalized) format. Convert back to the original space if requested.
Parameters:
instance - an instance in the original (unormalized) format
Returns:
a transformed instance
Throws:
java.lang.Exception - if instance cant be transformed
 o main
public static void main(java.lang.String argv[])
          Main method for testing this class
Parameters:
argv - should contain the command line arguments to the evaluator/transformer (see AttributeSelection)

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