Class CrossValidationExperiment
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.tools.wekamultiexperimenter.experiment.AbstractExperiment
-
- adams.gui.tools.wekamultiexperimenter.experiment.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CrossValidationExperiment.CrossValidationExperimentJob
Performs cross-validation on the classifier/data combination.-
Nested classes/interfaces inherited from class adams.gui.tools.wekamultiexperimenter.experiment.AbstractExperiment
AbstractExperiment.AbstractExperimentJob<T extends AbstractExperiment>
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_Folds
the number of folds.protected CrossValidationFoldGenerator
m_Generator
the fold generator.-
Fields inherited from class adams.gui.tools.wekamultiexperimenter.experiment.AbstractExperiment
m_ActualJobRunner, m_ClassAttribute, m_Classifiers, m_ClassLabelIndex, m_CommandLineHandler, m_Datasets, m_Generated, m_JobCounter, m_JobRunner, m_JobTotal, m_Notes, m_PrefixDatasetsWithIndex, m_ResetResults, m_Results, m_ResultsHandler, m_Running, m_Runs, m_StatusMessageHandler, m_Stopped, m_UseFilename
-
-
Constructor Summary
Constructors Constructor Description CrossValidationExperiment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defineOptions()
Adds options to the internal list of options.protected CrossValidationExperiment.CrossValidationExperimentJob
evaluate(int currentRun, weka.classifiers.Classifier cls, weka.core.Instances data)
Evaluates the classifier on the dataset.String
foldsTipText()
Returns the tip text for this property.String
generatorTipText()
Returns the tip text for this property.int
getFolds()
Returns the number of folds.CrossValidationFoldGenerator
getGenerator()
Returns the scheme for generating the folds.String
globalInfo()
Returns a string describing the object.protected boolean
isComplete(int[] rows)
Checks whether the number of rows located in the current results are complete.void
setFolds(int value)
Sets the number of folds.void
setGenerator(CrossValidationFoldGenerator value)
Sets the scheme for generating the folds.-
Methods inherited from class adams.gui.tools.wekamultiexperimenter.experiment.AbstractExperiment
addClassifier, addDataset, appendResults, classAttributeTipText, classifiersTipText, classLabelIndexTipText, clearProgress, configureRowFinder, datasetsTipText, doExecute, execute, getClassAttribute, getClassifiers, getClassLabelIndex, getDatasets, getJobRunner, getNotes, getPrefixDatasetsWithIndex, getResetResults, getResultsHandler, getRuns, getStatusMessageHandler, getUseFilename, incProgress, initExecute, initProgress, initResults, isRequired, isStopped, jobRunnerTipText, loadDataset, locateRows, log, log, notesTipText, postExecute, preExecute, prefixDatasetsWithIndexTipText, removeIncomplete, resetResultsTipText, resultsHandlerTipText, runsTipText, setClassAttribute, setClassifiers, setClassLabelIndex, setDatasets, setJobRunner, setNotes, setPrefixDatasetsWithIndex, setResetResults, setResultsHandler, setRuns, setStatusMessageHandler, setUseFilename, shortenCommandLine, showProgress, sortResults, stopExecution, toInstances, toSpreadSheet, useFilenameTipText
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
-
-
-
Field Detail
-
m_Folds
protected int m_Folds
the number of folds.
-
m_Generator
protected CrossValidationFoldGenerator m_Generator
the fold generator.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.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 interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classAbstractExperiment
-
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
-
getGenerator
public CrossValidationFoldGenerator getGenerator()
Returns the scheme for generating the folds.- Returns:
- 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 classAbstractExperiment
- 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 classAbstractExperiment
- Parameters:
currentRun
- the current runcls
- the classifier to evaluatedata
- the dataset to evaluate on- Returns:
- null if successful, otherwise error message
-
-