Class CrossValidationPartitioner<E>.TrainingSampleStream

Namespace
NOpenNLP.Tools.Util.Eval
Assembly
NOpenNLP.Tools.dll

The CrossValidationPartitioner<E>.TrainingSampleStream which iterates over all training elements.

Note: After the test sample stream was obtained the CrossValidationPartitioner<E>.TrainingSampleStream must not be used anymore, otherwise an InvalidOperationException is thrown.

The IObjectStream<T>s must not be used anymore after the CrossValidationPartitioner<E> was moved to one of next partitions. If they are called anyway an InvalidOperationException is thrown.

public class CrossValidationPartitioner<E>.TrainingSampleStream : ObjectStreamBase<E?>, IObjectStream<E?>, IDisposable
Inheritance
CrossValidationPartitioner<E>.TrainingSampleStream
Implements
Inherited Members

Constructors

TrainingSampleStream(IObjectStream<E?>, int, int)

The CrossValidationPartitioner<E>.TrainingSampleStream which iterates over all training elements.

Note: After the test sample stream was obtained the CrossValidationPartitioner<E>.TrainingSampleStream must not be used anymore, otherwise an InvalidOperationException is thrown.

The IObjectStream<T>s must not be used anymore after the CrossValidationPartitioner<E> was moved to one of next partitions. If they are called anyway an InvalidOperationException is thrown.

public TrainingSampleStream(IObjectStream<E?> sampleStream, int numberOfPartitions, int testIndex)

Parameters

sampleStream IObjectStream<E>
numberOfPartitions int
testIndex int

Methods

Dispose(bool)

Releases the resources from this object stream.

protected override void Dispose(bool disposing)

Parameters

disposing bool

GetTestSampleStream()

Retrieves the IObjectStream<T> over the test/evaluations elements and poisons this CrossValidationPartitioner<E>.TrainingSampleStream. From now on calls to the hasNext and next methods are forbidden and will raise an InvalidOperationException.

public IObjectStream<E?> GetTestSampleStream()

Returns

IObjectStream<E>

the test sample stream

Exceptions

IOException

if there is an error during resetting the stream

Read()

Returns the next object. Calling this method repeatedly until it returns null will return each object from the underlying source exactly once.

public override E? Read()

Returns

E

the next object or null to signal that the stream is exhausted

Exceptions

IOException

if there is an error during reading

Reset()

Resets the training sample. Use this if you need to collect things before training, for example, to collect induced abbreviations or create a POS Dictionary.

public override void Reset()

Exceptions

IOException

if there is an error during resetting the stream