@KFIgnore @GPCIgnore public class PreConstructedPCA extends weka.filters.Filter implements weka.filters.StreamableFilter, java.io.Serializable, PreconstructedFilter, weka.core.OptionHandler, weka.core.CommandlineRunnable
-header <path to ARFF header> Path to the ARFF header used when the matrix was constructed. Must contain summary attributes.
-matrix <path to matrix file> Path to the correlation/covariance matrix.
-covariance Matrix is a covariance matrix (rather than correlation).
-keep-class Keep the class (if set). Set this if the class was retained when computing the matrix (i.e. there is a column in the matrix corresponding to the class).
-R <num> Retain enough PC attributes to account for this proportion of variance in the original data. (default: 0.95)
-A <num> Maximum number of attributes to include in transformed attribute names. (-1 = include all, default: 5)
-M <num> Maximum number of PC attributes to retain. (-1 = include all, default: -1)
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_VARIANCE_COVERED
Default proportion of variance covered by PCs
|
static int |
MAX_ATTRIB_NAMES
Default number of original attribute names to include in the transformed
attribute names
|
Constructor and Description |
---|
PreConstructedPCA()
Default constructor.
|
PreConstructedPCA(weka.core.Instances headerWithSummaryAtts,
weka.core.matrix.Matrix matrix,
boolean keepClassIfSet,
boolean isCovariance)
Construct a new PreConstructedPCA.
|
PreConstructedPCA(weka.core.Instances header,
weka.core.matrix.Matrix matrix,
java.util.List<NumericStats> stats,
boolean keepClassIfSet,
boolean isCovariance)
Construct a new PreConstructedPCA.
|
Modifier and Type | Method and Description |
---|---|
weka.core.Capabilities |
getCapabilities()
Returns the capabilities of this evaluator.
|
boolean |
getKeepClassIfSet()
Get whether the class should be kept
|
boolean |
getMatrixIsCovariance()
Get whether the matrix is a covariance rather than correlation one
|
int |
getMaximumAttributeNames()
Gets maximum number of attributes to include in transformed attribute
names.
|
int |
getMaximumAttributes()
Gets maximum number of PC attributes to retain.
|
java.lang.String[] |
getOptions()
Gets the current settings of the filter.
|
java.lang.String |
getPathToHeaderWihtSummaryAtts()
Get the path to the ARFF header (including summary attributes) used when
the matrix was constructed.
|
java.lang.String |
getPathToMatrix()
Get the path to the correlation/covariance matrix
|
double |
getVarianceCovered()
Gets the proportion of total variance to account for when retaining
principal components.
|
java.lang.String |
globalInfo()
Returns a string describing this filter.
|
boolean |
input(weka.core.Instance instance) |
boolean |
isConstructed()
Returns true if this Preconstructed instance is initialized and ready to be
used
|
java.lang.String |
keepClassIfSet()
Tip text for this property
|
java.util.Enumeration<weka.core.Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(java.lang.String[] args)
Main method for command line execution
|
java.lang.String |
matrixIsCovarianceTipText()
Tip text for this property
|
java.lang.String |
maximumAttributeNamesTipText()
Returns the tip text for this property.
|
java.lang.String |
maximumAttributesTipText()
Returns the tip text for this property.
|
java.lang.String |
pathToHeaderWithSummaryAttsTipText()
Tip text for this property
|
java.lang.String |
pathToMatrixTipText()
Tip text for this property
|
void |
resetPreconstructed()
Reset.
|
void |
run(java.lang.Object toRun,
java.lang.String[] options) |
boolean |
setInputFormat(weka.core.Instances instancesInfo)
Sets the format of the input instances.
|
void |
setKeepClassIfSet(boolean keep)
Set whether the class should be kept
|
void |
setMatrixIsCovariance(boolean c)
Set whether the matrix is a covariance rather than correlation one
|
void |
setMaximumAttributeNames(int value)
Sets maximum number of attributes to include in transformed attribute
names.
|
void |
setMaximumAttributes(int value)
Sets maximum number of PC attributes to retain.
|
void |
setOptions(java.lang.String[] options)
Parses a list of options for this object.
|
void |
setPathToHeaderWithSummaryAtts(java.lang.String path)
Set the path to the ARFF header (including summary attributes) used when
the matrix was constructed.
|
void |
setPathToMatrix(java.lang.String path)
Set the path to the correlation/covariance matrix
|
void |
setVarianceCovered(double value)
Sets the amount of variance to account for when retaining principal
components.
|
static void |
test(java.lang.String[] args)
Method for testing this class
|
java.lang.String |
toString() |
java.lang.String |
varianceCoveredTipText()
Returns the tip text for this property.
|
batchFilterFile, batchFinished, debugTipText, doNotCheckCapabilitiesTipText, filterFile, getCapabilities, getCopyOfInputFormat, getDebug, getDoNotCheckCapabilities, getOutputFormat, getRevision, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputPeek, postExecution, preExecution, runFilter, setDebug, setDoNotCheckCapabilities, useFilter, wekaStaticWrapper
public static final int MAX_ATTRIB_NAMES
public static final double DEFAULT_VARIANCE_COVERED
public PreConstructedPCA()
public PreConstructedPCA(weka.core.Instances headerWithSummaryAtts, weka.core.matrix.Matrix matrix, boolean keepClassIfSet, boolean isCovariance) throws java.lang.Exception
headerWithSummaryAtts
- header of the data used to construct the
matrix from. Must contain the meta summary attributes.matrix
- the correlation or covariance matrixkeepClassIfSet
- true if the class attribute was retained when
computing the matrix (i.e. there is a column in the matrix for the
class)isCovariance
- true if the matrix is a covariance matrix rather than
correlation matrixjava.lang.Exception
- if a problem occurspublic PreConstructedPCA(weka.core.Instances header, weka.core.matrix.Matrix matrix, java.util.List<NumericStats> stats, boolean keepClassIfSet, boolean isCovariance) throws java.lang.Exception
header
- header of the data used to construct the matrix from. Should
NOT contain any meta summary attributes.matrix
- the correlation or covariance matrixstats
- a list of NumericStats objects corresponding to the attributes
in the headerkeepClassIfSet
- true if the class attribute was retained when
computing the matrix (i.e. there is a column in the matrix for the
class)isCovariance
- true if the matrix is a covariance matrix rather than
correlation matrixjava.lang.Exception
- if a problem occurspublic weka.core.Capabilities getCapabilities()
getCapabilities
in interface weka.core.CapabilitiesHandler
getCapabilities
in class weka.filters.Filter
Capabilities
public java.lang.String globalInfo()
public java.util.Enumeration<weka.core.Option> listOptions()
listOptions
in interface weka.core.OptionHandler
listOptions
in class weka.filters.Filter
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-header <path to ARFF header> Path to the ARFF header used when the matrix was constructed. Must contain summary attributes.
-matrix <path to matrix file> Path to the correlation/covariance matrix.
-covariance Matrix is a covariance matrix (rather than correlation).
-keep-class Keep the class (if set). Set this if the class was retained when computing the matrix (i.e. there is a column in the matrix corresponding to the class).
-R <num> Retain enough PC attributes to account for this proportion of variance in the original data. (default: 0.95)
-A <num> Maximum number of attributes to include in transformed attribute names. (-1 = include all, default: 5)
-M <num> Maximum number of PC attributes to retain. (-1 = include all, default: -1)
setOptions
in interface weka.core.OptionHandler
setOptions
in class weka.filters.Filter
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface weka.core.OptionHandler
getOptions
in class weka.filters.Filter
public java.lang.String pathToMatrixTipText()
public void setPathToMatrix(java.lang.String path)
path
- path to the matrix to usepublic java.lang.String getPathToMatrix()
public java.lang.String pathToHeaderWithSummaryAttsTipText()
public void setPathToHeaderWithSummaryAtts(java.lang.String path)
path
- the path to the ARFF header.public java.lang.String getPathToHeaderWihtSummaryAtts()
public java.lang.String keepClassIfSet()
public void setKeepClassIfSet(boolean keep)
keep
- true if the class is to be keptpublic boolean getKeepClassIfSet()
public java.lang.String matrixIsCovarianceTipText()
public void setMatrixIsCovariance(boolean c)
c
- true if the matrix is a covariance matrixpublic boolean getMatrixIsCovariance()
public java.lang.String varianceCoveredTipText()
public void setVarianceCovered(double value)
value
- the proportion of total variance to account forpublic double getVarianceCovered()
public java.lang.String maximumAttributeNamesTipText()
public void setMaximumAttributeNames(int value)
value
- the maximum number of attributespublic int getMaximumAttributeNames()
public java.lang.String maximumAttributesTipText()
public void setMaximumAttributes(int value)
value
- the maximum number of attributespublic int getMaximumAttributes()
public boolean setInputFormat(weka.core.Instances instancesInfo) throws java.lang.Exception
setInputFormat
in class weka.filters.Filter
instancesInfo
- an Instances object containing the input instance
structure (any instances contained in the object are ignored -
only the structure is required).java.lang.Exception
- if the input format can't be set successfullypublic boolean input(weka.core.Instance instance) throws java.lang.Exception
input
in class weka.filters.Filter
java.lang.Exception
public java.lang.String toString()
toString
in class weka.filters.Filter
public static void test(java.lang.String[] args)
args
- arguments to the filterpublic static void main(java.lang.String[] args)
args
- options to the filterpublic void run(java.lang.Object toRun, java.lang.String[] options)
run
in interface weka.core.CommandlineRunnable
run
in class weka.filters.Filter
public boolean isConstructed()
Preconstructed
isConstructed
in interface Preconstructed
public void resetPreconstructed()
Preconstructed
resetPreconstructed
in interface Preconstructed