public class RandomProjection extends Filter implements UnsupervisedFilter, OptionHandler, TechnicalInformationHandler, Randomizable, WeightedInstancesHandler
@inproceedings{Fradkin003,
address = {New York, NY, USA},
author = {Dmitriy Fradkin and David Madigan},
booktitle = {KDD '03: Proceedings of the ninth ACM SIGKDD international conference on Knowledge discovery and data mining},
pages = {517-522},
publisher = {ACM Press},
title = {Experiments with random projections for machine learning},
year = {003}
}
Valid options are:
-N <number> The number of dimensions (attributes) the data should be reduced to (default 10; exclusive of the class attribute, if it is set).
-D [SPARSE1|SPARSE2|GAUSSIAN]
The distribution to use for calculating the random matrix.
Sparse1 is:
sqrt(3)*{-1 with prob(1/6), 0 with prob(2/3), +1 with prob(1/6)}
Sparse2 is:
{-1 with prob(1/2), +1 with prob(1/2)}
-P <percent> The percentage of dimensions (attributes) the data should be reduced to (exclusive of the class attribute, if it is set). The -N option is ignored if this option is present and is greater than zero.
-M Replace missing values using the ReplaceMissingValues filter instead of just skipping them.
-R <num> The random seed for the random number generator used for calculating the random matrix (default 42).
| Modifier and Type | Field and Description |
|---|---|
static int |
GAUSSIAN
distribution type: gaussian
|
static int |
SPARSE1
distribution type: sparse 1
|
static int |
SPARSE2
distribution type: sparse 2
|
static Tag[] |
TAGS_DSTRS_TYPE
The types of distributions that can be used for calculating the random
matrix
|
| Constructor and Description |
|---|
RandomProjection() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
batchFinished()
Signify that this batch of input to the filter is finished.
|
java.lang.String |
distributionTipText()
Returns the tip text for this property
|
Capabilities |
getCapabilities()
Returns the Capabilities of this filter.
|
SelectedTag |
getDistribution()
Returns the current distribution that'll be used for calculating the random
matrix
|
int |
getNumberOfAttributes()
Gets the current number of attributes (dimensionality) to which the data
will be reduced to.
|
java.lang.String[] |
getOptions()
Gets the current settings of the filter.
|
double |
getPercent()
Gets the percent the attributes (dimensions) of the data will be reduced to
|
boolean |
getReplaceMissingValues()
Gets the current setting for using ReplaceMissingValues filter
|
java.lang.String |
getRevision()
Returns the revision string.
|
int |
getSeed()
Gets the random seed of the random number generator
|
TechnicalInformation |
getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed
information about the technical background of this class, e.g., paper
reference or book this class is based on.
|
java.lang.String |
globalInfo()
Returns a string describing this filter
|
boolean |
input(Instance instance)
Input an instance for filtering.
|
java.util.Enumeration<Option> |
listOptions()
Returns an enumeration describing the available options.
|
static void |
main(java.lang.String[] argv)
Main method for testing this class.
|
java.lang.String |
numberOfAttributesTipText()
Returns the tip text for this property
|
java.lang.String |
percentTipText()
Returns the tip text for this property
|
java.lang.String |
replaceMissingValuesTipText()
Returns the tip text for this property
|
java.lang.String |
seedTipText()
Returns the tip text for this property
|
void |
setDistribution(SelectedTag newDstr)
Sets the distribution to use for calculating the random matrix
|
boolean |
setInputFormat(Instances instanceInfo)
Sets the format of the input instances.
|
void |
setNumberOfAttributes(int newAttNum)
Sets the number of attributes (dimensions) the data should be reduced to
|
void |
setOptions(java.lang.String[] options)
Parses a given list of options.
|
void |
setPercent(double newPercent)
Sets the percent the attributes (dimensions) of the data should be reduced
to
|
void |
setReplaceMissingValues(boolean t)
Sets either to use replace missing values filter or not
|
void |
setSeed(int seed)
Sets the random seed of the random number generator
|
batchFilterFile, debugTipText, doNotCheckCapabilitiesTipText, filterFile, getCapabilities, getCopyOfInputFormat, getDebug, getDoNotCheckCapabilities, getOutputFormat, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputPeek, postExecution, preExecution, run, runFilter, setDebug, setDoNotCheckCapabilities, toString, useFilter, wekaStaticWrapperequals, getClass, hashCode, notify, notifyAll, wait, wait, waitmakeCopypublic static final int SPARSE1
public static final int SPARSE2
public static final int GAUSSIAN
public static final Tag[] TAGS_DSTRS_TYPE
public java.util.Enumeration<Option> listOptions()
listOptions in interface OptionHandlerlistOptions in class Filterpublic void setOptions(java.lang.String[] options)
throws java.lang.Exception
-N <number> The number of dimensions (attributes) the data should be reduced to (default 10; exclusive of the class attribute, if it is set).
-D [SPARSE1|SPARSE2|GAUSSIAN]
The distribution to use for calculating the random matrix.
Sparse1 is:
sqrt(3)*{-1 with prob(1/6), 0 with prob(2/3), +1 with prob(1/6)}
Sparse2 is:
{-1 with prob(1/2), +1 with prob(1/2)}
-P <percent> The percentage of dimensions (attributes) the data should be reduced to (exclusive of the class attribute, if it is set). The -N option is ignored if this option is present and is greater than zero.
-M Replace missing values using the ReplaceMissingValues filter instead of just skipping them.
-R <num> The random seed for the random number generator used for calculating the random matrix (default 42).
setOptions in interface OptionHandlersetOptions in class Filteroptions - the list of options as an array of stringsjava.lang.Exception - if an option is not supportedpublic java.lang.String[] getOptions()
getOptions in interface OptionHandlergetOptions in class Filterpublic java.lang.String globalInfo()
public TechnicalInformation getTechnicalInformation()
getTechnicalInformation in interface TechnicalInformationHandlerpublic java.lang.String numberOfAttributesTipText()
public void setNumberOfAttributes(int newAttNum)
newAttNum - the goal for the dimensionspublic int getNumberOfAttributes()
public java.lang.String percentTipText()
public void setPercent(double newPercent)
newPercent - the percentage of attributespublic double getPercent()
public java.lang.String seedTipText()
public void setSeed(int seed)
setSeed in interface Randomizableseed - the random seed valuepublic int getSeed()
getSeed in interface Randomizablepublic java.lang.String distributionTipText()
public void setDistribution(SelectedTag newDstr)
newDstr - the distribution to usepublic SelectedTag getDistribution()
public java.lang.String replaceMissingValuesTipText()
public void setReplaceMissingValues(boolean t)
t - if true then the replace missing values is usedpublic boolean getReplaceMissingValues()
public Capabilities getCapabilities()
getCapabilities in interface CapabilitiesHandlergetCapabilities in class FilterCapabilitiespublic boolean setInputFormat(Instances instanceInfo) throws java.lang.Exception
setInputFormat in class FilterinstanceInfo - 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(Instance instance) throws java.lang.Exception
input in class Filterinstance - the input instancejava.lang.IllegalStateException - if no input format has been setjava.lang.NullPointerException - if the input format has not been defined.java.lang.Exception - if the input instance was not of the correct format or if
there was a problem with the filtering.public boolean batchFinished()
throws java.lang.Exception
batchFinished in class Filterjava.lang.NullPointerException - if no input structure has been defined,java.lang.Exception - if there was a problem finishing the batch.public java.lang.String getRevision()
getRevision in interface RevisionHandlergetRevision in class Filterpublic static void main(java.lang.String[] argv)
argv - should contain arguments to the filter: use -h for help