Class CrossValidationPartitioner.TrainingSampleStream<E>

  • Type Parameters:
    E -
    All Implemented Interfaces:
    java.lang.AutoCloseable, ObjectStream<E>
    Enclosing class:
    CrossValidationPartitioner<E>

    public static class CrossValidationPartitioner.TrainingSampleStream<E>
    extends java.lang.Object
    implements ObjectStream<E>
    The TrainingSampleStream which iterates over all training elements. Note: After the TestSampleStream was obtained the TrainingSampleStream must not be used anymore, otherwise a IllegalStateException is thrown. The ObjectStreams must not be used anymore after the CrossValidationPartitioner was moved to one of next partitions. If they are called anyway a IllegalStateException is thrown.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Closes the ObjectStream and releases all allocated resources.
      ObjectStream<E> getTestSampleStream()
      Retrieves the ObjectStream over the test/evaluations elements and poisons this TrainingSampleStream.
      E read()
      Returns the next object.
      void reset()
      Resets the training sample.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • read

        public E read()
               throws java.io.IOException
        Description copied from interface: ObjectStream
        Returns the next object. Calling this method repeatedly until it returns null will return each object from the underlying source exactly once.
        Specified by:
        read in interface ObjectStream<E>
        Returns:
        the next object or null to signal that the stream is exhausted
        Throws:
        java.io.IOException - if there is an error during reading
      • reset

        public void reset()
                   throws java.io.IOException
        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.
        Specified by:
        reset in interface ObjectStream<E>
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Description copied from interface: ObjectStream
        Closes the ObjectStream and releases all allocated resources. After close was called its not allowed to call read or reset.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface ObjectStream<E>
        Throws:
        java.io.IOException - if there is an error during closing the stream
      • getTestSampleStream

        public ObjectStream<E> getTestSampleStream()
                                            throws java.io.IOException
        Retrieves the ObjectStream over the test/evaluations elements and poisons this TrainingSampleStream. From now on calls to the hasNext and next methods are forbidden and will raise anIllegalArgumentException.
        Returns:
        the test sample stream
        Throws:
        java.io.IOException