Class GroupedRandomSplitGenerator

    • Field Detail

      • m_Percentage

        protected double m_Percentage
        the percentage.
      • m_PreserveOrder

        protected boolean m_PreserveOrder
        whether to preserve the order.
      • m_Generated

        protected boolean m_Generated
        whether the split was generated.
      • 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.
      • m_Generator

        protected adams.data.splitgenerator.generic.randomsplit.RandomSplitGenerator m_Generator
        the underlying scheme for generating the split.
    • Constructor Detail

      • GroupedRandomSplitGenerator

        public GroupedRandomSplitGenerator()
        Initializes the generator.
      • GroupedRandomSplitGenerator

        public GroupedRandomSplitGenerator​(weka.core.Instances data,
                                           long seed,
                                           double percentage,
                                           boolean preserveOrder,
                                           WekaAttributeIndex index,
                                           adams.core.base.BaseRegExp regExp,
                                           String group)
        Initializes the generator. Does not preserve the order.
        Parameters:
        data - the dataset to split
        seed - the seed value to use for randomization
        percentage - the percentage of the training set (0-1)
        preserveOrder - whether to preserve the order
        index - the attribute index
        regExp - the regular expression to apply to the attribute values
        group - the regexp group to use as group
    • 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
      • defineOptions

        public void defineOptions()
        Adds options to the internal list of options.
        Specified by:
        defineOptions in interface adams.core.option.OptionHandler
        Overrides:
        defineOptions in class AbstractSplitGenerator
      • setPercentage

        public void setPercentage​(double value)
        Sets the split percentage.
        Specified by:
        setPercentage in interface adams.data.splitgenerator.RandomSplitGenerator<weka.core.Instances,​WekaTrainTestSetContainer>
        Specified by:
        setPercentage in interface RandomSplitGenerator
        Parameters:
        value - the percentage (0-1)
      • getPercentage

        public double getPercentage()
        Returns the split percentage.
        Specified by:
        getPercentage in interface adams.data.splitgenerator.RandomSplitGenerator<weka.core.Instances,​WekaTrainTestSetContainer>
        Specified by:
        getPercentage in interface RandomSplitGenerator
        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.
      • setPreserveOrder

        public void setPreserveOrder​(boolean value)
        Sets whether to preserve the order.
        Specified by:
        setPreserveOrder in interface adams.data.splitgenerator.RandomSplitGenerator<weka.core.Instances,​WekaTrainTestSetContainer>
        Specified by:
        setPreserveOrder in interface RandomSplitGenerator
        Parameters:
        value - true if to preserve order
      • getPreserveOrder

        public boolean getPreserveOrder()
        Returns whether to preserve the order.
        Specified by:
        getPreserveOrder in interface adams.data.splitgenerator.RandomSplitGenerator<weka.core.Instances,​WekaTrainTestSetContainer>
        Specified by:
        getPreserveOrder in interface RandomSplitGenerator
        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.
      • canRandomize

        protected boolean canRandomize()
        Returns whether randomization is enabled.
        Specified by:
        canRandomize in class AbstractSplitGenerator
        Returns:
        true if to randomize
      • checkNext

        protected boolean checkNext()
        Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)
        Specified by:
        checkNext in class AbstractSplitGenerator
        Returns:
        true if the iterator has more elements.