Class CrossValidation
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.gui.tools.wekainvestigator.evaluation.AbstractEvaluation<ClassifyTab,ResultItem>
-
- adams.gui.tools.wekainvestigator.tab.classifytab.evaluation.AbstractClassifierEvaluation
-
- adams.gui.tools.wekainvestigator.tab.classifytab.evaluation.CrossValidation
-
- All Implemented Interfaces:
adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingSupporter
,adams.core.SizeOfHandler
,adams.core.StatusMessageHandler
,adams.core.Stoppable
,adams.core.StoppableWithFeedback
,Serializable
public class CrossValidation extends AbstractClassifierEvaluation implements adams.core.StoppableWithFeedback
Performs cross-validation.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
KEY_ADDITIONAL
static String
KEY_DATASET
static String
KEY_DISCARDPREDICTIONS
static String
KEY_FINALMODEL
static String
KEY_FOLDS
static String
KEY_GENERATOR
static String
KEY_JOBRUNNER
static String
KEY_PERFOLDOUTPUT
static String
KEY_SEED
static String
KEY_USEVIEWS
protected adams.gui.core.BaseCheckBox
m_CheckBoxDiscardPredictions
whether to discard the predictions.protected adams.gui.core.BaseCheckBox
m_CheckBoxPerFoldOutput
whether to use separate evaluations per fold.protected adams.gui.core.BaseCheckBox
m_CheckBoxUseViews
whether to use views.protected adams.gui.core.BaseComboBox<String>
m_ComboBoxDatasets
the datasets.protected WekaCrossValidationExecution
m_CrossValidation
performs the actual evaluation.protected adams.gui.goe.GenericObjectEditorPanel
m_GOEFinalModel
how to produce the final model.protected adams.gui.goe.GenericObjectEditorPanel
m_GOEGenerator
the fold generator.protected adams.gui.goe.GenericObjectEditorPanel
m_GOEJobRunner
the jobrunner.protected DefaultComboBoxModel<String>
m_ModelDatasets
the datasets model.protected adams.gui.core.ParameterPanel
m_PanelParameters
the panel with the parameters.protected adams.gui.core.ParameterPanel
m_PanelParametersAdvanced
the panel with the advanced parameters.protected adams.gui.chooser.SelectOptionPanel
m_SelectAdditionalAttributes
the additional attributes to store.protected JSpinner
m_SpinnerFolds
the number of folds.protected adams.gui.core.NumberTextField
m_TextSeed
the seed value.-
Fields inherited from class adams.gui.tools.wekainvestigator.evaluation.AbstractEvaluation
m_Owner, m_PanelOptions
-
-
Constructor Summary
Constructors Constructor Description CrossValidation()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate(int index)
Activates the specified dataset.String
canEvaluate(weka.classifiers.Classifier classifier)
Tests whether the classifier can be evaluated.void
deserialize(Map<String,Object> data, adams.core.MessageCollection errors)
Restores the objects.protected void
doEvaluate(weka.classifiers.Classifier classifier, ResultItem item)
Evaluates the classifier and updates the result item.String
getName()
Returns the name of the evaluation (displayed in combobox).String
globalInfo()
Returns a string describing the object.ResultItem
init(weka.classifiers.Classifier classifier)
Initializes the result item.protected void
initGUI()
Initializes the widgets.protected void
initialize()
Initializes the members.boolean
isStopped()
Whether the execution has been stopped.Map<String,Object>
serialize(Set<AbstractInvestigatorTab.SerializationOption> options)
Returns the objects for serialization.void
stopExecution()
Stops the execution.void
update()
Updates the settings panel.-
Methods inherited from class adams.gui.tools.wekainvestigator.tab.classifytab.evaluation.AbstractClassifierEvaluation
evaluate, fillWithAttributeNames, getEvaluations, transferAdditionalAttributes
-
Methods inherited from class adams.gui.tools.wekainvestigator.evaluation.AbstractEvaluation
addObjectSize, addToHistory, getOwner, getPanel, getProperties, getTestingUpdateInterval, isValidDataIndex, listOrArray, setOwner, showStatus, toString
-
-
-
-
Field Detail
-
KEY_DATASET
public static final String KEY_DATASET
- See Also:
- Constant Field Values
-
KEY_FOLDS
public static final String KEY_FOLDS
- See Also:
- Constant Field Values
-
KEY_PERFOLDOUTPUT
public static final String KEY_PERFOLDOUTPUT
- See Also:
- Constant Field Values
-
KEY_SEED
public static final String KEY_SEED
- See Also:
- Constant Field Values
-
KEY_JOBRUNNER
public static final String KEY_JOBRUNNER
- See Also:
- Constant Field Values
-
KEY_ADDITIONAL
public static final String KEY_ADDITIONAL
- See Also:
- Constant Field Values
-
KEY_USEVIEWS
public static final String KEY_USEVIEWS
- See Also:
- Constant Field Values
-
KEY_GENERATOR
public static final String KEY_GENERATOR
- See Also:
- Constant Field Values
-
KEY_DISCARDPREDICTIONS
public static final String KEY_DISCARDPREDICTIONS
- See Also:
- Constant Field Values
-
KEY_FINALMODEL
public static final String KEY_FINALMODEL
- See Also:
- Constant Field Values
-
m_PanelParameters
protected adams.gui.core.ParameterPanel m_PanelParameters
the panel with the parameters.
-
m_ComboBoxDatasets
protected adams.gui.core.BaseComboBox<String> m_ComboBoxDatasets
the datasets.
-
m_ModelDatasets
protected DefaultComboBoxModel<String> m_ModelDatasets
the datasets model.
-
m_SpinnerFolds
protected JSpinner m_SpinnerFolds
the number of folds.
-
m_TextSeed
protected adams.gui.core.NumberTextField m_TextSeed
the seed value.
-
m_SelectAdditionalAttributes
protected adams.gui.chooser.SelectOptionPanel m_SelectAdditionalAttributes
the additional attributes to store.
-
m_GOEGenerator
protected adams.gui.goe.GenericObjectEditorPanel m_GOEGenerator
the fold generator.
-
m_GOEFinalModel
protected adams.gui.goe.GenericObjectEditorPanel m_GOEFinalModel
how to produce the final model.
-
m_PanelParametersAdvanced
protected adams.gui.core.ParameterPanel m_PanelParametersAdvanced
the panel with the advanced parameters.
-
m_CheckBoxPerFoldOutput
protected adams.gui.core.BaseCheckBox m_CheckBoxPerFoldOutput
whether to use separate evaluations per fold.
-
m_GOEJobRunner
protected adams.gui.goe.GenericObjectEditorPanel m_GOEJobRunner
the jobrunner.
-
m_CheckBoxUseViews
protected adams.gui.core.BaseCheckBox m_CheckBoxUseViews
whether to use views.
-
m_CheckBoxDiscardPredictions
protected adams.gui.core.BaseCheckBox m_CheckBoxDiscardPredictions
whether to discard the predictions.
-
m_CrossValidation
protected WekaCrossValidationExecution m_CrossValidation
performs the actual evaluation.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractEvaluation<ClassifyTab,ResultItem>
-
initGUI
protected void initGUI()
Initializes the widgets.- Overrides:
initGUI
in classAbstractEvaluation<ClassifyTab,ResultItem>
-
getName
public String getName()
Returns the name of the evaluation (displayed in combobox).- Specified by:
getName
in classAbstractEvaluation<ClassifyTab,ResultItem>
- Returns:
- the name
-
canEvaluate
public String canEvaluate(weka.classifiers.Classifier classifier)
Tests whether the classifier can be evaluated.- Specified by:
canEvaluate
in classAbstractClassifierEvaluation
- Returns:
- null if successful, otherwise error message
-
init
public ResultItem init(weka.classifiers.Classifier classifier) throws Exception
Initializes the result item.- Specified by:
init
in classAbstractClassifierEvaluation
- Parameters:
classifier
- the current classifier- Returns:
- the initialized history item
- Throws:
Exception
- if initialization fails
-
doEvaluate
protected void doEvaluate(weka.classifiers.Classifier classifier, ResultItem item) throws Exception
Evaluates the classifier and updates the result item.- Specified by:
doEvaluate
in classAbstractClassifierEvaluation
- Parameters:
classifier
- the current classifieritem
- the item to update- Throws:
Exception
- if evaluation fails
-
update
public void update()
Updates the settings panel.- Specified by:
update
in classAbstractEvaluation<ClassifyTab,ResultItem>
-
activate
public void activate(int index)
Activates the specified dataset.- Specified by:
activate
in classAbstractEvaluation<ClassifyTab,ResultItem>
- Parameters:
index
- the index of the dataset
-
stopExecution
public void stopExecution()
Stops the execution.- Specified by:
stopExecution
in interfaceadams.core.Stoppable
-
isStopped
public boolean isStopped()
Whether the execution has been stopped.- Specified by:
isStopped
in interfaceadams.core.StoppableWithFeedback
- Returns:
- true if stopped
-
serialize
public Map<String,Object> serialize(Set<AbstractInvestigatorTab.SerializationOption> options)
Returns the objects for serialization.- Overrides:
serialize
in classAbstractEvaluation<ClassifyTab,ResultItem>
- Parameters:
options
- what to serialize- Returns:
- the mapping of the objects to serialize
-
deserialize
public void deserialize(Map<String,Object> data, adams.core.MessageCollection errors)
Restores the objects.- Overrides:
deserialize
in classAbstractEvaluation<ClassifyTab,ResultItem>
- Parameters:
data
- the data to restoreerrors
- for storing errors
-
-