Class CrossValidationBuilder<T extends DataObject>


public class CrossValidationBuilder<T extends DataObject> extends Object
Creates pools for cross validation based on TrainingObjectPool. If the elements cannot be distributed equally among the test pools, the excess elements are distributed to these according to the order.
Alexander Schultheis
  • Constructor Details

    • CrossValidationBuilder

      public CrossValidationBuilder(@NotNull @NotNull WriteableObjectPool<T> pool, int k, double splitRatio, boolean shuffle)
      Constructor that creates k different TrainingObjectPools from a WriteableObjectPool, each containing a test pool of size splitRatio and a training pool.
      pool - The WriteableObjectPool to be split.
      k - Number of desired TrainingObjectPools.
      splitRatio - Specifies the ratio according to which the test data is created.
      shuffle - If true, then the elements of the pool are randomly shuffled before the cross validation pools are created.
  • Method Details

    • getTrainingObjectPools

      public List<TrainingObjectPool<T>> getTrainingObjectPools()
      Method that returns the list of TrainingObjectPools of size k.
      The list of TrainingObjectPools.
    • getNextTrainingObjectPool

      public TrainingObjectPool<T> getNextTrainingObjectPool()
      Method that returns the next of the created k TrainingObjectPools.
      Next element from the list of TrainingObjectPools. Null, if no more pools are available.