Catalano.MachineLearning.Performance
Class KFoldCrossValidation
- java.lang.Object
-
- Catalano.MachineLearning.Performance.KFoldCrossValidation
-
- All Implemented Interfaces:
- IValidation
public class KFoldCrossValidation extends java.lang.Object implements IValidation
KFold Cross Validation.
-
-
Constructor Summary
Constructors Constructor and Description KFoldCrossValidation()Initializes a new instance of the KFoldCrossValidation class.KFoldCrossValidation(int nFolds)Initializes a new instance of the KFoldCrossValidation class.KFoldCrossValidation(int nFolds, boolean shuffle)Initializes a new instance of the KFoldCrossValidation class.KFoldCrossValidation(int nFolds, boolean shuffle, long seed)Initializes a new instance of the KFoldCrossValidation class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description intgetNumberOfFolds()Get number of the folds.booleanisShuffle()Checks if the indexes are going to be shuffled.doubleRun(IClassifier classifier, DatasetClassification dataset)Compute validation.doubleRun(IClassifier classifier, double[][] data, int[] labels)Compute validation.voidsetNumberOfFolds(int folds)Set number of the folds.voidsetShuffle(boolean shuffle)Set true if the indexes are going to be shuffled.
-
-
-
Constructor Detail
-
KFoldCrossValidation
public KFoldCrossValidation()
Initializes a new instance of the KFoldCrossValidation class.
-
KFoldCrossValidation
public KFoldCrossValidation(int nFolds)
Initializes a new instance of the KFoldCrossValidation class.- Parameters:
nFolds- Number of folds.
-
KFoldCrossValidation
public KFoldCrossValidation(int nFolds, boolean shuffle)Initializes a new instance of the KFoldCrossValidation class.- Parameters:
nFolds- Number of folds.shuffle- Shuffle the indexes.
-
KFoldCrossValidation
public KFoldCrossValidation(int nFolds, boolean shuffle, long seed)Initializes a new instance of the KFoldCrossValidation class.- Parameters:
nFolds- Number of folds.shuffle- Shuffle the indexes.seed- Random seed generator.
-
-
Method Detail
-
getNumberOfFolds
public int getNumberOfFolds()
Get number of the folds.- Returns:
- Number of the folds.
-
setNumberOfFolds
public void setNumberOfFolds(int folds)
Set number of the folds.- Parameters:
folds- Folds.
-
isShuffle
public boolean isShuffle()
Checks if the indexes are going to be shuffled.- Returns:
- True if the indexes are going to be shuffled, othwerwise return false.
-
setShuffle
public void setShuffle(boolean shuffle)
Set true if the indexes are going to be shuffled.- Parameters:
shuffle- Indexes are going to be shuffled.
-
Run
public double Run(IClassifier classifier, DatasetClassification dataset)
Description copied from interface:IValidationCompute validation.- Specified by:
Runin interfaceIValidation- Parameters:
classifier- Classifier.dataset- Dataset.- Returns:
- Correctly classified rate.
-
Run
public double Run(IClassifier classifier, double[][] data, int[] labels)
Description copied from interface:IValidationCompute validation.- Specified by:
Runin interfaceIValidation- Parameters:
classifier- Classifier.data- Data.labels- Labels.- Returns:
- Correctly classified rate.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG