Class InstancesGroupedRandomSplitGenerator

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.QuickInfoSupporter, adams.core.Randomizable, adams.core.SizeOfHandler, adams.flow.core.FlowContextHandler, adams.flow.transformer.indexedsplitsrunsgenerator.IndexedSplitsRunsGenerator, InstancesIndexedSplitsRunsGenerator, Serializable

    public class InstancesGroupedRandomSplitGenerator
    extends AbstractInstancesIndexedSplitsRunsGenerator
    implements adams.core.Randomizable
    Random split generator that works on Instances objects (groups instances).
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Percentage

        protected double m_Percentage
        the percentage.
      • m_Seed

        protected long m_Seed
        the seed value.
      • m_PreserveOrder

        protected boolean m_PreserveOrder
        whether to preserve the order.
      • m_RegExp

        protected adams.core.base.BaseRegExp m_RegExp
        the regular expression for the nominal/string attribute.
      • m_Group

        protected String m_Group
        the group expression.
    • Constructor Detail

      • InstancesGroupedRandomSplitGenerator

        public InstancesGroupedRandomSplitGenerator()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        Returns:
        a description suitable for displaying in the gui
      • setPercentage

        public void setPercentage​(double value)
        Sets the split percentage.
        Parameters:
        value - the percentage (0-1)
      • getPercentage

        public double getPercentage()
        Returns the split percentage.
        Returns:
        the percentage (0-1)
      • percentageTipText

        public String percentageTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setSeed

        public void setSeed​(long value)
        Sets the seed value.
        Specified by:
        setSeed in interface adams.core.Randomizable
        Parameters:
        value - the seed
      • getSeed

        public long getSeed()
        Returns the seed value.
        Specified by:
        getSeed in interface adams.core.Randomizable
        Returns:
        the seed
      • seedTipText

        public String seedTipText()
        Returns the tip text for this property.
        Specified by:
        seedTipText in interface adams.core.Randomizable
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setPreserveOrder

        public void setPreserveOrder​(boolean value)
        Sets whether to preserve the order.
        Parameters:
        value - true if to preserve order
      • getPreserveOrder

        public boolean getPreserveOrder()
        Returns whether to preserve the order.
        Returns:
        true if to preserve order
      • preserveOrderTipText

        public String preserveOrderTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setIndex

        public void setIndex​(WekaAttributeIndex value)
        Sets the attribute index to use for grouping.
        Parameters:
        value - the index
      • getIndex

        public WekaAttributeIndex getIndex()
        Returns the attribute index to use for grouping.
        Returns:
        the index
      • indexTipText

        public String indexTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setRegExp

        public void setRegExp​(adams.core.base.BaseRegExp value)
        Sets the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').
        Parameters:
        value - the expression
      • getRegExp

        public adams.core.base.BaseRegExp getRegExp()
        Returns the regular expression for identifying the group (eg '^(.*)-([0-9]+)-(.*)$').
        Returns:
        the expression
      • regExpTipText

        public String regExpTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setGroup

        public void setGroup​(String value)
        Sets the replacement string to use as group (eg '$2').
        Parameters:
        value - the group
      • getGroup

        public String getGroup()
        Returns the replacement string to use as group (eg '$2').
        Returns:
        the group
      • groupTipText

        public String groupTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getQuickInfo

        public String getQuickInfo()
        Returns a quick info about the object, which can be displayed in the GUI.
        Specified by:
        getQuickInfo in interface adams.core.QuickInfoSupporter
        Overrides:
        getQuickInfo in class AbstractInstancesIndexedSplitsRunsGenerator
        Returns:
        null if no info available, otherwise short string
      • doGenerate

        protected adams.data.indexedsplits.IndexedSplitsRuns doGenerate​(Object data,
                                                                        adams.core.MessageCollection errors)
        Generates the indexed splits.
        Specified by:
        doGenerate in class adams.flow.transformer.indexedsplitsrunsgenerator.AbstractIndexedSplitsRunsGenerator
        Parameters:
        data - the data to use for generating the splits
        errors - for storing any errors occurring during processing
        Returns:
        the splits or null in case of error