Class TrainingObjectPool<T extends DataObject>

java.lang.Object
de.uni_trier.wi2.procake.data.trainingObjectPool.TrainingObjectPool<T>

public class TrainingObjectPool<T extends DataObject> extends Object
Stores training data (train, test, validate) in a single data structure rather than keeping track of three individual pools. The pool can either be created directly from three different pools or being generated by a builder. It is possible to only store train and test data.
Author:
Maximilian Hoffmann
  • Field Details

    • PATH_TRAIN_POOL

      protected String PATH_TRAIN_POOL
    • PATH_TEST_POOL

      protected String PATH_TEST_POOL
    • PATH_VALIDATE_POOL

      protected String PATH_VALIDATE_POOL
  • Constructor Details

    • TrainingObjectPool

      public TrainingObjectPool(@NotNull @NotNull WriteableObjectPool<T> trainPool, WriteableObjectPool<T> testPool, WriteableObjectPool<T> validatePool)
      Use this constructor to create the training pool from three individual pools. This way you can put together the three pools as you like. Best suited for existing implementations.
      Parameters:
      trainPool - the training pool (should not be null)
      testPool - the testing pool (can be null)
      validatePool - the validation pool (can be null)
    • TrainingObjectPool

      public TrainingObjectPool(@NotNull @NotNull String pathTrainPool, String pathTestPool, String pathValidatePool, boolean instantLoad)
      Use this constructor to create the training pool from three individual pools, which paths are given. This way you can put together the three pools as you like.
      Parameters:
      pathTrainPool - the path to the training pool (should not be null)
      pathTestPool - the path to the testing pool (can be null)
      pathValidatePool - the path to the validation pool (can be null)
      instantLoad - If true, the pools are read in directly. Otherwise, they are deserialized only when the corresponding getter methods are called. Thus, for example, the runtime can be optimized if the pools do not have to be read in at all.
    • TrainingObjectPool

      public TrainingObjectPool(@NotNull @NotNull WriteableObjectPool<T> tmpPool, TrainingObjectPoolSplit split, boolean shuffle)
      Use this constructor to create a training pool from a single pool that is split up into three separate pools. It is possible with this method to only extract a training pool (would be the entire tmpPool), to extract training and testing pools, or all three pools. This can be specified by the split.
      Parameters:
      tmpPool - the pool to split up
      split - determines how to split tmpPool
      shuffle - If true, then the elements of the pool are randomly shuffled before being split among the different pools.
  • Method Details

    • getPoolName

      public String getPoolName()
      Returns the unique name, each pool must have.
    • getTrainPool

      public WriteableObjectPool<T> getTrainPool()
      Getter method that returns the train pool. If the individual pools were not read in when the training object pool was created, the train pool is read in using this method.
      Returns:
      The train pool.
    • getTestPool

      public WriteableObjectPool<T> getTestPool()
      Getter method that returns the test pool. If the individual pools were not read in when the training object pool was created, the test pool is read in using this method.
      Returns:
      The test pool. If this was not specified, null is returned.
    • getValidatePool

      public WriteableObjectPool<T> getValidatePool()
      Getter method that returns the validate pool. If the individual pools were not read in when the training object pool was created, the validate pool is read in using this method.
      Returns:
      The validate pool. If this was not specified, null is returned.
    • getPathTrainPool

      public String getPathTrainPool()
      Getter method for the path to the xml file of the train pool.
      Returns:
      Path of the train pool file.
    • setPathTrainPool

      public void setPathTrainPool(String pathTrainPool)
      Setter method to adjust the path to the xml file of the train pool.
      Parameters:
      pathTrainPool - The (new) path to the train pool file.
    • getPathTestPool

      public String getPathTestPool()
      Getter method for the path to the xml file of the test pool.
      Returns:
      Path of the test pool file.
    • setPathTestPool

      public void setPathTestPool(String pathTestPool)
      Setter method to adjust the path to the xml file of the test pool.
      Parameters:
      pathTestPool - The (new) path to the test pool file.
    • getPathValidatePool

      public String getPathValidatePool()
      Getter method for the path to the xml file of the validate pool.
      Returns:
      Path of the validate pool file.
    • setPathValidatePool

      public void setPathValidatePool(String pathValidatePool)
      Setter method to adjust the path to the xml file of the validate pool.
      Parameters:
      pathValidatePool - The (new) path to the validate pool file.
    • hasSameValueAsIn

      public boolean hasSameValueAsIn(TrainingObjectPool<T> trainingObjectPool)
      This method makes a deep compare. The elements in both pools are compared.
      Parameters:
      trainingObjectPool - The object pool to compare.
      Returns:
      true if the given object pool has the same objects as this one.