Class LeaveOneOutByValueGenerator

    • Field Detail

      • PLACEHOLDER_ORIGINAL

        public static final String PLACEHOLDER_ORIGINAL
        the placeholder for the (original) relation name.
        See Also:
        Constant Field Values
      • PLACEHOLDER_TYPE

        public static final String PLACEHOLDER_TYPE
        the placeholder for "train" or "test" type.
        See Also:
        Constant Field Values
      • PLACEHOLDER_CURRENTVALUE

        public static final String PLACEHOLDER_CURRENTVALUE
        the placeholder for the current value in the test set.
        See Also:
        Constant Field Values
      • m_RelationName

        protected String m_RelationName
        the template for the relation name.
      • m_Randomize

        protected boolean m_Randomize
        whether to randomize the data.
      • m_UniqueValues

        protected transient List<String> m_UniqueValues
        the unique values.
      • m_CurrentPair

        protected transient int m_CurrentPair
        the current train/test pair to generate.
    • Constructor Detail

      • LeaveOneOutByValueGenerator

        public LeaveOneOutByValueGenerator()
        Initializes the generator.
      • LeaveOneOutByValueGenerator

        public LeaveOneOutByValueGenerator​(weka.core.Instances data,
                                           long seed,
                                           boolean randomize,
                                           WekaAttributeIndex index)
        Initializes the generator.
        Parameters:
        data - the full dataset
        seed - the seed for randomization
        randomize - whether to randomize the data
        index - the attribute index
    • Method Detail

      • 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.
      • setRandomize

        public void setRandomize​(boolean value)
        Sets whether to randomize the data.
        Parameters:
        value - true if to randomize the data
      • getRandomize

        public boolean getRandomize()
        Returns whether to randomize the data.
        Returns:
        true if to randomize the data
      • randomizeTipText

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

        public void setRelationName​(String value)
        Sets the template for the relation name.
        Parameters:
        value - the template
      • getRelationName

        public String getRelationName()
        Returns the relation name template.
        Returns:
        the template
      • relationNameTipText

        public static String relationNameTipText()
        Returns the tiptext for the relation name template.
        Returns:
        the tiptext
      • 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.
      • createRelationName

        protected String createRelationName​(String relation,
                                            String template,
                                            String current,
                                            boolean train)
        Generates a relation name for the current value.
        Parameters:
        relation - the original relation name
        template - the template for the relation name
        current - the current value
        train - whether train or test set
        Returns:
        the relation name