Class InstancesCrossValidationFoldGenerator

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

    public class InstancesCrossValidationFoldGenerator
    extends AbstractInstancesIndexedSplitsRunsGenerator
    implements adams.core.OptionalRandomizable
    Split generator that generates folds for cross-validation for Instances objects.
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_NumFolds

        protected int m_NumFolds
        the number of folds.
      • m_Randomize

        protected boolean m_Randomize
        whether to randomize the data.
      • m_Seed

        protected long m_Seed
        the seed value.
      • m_Stratify

        protected boolean m_Stratify
        whether to stratify the data (in case of nominal class).
    • Constructor Detail

      • InstancesCrossValidationFoldGenerator

        public InstancesCrossValidationFoldGenerator()
    • 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
      • setNumFolds

        public void setNumFolds​(int value)
        Sets the number of folds to use.
        Parameters:
        value - the number of folds, less than 2 for LOO
      • getNumFolds

        public int getNumFolds()
        Returns the number of folds.
        Returns:
        the number of folds
      • numFoldsTipText

        public String numFoldsTipText()
        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.
        Specified by:
        setRandomize in interface adams.core.OptionalRandomizable
        Parameters:
        value - true if to randomize the data
      • getRandomize

        public boolean getRandomize()
        Returns whether to randomize the data.
        Specified by:
        getRandomize in interface adams.core.OptionalRandomizable
        Returns:
        true if to randomize the data
      • randomizeTipText

        public String randomizeTipText()
        Returns the tip text for this property.
        Specified by:
        randomizeTipText in interface adams.core.OptionalRandomizable
        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.
      • setStratify

        public void setStratify​(boolean value)
        Sets whether to stratify the data (nominal class).
        Parameters:
        value - whether to stratify the data (nominal class)
      • getStratify

        public boolean getStratify()
        Returns whether to stratify the data (in case of nominal class).
        Returns:
        true if to stratify
      • stratifyTipText

        public String stratifyTipText()
        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
      • check

        protected String check​(Object data)
        Checks whether the data can be processed.
        Overrides:
        check in class adams.flow.transformer.indexedsplitsrunsgenerator.AbstractIndexedSplitsRunsGenerator
        Parameters:
        data - the data to check
        Returns:
        null if checks passed, otherwise error message
      • 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