Class MultiPLS
- java.lang.Object
-
- weka.filters.Filter
-
- weka.filters.SimpleFilter
-
- weka.filters.SimpleBatchFilter
-
- weka.filters.supervised.attribute.MultiPLS
-
- All Implemented Interfaces:
Serializable
,weka.core.CapabilitiesHandler
,weka.core.CapabilitiesIgnorer
,weka.core.CommandlineRunnable
,GenericPLSMatrixAccess
,weka.core.OptionHandler
,weka.core.RevisionHandler
,weka.filters.SupervisedFilter
public class MultiPLS extends weka.filters.SimpleBatchFilter implements weka.filters.SupervisedFilter, GenericPLSMatrixAccess
For each Y that gets identified by the regular expression for Y attributes, the specified PLS (partial least squares) algorithm gets applied to the X attributes identified by the corresponding regular expression.
Valid options are:-x-regexp <value> The regular expression to identify the X attributes for PLS. (default: amplitude-.*)
-y-regexp <value> The regular expression to identify the Y attributes for PLS. (default: A_.*)
-algorithm <value> The PLS algorithm to apply. (default: adams.data.instancesanalysis.pls.PLS1)
-drop-non-class-ys <value> If enabled, Y attributes that aren't the class attribute are removed from the output. (default: off)
-output-debug-info If set, filter is run in debug mode and may output additional info to the console
-do-not-check-capabilities If set, filter capabilities are not checked before filter is built (use with caution).
- Version:
- $Revision$
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractPLS
m_Algorithm
the PLS algorithm.protected boolean
m_DropNonClassYs
whether to keep Ys that are not the class or not.protected String[]
m_MatrixNames
the matrix names.protected gnu.trove.list.TIntList
m_OtherIndices
the indices of the other attributes.protected Map<String,AbstractPLS>
m_PLS
the PLS algorithms corresponding to the Y attributes.protected gnu.trove.list.TIntList
m_XIndices
the indices of the X attributes.protected adams.core.base.BaseRegExp
m_XRegExp
the regular expression for the X columns.protected gnu.trove.list.TIntList
m_YIndices
the indices of the Y attributes.protected adams.core.base.BaseRegExp
m_YRegExp
the regular expression for the Y columns.
-
Constructor Summary
Constructors Constructor Description MultiPLS()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
algorithmTipText()
Returns the tip text for this propertyprotected weka.core.Instances
determineOutputFormat(weka.core.Instances inputFormat)
Determines the output format based on the input format and returns this.String
dropNonClassYsTipText()
Returns the tip text for this propertyprotected String
extractPLSKey(String matrixName)
Extracts key in the PLS map from the combined matrix name.AbstractPLS
getAlgorithm()
Returns the PLS algorithm to use.protected AbstractPLS
getDefaultAlgorithm()
Returns the default algorithm.protected adams.core.base.BaseRegExp
getDefaultXRegExp()
Returns the default X regexp.protected adams.core.base.BaseRegExp
getDefaultYRegExp()
Returns the default Y regexp.boolean
getDropNonClassYs()
Returns whether to remove Y attributes from the output that are not the class attribute.weka.core.matrix.Matrix
getLoadings()
Returns the loadings, if available.weka.core.matrix.Matrix
getMatrix(String name)
Returns the matrix with the specified name.String[]
getMatrixNames()
Returns the all the available matrices.String[]
getOptions()
returns the options of the current setupString
getRevision()
Returns the revision string.adams.core.base.BaseRegExp
getXRegExp()
Returns the regular expression to identify the X attributes.adams.core.base.BaseRegExp
getYRegExp()
Returns the regular expression to identify the Y attributes.String
globalInfo()
Returns a string describing this classifier.boolean
hasLoadings()
Whether the algorithm supports return of loadings.Enumeration<weka.core.Option>
listOptions()
Gets an enumeration describing the available options.static void
main(String[] args)
runs the filter with the given arguments.protected weka.core.Instances
process(weka.core.Instances instances)
Processes the given data (may change the provided dataset) and returns the modified version.void
setAlgorithm(AbstractPLS value)
Sets the PLS algorithm to use.void
setDropNonClassYs(boolean value)
Sets whether to remove Y attributes from the output that are not the class attribute.void
setOptions(String[] options)
Parses the options for this object.void
setXRegExp(adams.core.base.BaseRegExp value)
Sets the regular expression to identify the X attributes.void
setYRegExp(adams.core.base.BaseRegExp value)
Sets the regular expression to identify the Y attributes.String
XRegExpTipText()
Returns the tip text for this propertyString
YRegExpTipText()
Returns the tip text for this property-
Methods inherited from class weka.filters.SimpleBatchFilter
allowAccessToFullInputFormat, batchFinished, hasImmediateOutputFormat, input
-
Methods inherited from class weka.filters.Filter
batchFilterFile, bufferInput, copyValues, copyValues, debugTipText, doNotCheckCapabilitiesTipText, filterFile, flushInput, getCapabilities, getCapabilities, getDebug, getDoNotCheckCapabilities, getInputFormat, getOutputFormat, initInputLocators, initOutputLocators, inputFormatPeek, isFirstBatchDone, isNewBatch, isOutputFormatDefined, makeCopies, makeCopy, mayRemoveInstanceAfterFirstBatchDone, numPendingOutput, output, outputFormatPeek, outputPeek, postExecution, preExecution, push, push, resetQueue, run, runFilter, setDebug, setDoNotCheckCapabilities, setOutputFormat, testInputFormat, toString, useFilter, wekaStaticWrapper
-
-
-
-
Field Detail
-
m_XRegExp
protected adams.core.base.BaseRegExp m_XRegExp
the regular expression for the X columns.
-
m_YRegExp
protected adams.core.base.BaseRegExp m_YRegExp
the regular expression for the Y columns.
-
m_Algorithm
protected AbstractPLS m_Algorithm
the PLS algorithm.
-
m_DropNonClassYs
protected boolean m_DropNonClassYs
whether to keep Ys that are not the class or not.
-
m_XIndices
protected gnu.trove.list.TIntList m_XIndices
the indices of the X attributes.
-
m_YIndices
protected gnu.trove.list.TIntList m_YIndices
the indices of the Y attributes.
-
m_OtherIndices
protected gnu.trove.list.TIntList m_OtherIndices
the indices of the other attributes.
-
m_PLS
protected Map<String,AbstractPLS> m_PLS
the PLS algorithms corresponding to the Y attributes.
-
m_MatrixNames
protected String[] m_MatrixNames
the matrix names.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing this classifier.- Specified by:
globalInfo
in classweka.filters.SimpleFilter
- Returns:
- a description of the classifier suitable for displaying in the explorer/experimenter gui
-
listOptions
public Enumeration<weka.core.Option> listOptions()
Gets an enumeration describing the available options.- Specified by:
listOptions
in interfaceweka.core.OptionHandler
- Overrides:
listOptions
in classweka.filters.Filter
- Returns:
- an enumeration of all the available options.
-
getOptions
public String[] getOptions()
returns the options of the current setup- Specified by:
getOptions
in interfaceweka.core.OptionHandler
- Overrides:
getOptions
in classweka.filters.Filter
- Returns:
- the current options
-
setOptions
public void setOptions(String[] options) throws Exception
Parses the options for this object.- Specified by:
setOptions
in interfaceweka.core.OptionHandler
- Overrides:
setOptions
in classweka.filters.Filter
- Parameters:
options
- the options to use- Throws:
Exception
- if the option setting fails
-
getDefaultXRegExp
protected adams.core.base.BaseRegExp getDefaultXRegExp()
Returns the default X regexp.- Returns:
- the default
-
setXRegExp
public void setXRegExp(adams.core.base.BaseRegExp value)
Sets the regular expression to identify the X attributes.- Parameters:
value
- the expression
-
getXRegExp
public adams.core.base.BaseRegExp getXRegExp()
Returns the regular expression to identify the X attributes.- Returns:
- the expression
-
XRegExpTipText
public String XRegExpTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getDefaultYRegExp
protected adams.core.base.BaseRegExp getDefaultYRegExp()
Returns the default Y regexp.- Returns:
- the default
-
setYRegExp
public void setYRegExp(adams.core.base.BaseRegExp value)
Sets the regular expression to identify the Y attributes.- Parameters:
value
- the expression
-
getYRegExp
public adams.core.base.BaseRegExp getYRegExp()
Returns the regular expression to identify the Y attributes.- Returns:
- the expression
-
YRegExpTipText
public String YRegExpTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getDefaultAlgorithm
protected AbstractPLS getDefaultAlgorithm()
Returns the default algorithm.- Returns:
- the default
-
setAlgorithm
public void setAlgorithm(AbstractPLS value)
Sets the PLS algorithm to use.- Parameters:
value
- the algorithm
-
getAlgorithm
public AbstractPLS getAlgorithm()
Returns the PLS algorithm to use.- Returns:
- the algorithm
-
algorithmTipText
public String algorithmTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setDropNonClassYs
public void setDropNonClassYs(boolean value)
Sets whether to remove Y attributes from the output that are not the class attribute.- Parameters:
value
- true if to drop
-
getDropNonClassYs
public boolean getDropNonClassYs()
Returns whether to remove Y attributes from the output that are not the class attribute.- Returns:
- true if to to drop
-
dropNonClassYsTipText
public String dropNonClassYsTipText()
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
determineOutputFormat
protected weka.core.Instances determineOutputFormat(weka.core.Instances inputFormat) throws Exception
Determines the output format based on the input format and returns this. In case the output format cannot be returned immediately, i.e., immediateOutputFormat() returns false, then this method will be called from batchFinished().- Specified by:
determineOutputFormat
in classweka.filters.SimpleFilter
- Parameters:
inputFormat
- the input format to base the output format on- Returns:
- the output format
- Throws:
Exception
- in case the determination goes wrong- See Also:
SimpleBatchFilter.hasImmediateOutputFormat()
,SimpleBatchFilter.batchFinished()
-
process
protected weka.core.Instances process(weka.core.Instances instances) throws Exception
Processes the given data (may change the provided dataset) and returns the modified version. This method is called in batchFinished().- Specified by:
process
in classweka.filters.SimpleFilter
- Parameters:
instances
- the data to process- Returns:
- the modified data
- Throws:
Exception
- in case the processing goes wrong- See Also:
SimpleBatchFilter.batchFinished()
-
getMatrixNames
public String[] getMatrixNames()
Returns the all the available matrices.- Specified by:
getMatrixNames
in interfaceGenericPLSMatrixAccess
- Returns:
- the names of the matrices
-
extractPLSKey
protected String extractPLSKey(String matrixName)
Extracts key in the PLS map from the combined matrix name.- Parameters:
matrixName
- the matrix name to process- Returns:
- the key, input if failed to extract
-
getMatrix
public weka.core.matrix.Matrix getMatrix(String name)
Returns the matrix with the specified name.- Specified by:
getMatrix
in interfaceGenericPLSMatrixAccess
- Parameters:
name
- the name of the matrix- Returns:
- the matrix, null if not available
-
hasLoadings
public boolean hasLoadings()
Whether the algorithm supports return of loadings.- Specified by:
hasLoadings
in interfaceGenericPLSMatrixAccess
- Returns:
- always false
- See Also:
getLoadings()
-
getLoadings
public weka.core.matrix.Matrix getLoadings()
Returns the loadings, if available.- Specified by:
getLoadings
in interfaceGenericPLSMatrixAccess
- Returns:
- always null
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevision
in interfaceweka.core.RevisionHandler
- Overrides:
getRevision
in classweka.filters.Filter
- Returns:
- the revision
-
main
public static void main(String[] args)
runs the filter with the given arguments.- Parameters:
args
- the commandline arguments
-
-