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 AbstractPLSm_Algorithmthe PLS algorithm.protected booleanm_DropNonClassYswhether to keep Ys that are not the class or not.protected String[]m_MatrixNamesthe matrix names.protected gnu.trove.list.TIntListm_OtherIndicesthe indices of the other attributes.protected Map<String,AbstractPLS>m_PLSthe PLS algorithms corresponding to the Y attributes.protected gnu.trove.list.TIntListm_XIndicesthe indices of the X attributes.protected adams.core.base.BaseRegExpm_XRegExpthe regular expression for the X columns.protected gnu.trove.list.TIntListm_YIndicesthe indices of the Y attributes.protected adams.core.base.BaseRegExpm_YRegExpthe 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 StringalgorithmTipText()Returns the tip text for this propertyprotected weka.core.InstancesdetermineOutputFormat(weka.core.Instances inputFormat)Determines the output format based on the input format and returns this.StringdropNonClassYsTipText()Returns the tip text for this propertyprotected StringextractPLSKey(String matrixName)Extracts key in the PLS map from the combined matrix name.AbstractPLSgetAlgorithm()Returns the PLS algorithm to use.protected AbstractPLSgetDefaultAlgorithm()Returns the default algorithm.protected adams.core.base.BaseRegExpgetDefaultXRegExp()Returns the default X regexp.protected adams.core.base.BaseRegExpgetDefaultYRegExp()Returns the default Y regexp.booleangetDropNonClassYs()Returns whether to remove Y attributes from the output that are not the class attribute.weka.core.matrix.MatrixgetLoadings()Returns the loadings, if available.weka.core.matrix.MatrixgetMatrix(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 setupStringgetRevision()Returns the revision string.adams.core.base.BaseRegExpgetXRegExp()Returns the regular expression to identify the X attributes.adams.core.base.BaseRegExpgetYRegExp()Returns the regular expression to identify the Y attributes.StringglobalInfo()Returns a string describing this classifier.booleanhasLoadings()Whether the algorithm supports return of loadings.Enumeration<weka.core.Option>listOptions()Gets an enumeration describing the available options.static voidmain(String[] args)runs the filter with the given arguments.protected weka.core.Instancesprocess(weka.core.Instances instances)Processes the given data (may change the provided dataset) and returns the modified version.voidsetAlgorithm(AbstractPLS value)Sets the PLS algorithm to use.voidsetDropNonClassYs(boolean value)Sets whether to remove Y attributes from the output that are not the class attribute.voidsetOptions(String[] options)Parses the options for this object.voidsetXRegExp(adams.core.base.BaseRegExp value)Sets the regular expression to identify the X attributes.voidsetYRegExp(adams.core.base.BaseRegExp value)Sets the regular expression to identify the Y attributes.StringXRegExpTipText()Returns the tip text for this propertyStringYRegExpTipText()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:
globalInfoin 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:
listOptionsin interfaceweka.core.OptionHandler- Overrides:
listOptionsin classweka.filters.Filter- Returns:
- an enumeration of all the available options.
-
getOptions
public String[] getOptions()
returns the options of the current setup- Specified by:
getOptionsin interfaceweka.core.OptionHandler- Overrides:
getOptionsin classweka.filters.Filter- Returns:
- the current options
-
setOptions
public void setOptions(String[] options) throws Exception
Parses the options for this object.- Specified by:
setOptionsin interfaceweka.core.OptionHandler- Overrides:
setOptionsin 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 ExceptionDetermines 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:
determineOutputFormatin 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 ExceptionProcesses the given data (may change the provided dataset) and returns the modified version. This method is called in batchFinished().- Specified by:
processin 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:
getMatrixNamesin 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:
getMatrixin 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:
hasLoadingsin interfaceGenericPLSMatrixAccess- Returns:
- always false
- See Also:
getLoadings()
-
getLoadings
public weka.core.matrix.Matrix getLoadings()
Returns the loadings, if available.- Specified by:
getLoadingsin interfaceGenericPLSMatrixAccess- Returns:
- always null
-
getRevision
public String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceweka.core.RevisionHandler- Overrides:
getRevisionin 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
-
-