Class CrossValidationExperiment

  • All Implemented Interfaces:
    adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.SizeOfHandler, adams.core.Stoppable, adams.core.StoppableWithFeedback, adams.data.spreadsheet.SpreadSheetSupporter, ExperimentWithCustomizableRelationNames, ResettableExperiment, Serializable

    public class CrossValidationExperiment
    extends AbstractExperiment
    Performs cross-validation. If only one dataset and one classifier specified, cross-validation is multi-threaded (in case experiment is multi-threaded).
    Author:
    FracPete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Constructor Detail

      • CrossValidationExperiment

        public CrossValidationExperiment()
    • 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 AbstractExperiment
      • setFolds

        public void setFolds​(int value)
        Sets the number of folds.
        Parameters:
        value - the folds
      • getFolds

        public int getFolds()
        Returns the number of folds.
        Returns:
        the folds
      • foldsTipText

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

        public void setGenerator​(CrossValidationFoldGenerator value)
        Sets the scheme for generating the folds.
        Parameters:
        value - the generator
      • generatorTipText

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

        protected boolean isComplete​(int[] rows)
        Checks whether the number of rows located in the current results are complete.
        Overrides:
        isComplete in class AbstractExperiment
        Parameters:
        rows - the located results
        Returns:
        true if complete
      • evaluate

        protected CrossValidationExperiment.CrossValidationExperimentJob evaluate​(int currentRun,
                                                                                  weka.classifiers.Classifier cls,
                                                                                  weka.core.Instances data)
        Evaluates the classifier on the dataset.
        Specified by:
        evaluate in class AbstractExperiment
        Parameters:
        currentRun - the current run
        cls - the classifier to evaluate
        data - the dataset to evaluate on
        Returns:
        null if successful, otherwise error message