Package com.tibco.patterns.learn.training

## Class RLinkExperiment<T extends VectorExample>

- java.lang.Object
- - com.tibco.patterns.learn.training.RLinkExperiment<T>

- Direct Known Subclasses:
    `RecPairExperiment`, `VectorExperiment`

      public abstract class RLinkExperiment<T extends VectorExample>
      extends java.lang.Object

  Manages all data required for a model training experiment: training and validation datasets.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected RLinkDataSet<T>` | `trainSet` | Training dataset
    `protected RLinkDataSet<T>` | `vldSet` | Validation dataset

  - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `RLinkExperiment​(RLinkDataSet<T> allExamples, double vldProportion)` | Creates experiment with validation dataset randomly split from allExamples according to vldProportion.
    `protected` | `RLinkExperiment​(RLinkDataSet<T> trainSet, RLinkDataSet<T> vldSet)` | Creates the experiment that contains the two given datasets.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `clearPredictions()` | Clears stored predictions from all examples in both datasets.
    `RLinkDataSet<T>` | `getAllExamples()` |
    `int` | `getNFeatures()` |
    `RLinkDataSet<T>` | `getTrainSet()` |
    `RLinkDataSet<T>` | `getVldSet()` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### trainSet

          protected final RLinkDataSet<T extends VectorExample> trainSet

      Training dataset

    - #### vldSet

          protected final RLinkDataSet<T extends VectorExample> vldSet

      Validation dataset

  - ### Constructor Detail

    - #### RLinkExperiment

          protected RLinkExperiment​(RLinkDataSet<T> trainSet,
                                    RLinkDataSet<T> vldSet)

      Creates the experiment that contains the two given datasets. Use from subclasses and pass two datasets of the appropriate subtype of RLinkDataSet.
      Throws:
        `java.lang.NullPointerException` - if either dataset is null

    - #### RLinkExperiment

          protected RLinkExperiment​(RLinkDataSet<T> allExamples,
                                    double vldProportion)

      Creates experiment with validation dataset randomly split from allExamples according to vldProportion.
      Parameters:
        `vldProportion` - - the approximate percentage of examples in validation dataset
      Throws:
        `java.lang.NullPointerException` - if the given dataset is null
        `java.lang.IllegalArgumentException` - if vldProportion is not in interval [0.0, 1.0)

  - ### Method Detail

    - #### getTrainSet

          public RLinkDataSet<T> getTrainSet()

      Returns:
        internal reference to the training dataset. Not null.

    - #### getVldSet

          public RLinkDataSet<T> getVldSet()

      Returns:
        internal reference to the validation dataset. Not null.

    - #### getAllExamples

          public RLinkDataSet<T> getAllExamples()

      Returns:
        a new dataset with all examples from both training and validation datasets

    - #### getNFeatures

          public int getNFeatures()

      Returns:
        the number of features in the experiment. If not empty, both training and validation sets must have same number of features.

    - #### clearPredictions

          public void clearPredictions()

      Clears stored predictions from all examples in both datasets. If dataset(s) in this experiment have been used for training/evaluation earlier, and the convergence observer uses predictions from previous iteration (e.g. COScoreChange), then this method must be called before the first call to `Trainer.trainIteration(RLinkExperiment, TrainingObserver, ConvergenceObserver)`.