public class CrossValidationPartitioner<E>
extends java.lang.Object
Cross validation is used to evaluate the performance of a classifier when only training data is available. The training set is split into n parts and the training / evaluation is performed n times on these parts. The training partition always consists of n -1 parts and one part is used for testing.
To use the CrossValidationPartioner
a client iterates over the n
TrainingSampleStream
s. Each TrainingSampleStream
represents
one partition and is used first for training and afterwards for testing.
The TestSampleStream
can be obtained from the TrainingSampleStream
with the getTestSampleStream
method.
Modifier and Type | Class and Description |
---|---|
static class |
CrossValidationPartitioner.TrainingSampleStream<E>
The
TrainingSampleStream which iterates over
all training elements. |
Constructor and Description |
---|
CrossValidationPartitioner(java.util.Collection<E> elements,
int numberOfPartitions)
Initializes the current instance.
|
CrossValidationPartitioner(ObjectStream<E> inElements,
int numberOfPartitions)
Initializes the current instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext()
Checks if there are more partitions available.
|
CrossValidationPartitioner.TrainingSampleStream<E> |
next()
Retrieves the next training and test partitions.
|
java.lang.String |
toString() |
public CrossValidationPartitioner(ObjectStream<E> inElements, int numberOfPartitions)
inElements
- numberOfPartitions
- public CrossValidationPartitioner(java.util.Collection<E> elements, int numberOfPartitions)
elements
- numberOfPartitions
- public boolean hasNext()
public CrossValidationPartitioner.TrainingSampleStream<E> next() throws java.io.IOException
java.io.IOException
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2010 - 2020 Adobe. All Rights Reserved