public class PartitionScheme
extends java.lang.Object
This class implements a stratified scheme (equal number of examples of each class in each partition) to partition a dataset
Constructor and Description |
---|
PartitionScheme(java.lang.String source_file,
int np)
It reads the training set and creates the partitions
|
Modifier and Type | Method and Description |
---|---|
void |
createPartitionFiles()
It creates the files of each training and test partition
|
void |
deletePartitionFiles()
It deletes the files of each training and test partition
|
Instance[] |
getInstances()
It returns all the original instances
|
int |
getPartitionOfInstance(int instanceIndex)
Returns the partition where the instance with the given index belongs to.
|
java.util.Vector[] |
getPartitions()
It returns the indeces of the original instances in all partitions
|
Instance[] |
getTestPartition(int num)
It returns the test partition specified
|
Instance[] |
getTrainPartition(int num)
It returns the training partition specified
|
public PartitionScheme(java.lang.String source_file, int np)
It reads the training set and creates the partitions
source_file
- Training data filename.np
- number of partitions.public Instance[] getTrainPartition(int num)
It returns the training partition specified
num
- number of the partitionpublic Instance[] getTestPartition(int num)
It returns the test partition specified
num
- number of the partitionpublic Instance[] getInstances()
It returns all the original instances
public java.util.Vector[] getPartitions()
It returns the indeces of the original instances in all partitions
public void createPartitionFiles()
It creates the files of each training and test partition
public void deletePartitionFiles()
It deletes the files of each training and test partition
public int getPartitionOfInstance(int instanceIndex)
instanceIndex
- given instance's index.