public class KFoldCrossValidation extends ClassifierAssessment<KFoldCrossValidationAssessParameterSet>
myAbstractClassifier, myModel, myTempMeanResultSets, skipLastClassifiersDuringClassifierTraining| Modifier | Constructor and Description |
|---|---|
|
KFoldCrossValidation(AbstractClassifier... aCs)
Creates a new
KFoldCrossValidation from a set of
AbstractClassifiers. |
|
KFoldCrossValidation(AbstractClassifier[] aCs,
boolean buildClassifiersByCrossProduct,
TrainableStatisticalModel[]... aMs)
This constructor allows to assess a collection of given
AbstractClassifiers and those constructed using the given
TrainableStatisticalModels by a KFoldCrossValidation
. |
protected |
KFoldCrossValidation(AbstractClassifier[] aCs,
TrainableStatisticalModel[][] aMs,
boolean buildClassifiersByCrossProduct,
boolean checkAlphabetConsistencyAndLength)
Creates a new
KFoldCrossValidation from an array of
AbstractClassifiers and a two-dimensional array of TrainableStatisticalModel
s, which are combined to additional classifiers. |
|
KFoldCrossValidation(boolean buildClassifiersByCrossProduct,
TrainableStatisticalModel[]... aMs)
Creates a new
KFoldCrossValidation from a set of TrainableStatisticalModels. |
| Modifier and Type | Method and Description |
|---|---|
ListResult |
assessWithPredefinedSplits(NumericalPerformanceMeasureParameterSet mp,
ClassifierAssessmentAssessParameterSet caaps,
ProgressUpdater pU,
DataSet[][] splitData,
double[][][] splitWeights)
This method implements a k-fold crossvalidation on previously split data.
|
protected void |
evaluateClassifier(NumericalPerformanceMeasureParameterSet mp,
KFoldCrossValidationAssessParameterSet assessPS,
DataSet[] s,
double[][] weights,
ProgressUpdater pU)
Evaluates a classifier.
|
KFoldCrossValidationAssessParameterSet |
getAssessParameterSet()
This method returns an instance of
ClassifierAssessmentAssessParameterSet that can be used in the assess methods. |
assess, assess, assess, assess, getClassifier, getNameOfAssessment, prepareAssessment, test, trainprotected KFoldCrossValidation(AbstractClassifier[] aCs, TrainableStatisticalModel[][] aMs, boolean buildClassifiersByCrossProduct, boolean checkAlphabetConsistencyAndLength) throws IllegalArgumentException, WrongAlphabetException, CloneNotSupportedException, ClassDimensionException
KFoldCrossValidation from an array of
AbstractClassifiers and a two-dimensional array of TrainableStatisticalModel
s, which are combined to additional classifiers. If
buildClassifiersByCrossProduct is true, the
cross-product of all TrainableStatisticalModels in aMs is built to
obtain these classifiers.aCs - the predefined classifiersaMs - the TrainableStatisticalModels that are used to build additional
classifiersbuildClassifiersByCrossProduct - Determines how classifiers are constructed using the given
models. Suppose a k-class problem. In this case, each
classifier is supposed to consist of k models, one responsible
for each class. S_i be the set of all models in
aMs[i]. Let S be the set
S_1 x S_2 x ... x S_k (cross-product).true: all possible classifiers consisting of a
subset (set of k models) of S are constructed false: one classifier consisting of the models
aMs[0][i],aMs[1][i],...,
aMs[k][i] for a fixed i is
constructed. In this case, all second dimensions of
aMs have to be equal, say m. In
total m classifiers are constructed.checkAlphabetConsistencyAndLength - indicates if alphabets and lengths shall be checked for
consistencyIllegalArgumentException - if the classifiers have different lengthsWrongAlphabetException - if the classifiers use different alphabetsCloneNotSupportedException - if something went wrong while cloningClassDimensionException - if there is something wrong with the class dimension of the
classifierClassifierAssessment.ClassifierAssessment(AbstractClassifier[],
TrainableStatisticalModel[][], boolean, boolean)public KFoldCrossValidation(AbstractClassifier... aCs) throws IllegalArgumentException, WrongAlphabetException, CloneNotSupportedException, ClassDimensionException
KFoldCrossValidation from a set of
AbstractClassifiers.aCs - contains the classifiers to be assessed.assess( ... ).s in order (s[0]
contains foreground data, s[1] contains
background data)
IllegalArgumentException - if the classifiers have different lengthsWrongAlphabetException - if not all given classifiers are defined on the same
AlphabetContainerCloneNotSupportedException - if something went wrong while cloningClassDimensionException - if there is something wrong with the class dimension of the
classifierClassifierAssessment.ClassifierAssessment(AbstractClassifier...)public KFoldCrossValidation(boolean buildClassifiersByCrossProduct,
TrainableStatisticalModel[]... aMs)
throws IllegalArgumentException,
WrongAlphabetException,
CloneNotSupportedException,
ClassDimensionException
KFoldCrossValidation from a set of TrainableStatisticalModels.
The argument buildClassifiersByCrossProduct determines how
these TrainableStatisticalModels are combined to classifiers.buildClassifiersByCrossProduct - S_i be the set of all models in
aMs[i]. Let S be the set
S_1 x S_2 x ... x S_k (cross-product).true: all possible classifiers consisting of a
subset (set of k models) of S are constructed false: one classifier consisting of the models
aMs[0][i],aMs[1][i],...,
aMs[k][i] for a fixed i is
constructed. In this case, all second dimensions of
aMs have to be equal, say m. In
total m classifiers are constructed.aMs - aMs[i]) contains the
models according to class i.s... . s in order (s[0]
contains foreground data, s[1] contains
background data)
IllegalArgumentException - if the classifiers have different lengthsWrongAlphabetException - if not all given classifiers are defined on the same
AlphabetContainerCloneNotSupportedException - if something went wrong while cloningClassDimensionException - if there is something wrong with the class dimension of the
classifierClassifierAssessment.ClassifierAssessment(boolean, TrainableStatisticalModel[][])public KFoldCrossValidation(AbstractClassifier[] aCs, boolean buildClassifiersByCrossProduct, TrainableStatisticalModel[]... aMs) throws IllegalArgumentException, WrongAlphabetException, CloneNotSupportedException, ClassDimensionException
AbstractClassifiers and those constructed using the given
TrainableStatisticalModels by a KFoldCrossValidation
. aCs - contains some AbstractClassifiers that should be
assessed in addition to the AbstractClassifier
constructed using the given
TrainableStatisticalModelsbuildClassifiersByCrossProduct - S_i be the set of all models in
aMs[i]. Let S be the set
S_1 x S_2 x ... x S_k (cross-product).true: all possible classifiers consisting of a
subset (set of k models) of S are constructed false: one classifier consisting of the models
aMs[0][i],aMs[1][i],...,
aMs[k][i] for a fixed i is
constructed. In this case, all second dimensions of
aMs have to be equal, say m. In
total m classifiers are constructed.aMs - aMs[i]) contains the
models according to class i.s... . s in order (s[0]
contains foreground data, s[1] contains
background data)
IllegalArgumentException - if the classifiers have different lengthsWrongAlphabetException - if not all given classifiers are defined on the same
AlphabetContainerCloneNotSupportedException - if something went wrong while cloningClassDimensionException - if there is something wrong with the class dimension of the
classifierClassifierAssessment.ClassifierAssessment(AbstractClassifier[],
boolean, TrainableStatisticalModel[][])protected void evaluateClassifier(NumericalPerformanceMeasureParameterSet mp, KFoldCrossValidationAssessParameterSet assessPS, DataSet[] s, double[][] weights, ProgressUpdater pU) throws IllegalArgumentException, Exception
evaluateClassifier in class ClassifierAssessment<KFoldCrossValidationAssessParameterSet>mp - defines which performance measures are used to assess
classifierspU - the progress updater which shows the progress of the k-fold
crossvalidations - contains the data to be used for assessment. The order of
data sets is important. s. If
the models are trained directly, the order of the given models
during initiation of this assessment object determines, which
data set will be used for training which model. In general the
first model will be trained using the first data set in
s... . s in order (s[0]
contains foreground data, s[1] contains
background data)
assessPS - contains parameters for a run of this
KFoldCrossValidation. Must be of type
KFoldCrossValidationAssessParameterSet.weights - the (non-negative) weights for the data;
weight for each data set (first dimension) and each sequence (second dimension),
can be null which is the same as weight 1 for all sequences in all data setsIllegalArgumentException - if the given assessPS is not of type
KFoldCrossValidationAssessParameterSetException - if something went wrongClassifierAssessment.evaluateClassifier(NumericalPerformanceMeasureParameterSet, ClassifierAssessmentAssessParameterSet, DataSet[], double[][], ProgressUpdater)public ListResult assessWithPredefinedSplits(NumericalPerformanceMeasureParameterSet mp, ClassifierAssessmentAssessParameterSet caaps, ProgressUpdater pU, DataSet[][] splitData, double[][][] splitWeights) throws Exception
mp - defines which performance measures are used to assess
classifierscaaps - contains the defined element length and choice whether an
exception should be thrown if a measure could not be computedpU - the progress updater which shows the progress of the k-fold
crossvalidationsplitData - the previously split data; splitData[i] contains
the splits for class i; therefore the length of
each subarray splitData[i] has to to be identicalsplitWeights - the (non-negative) weights for the previously split data;
weight for each split (first dimension) of each data set (second dimension) and each sequence (third dimension),
can be null which is the same as weight 1 for all sequences in all data setsListResultException - if something went wrongpublic KFoldCrossValidationAssessParameterSet getAssessParameterSet() throws Exception
ClassifierAssessmentClassifierAssessmentAssessParameterSet that can be used in the assess methods.getAssessParameterSet in class ClassifierAssessment<KFoldCrossValidationAssessParameterSet>ClassifierAssessmentAssessParameterSet that can be used in the assess methods.Exception - if the parameter set could not be created properlyClassifierAssessment.assess(NumericalPerformanceMeasureParameterSet, ClassifierAssessmentAssessParameterSet, DataSet...),
ClassifierAssessment.assess(NumericalPerformanceMeasureParameterSet, ClassifierAssessmentAssessParameterSet, ProgressUpdater, DataSet[]),
ClassifierAssessment.assess(NumericalPerformanceMeasureParameterSet, ClassifierAssessmentAssessParameterSet, ProgressUpdater, DataSet[], double[][])