DataType
- The type of data to create the folds for.public class RandomFoldCreator<DataType> extends java.lang.Object implements ValidationFoldCreator<DataType,DataType>
RandomFoldCreator
class makes use of a randomized data
partitioner to create a set number of folds for a set of data by passing
the data to the data partitioner multiple times.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_NUM_FOLDS
The default number of folds is 10.
|
protected int |
numFolds
The number of folds to create.
|
protected RandomizedDataPartitioner<DataType> |
partitioner
The partitioner used for each fold.
|
Constructor and Description |
---|
RandomFoldCreator()
Creates a new instance of RandomFoldCreator.
|
RandomFoldCreator(int numFolds,
RandomizedDataPartitioner<DataType> partitioner)
Creates a new instance of RandomFoldCreator.
|
Modifier and Type | Method and Description |
---|---|
java.util.ArrayList<PartitionedDataset<DataType>> |
createFolds(java.util.Collection<? extends DataType> data)
Creates the folds from the given data by passing the data into the
set data partitioner multiple times.
|
int |
getNumFolds()
Gets the number of folds to create.
|
RandomizedDataPartitioner<DataType> |
getPartitioner()
Gets the randomized partitioner to use.
|
void |
setNumFolds(int numFolds)
Sets the number of folds to create.
|
void |
setPartitioner(RandomizedDataPartitioner<DataType> partitioner)
Sets the randomized partitioner to use.
|
public static final int DEFAULT_NUM_FOLDS
protected int numFolds
protected RandomizedDataPartitioner<DataType> partitioner
public RandomFoldCreator()
public RandomFoldCreator(int numFolds, RandomizedDataPartitioner<DataType> partitioner)
numFolds
- The number of folds to create.partitioner
- The partitioner to use to create the folds.public java.util.ArrayList<PartitionedDataset<DataType>> createFolds(java.util.Collection<? extends DataType> data)
createFolds
in interface ValidationFoldCreator<DataType,DataType>
data
- The data to partition into multiple folds.public int getNumFolds()
public void setNumFolds(int numFolds)
numFolds
- The number of folds to create.public RandomizedDataPartitioner<DataType> getPartitioner()
public void setPartitioner(RandomizedDataPartitioner<DataType> partitioner)
partitioner
- The randomized partitioner.