Package adams.data.weka.datasetsplitter
Class RowSplitter
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.weka.datasetsplitter.AbstractSplitter
-
- adams.data.weka.datasetsplitter.RowSplitter
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Serializable
public class RowSplitter extends AbstractSplitter
Splits a dataset in two based on the rows selected by the row-finder. Instances found by the row-finder go in the first dataset, and the rest go in the second.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-row-finder <adams.data.weka.rowfinder.RowFinder> (property: rowFinder) The row-finder to use to select rows for the first dataset. default: adams.data.weka.rowfinder.NullFinder
- Author:
- Corey Sterling (csterlin at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected RowFinder
m_RowFinder
The selector for splitting rows between the two datasets.static int
NO_NEXT_SELECTED_INDEX
Sentinel for when there's no more selected rows.-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description RowSplitter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
check(weka.core.Instances dataset)
Checks that the input data is correctly formatted for our purposes.void
defineOptions()
Adds options to the internal list of options.protected int
getNextSelectedIndex(int[] selectedIndices, int index)
Gets the next index selected by the row-finder.RowFinder
getRowFinder()
Gets the row-finder to use to select rows for the first dataset.String
globalInfo()
Returns a string describing the object.String
rowFinderTipText()
Gets the tip-text for the rowFinder option.void
setRowFinder(RowFinder value)
Sets the row-finder to use to select rows for the first dataset.weka.core.Instances[]
split(weka.core.Instances dataset)
Splits the given dataset into a number of other datasets.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
NO_NEXT_SELECTED_INDEX
public static final int NO_NEXT_SELECTED_INDEX
Sentinel for when there's no more selected rows.- See Also:
- Constant Field Values
-
m_RowFinder
protected RowFinder m_RowFinder
The selector for splitting rows between the two datasets.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options. Derived classes must override this method to add additional options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
getRowFinder
public RowFinder getRowFinder()
Gets the row-finder to use to select rows for the first dataset.- Returns:
- The row-finder.
-
setRowFinder
public void setRowFinder(RowFinder value)
Sets the row-finder to use to select rows for the first dataset.- Parameters:
value
- The row-finder.
-
rowFinderTipText
public String rowFinderTipText()
Gets the tip-text for the rowFinder option.- Returns:
- The tip-text as a string.
-
check
public String check(weka.core.Instances dataset)
Checks that the input data is correctly formatted for our purposes.- Parameters:
dataset
- The dataset to check.- Returns:
- Null if all okay, or an error message if not.
-
getNextSelectedIndex
protected int getNextSelectedIndex(int[] selectedIndices, int index)
Gets the next index selected by the row-finder.- Parameters:
selectedIndices
- The array of selected indices.index
- The index to get from the array.- Returns:
- The next selected row-index, or NO_NEXT_SELECTED_INDEX if there isn't one.
-
split
public weka.core.Instances[] split(weka.core.Instances dataset)
Splits the given dataset into a number of other datasets. Should be implemented by sub-classes to perform actual splitting.- Specified by:
split
in classAbstractSplitter
- Parameters:
dataset
- The dataset to split.- Returns:
- An array of datasets resulting from the split.
-
-