public class CrossValidation
extends java.lang.Object
Constructor | Description |
---|---|
CrossValidation() |
|
CrossValidation(MemoryContainer memoryContainer) |
|
CrossValidation(MemoryContainer memoryContainer,
int numFolds) |
|
CrossValidation(MemoryContainer memoryContainer,
int decisionAttributeIndex,
int numFolds) |
Modifier and Type | Method | Description |
---|---|---|
int |
getDecisionAttributeIndex() |
|
MersenneTwisterFast |
getMersenneTwiterNumberGenerator(long seed) |
Returns a MersenneTwister random number generator.
|
int |
getNumFolds() |
|
java.util.Random |
getRandomNumberGenerator(long seed) |
Returns a random number generator.
|
int[] |
getStratifiedInstancesIndices() |
|
MemoryContainer |
getTestDataSet(int numFold) |
Creates the test set for one fold of a cross-validation on
the dataset.
|
MemoryContainer |
getTrainDataSet(int numFold) |
Creates the training set for one fold of a cross-validation
on the dataset.
|
MemoryContainer |
getWholeDataSet() |
|
void |
setDecisionAttributeIndex(int decisionAttributeIndex) |
|
void |
setNumFolds(int numFolds) |
|
void |
storeClassesNumerosity(java.lang.String fileName) |
Creates a file that contains numerosity of decision classess in each
of test decision sets used to perform cross validation.
|
void |
storeCrossValidationCSV(java.lang.String fileName) |
Creates csv file to be used by UTADIS to distinguish objects used
in cross validation train and test folds.
|
void |
stratify() |
Stratifies indices of examples from
memoryContainer
according to its class values if the class attribute is nominal
(so that afterwards a stratified cross-validation can be performed). |
void |
stratify(int numFolds) |
Stratifies indices of examples from
memoryContainer
according to its class values if the class attribute is nominal
(so that afterwards a stratified cross-validation can be performed). |
void |
stratify(int numFolds,
java.util.Random generator) |
Stratifies indices of examples from
memoryContainer
according to its class values if the class attribute is nominal
(so that afterwards a stratified cross-validation can be performed). |
void |
stratify(int numFolds,
MersenneTwisterFast generator) |
Stratifies indices of examples from
memoryContainer
according to its class values if the class attribute is nominal
(so that afterwards a stratified cross-validation can be performed). |
void |
stratify(java.util.Random generator) |
Stratifies indices of examples from
memoryContainer
according to its class values if the class attribute is nominal
(so that afterwards a stratified cross-validation can be performed). |
void |
stratify(MersenneTwisterFast generator) |
Stratifies indices of examples from
memoryContainer
according to its class values if the class attribute is nominal
(so that afterwards a stratified cross-validation can be performed). |
public CrossValidation()
public CrossValidation(MemoryContainer memoryContainer)
public CrossValidation(MemoryContainer memoryContainer, int numFolds)
public CrossValidation(MemoryContainer memoryContainer, int decisionAttributeIndex, int numFolds)
public void stratify(int numFolds)
memoryContainer
according to its class values if the class attribute is nominal
(so that afterwards a stratified cross-validation can be performed).numFolds
- the number of folds in the cross-validationpublic void stratify(java.util.Random generator)
memoryContainer
according to its class values if the class attribute is nominal
(so that afterwards a stratified cross-validation can be performed).generator
- random generator used to randomize example drawpublic void stratify(MersenneTwisterFast generator)
memoryContainer
according to its class values if the class attribute is nominal
(so that afterwards a stratified cross-validation can be performed).generator
- random generator used to randomize example drawpublic void stratify(int numFolds, java.util.Random generator)
memoryContainer
according to its class values if the class attribute is nominal
(so that afterwards a stratified cross-validation can be performed).numFolds
- the number of folds in the cross-validationgenerator
- random generator used to randomize example drawpublic void stratify(int numFolds, MersenneTwisterFast generator)
memoryContainer
according to its class values if the class attribute is nominal
(so that afterwards a stratified cross-validation can be performed).numFolds
- the number of folds in the cross-validationgenerator
- random generator used to randomize example drawpublic void stratify()
memoryContainer
according to its class values if the class attribute is nominal
(so that afterwards a stratified cross-validation can be performed).public int[] getStratifiedInstancesIndices()
public java.util.Random getRandomNumberGenerator(long seed)
memoryContainer
chosen based on the given seed.seed
- the given seedpublic MersenneTwisterFast getMersenneTwiterNumberGenerator(long seed)
memoryContainer
chosen based on the given seed.seed
- the given seedpublic MemoryContainer getWholeDataSet()
public MemoryContainer getTestDataSet(int numFold)
numFold
- 0 for the first fold, 1 for the second, ...public MemoryContainer getTrainDataSet(int numFold)
numFold
- 0 for the first fold, 1 for the second, ...java.lang.IllegalArgumentException
- if the number of folds is less than 2
or greater than the number of instances.public void storeCrossValidationCSV(java.lang.String fileName) throws java.io.IOException
fileName
- name of the file in which information is storedjava.io.IOException
public void storeClassesNumerosity(java.lang.String fileName) throws java.io.IOException
fileName
- name of the file in which information is storedjava.io.IOException
public int getDecisionAttributeIndex()
public void setDecisionAttributeIndex(int decisionAttributeIndex)
public int getNumFolds()
public void setNumFolds(int numFolds)