Package com.tibco.patterns.learn.recpair

## Class RecPairExperiment

- java.lang.Object
- - com.tibco.patterns.learn.training.RLinkExperiment<RecPairExample>
  - - com.tibco.patterns.learn.recpair.RecPairExperiment

-     public final class RecPairExperiment
      extends RLinkExperiment<RecPairExample>

  Manages a training dataset and a validation dataset. The datasets consist of record pairs.

- - ### Field Summary

    - ### Fields inherited from class com.tibco.patterns.learn.training.RLinkExperiment

      `trainSet, vldSet`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `RecPairExperiment​(double vldProportion, java.lang.String recPairCsvFileName, RecPairScorer scorer)` | Loads a single list of pairs from CSV, then divides them randomly to training and validation datasets.
    `RecPairExperiment​(int nFeatures, java.util.List<com.tibco.patterns.learn.jaxb.model.RecPairType> xmlTrainDataset, java.util.List<com.tibco.patterns.learn.jaxb.model.RecPairType> xmlVldDataset)` | Creates RecPairExperiment with training examples imported from the two given XML datasets.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `copyModelResultsToXml​(java.util.List<com.tibco.patterns.learn.jaxb.model.RecPairType> xmlTrainDataset, java.util.List<com.tibco.patterns.learn.jaxb.model.RecPairType> xmlVldDataset, com.tibco.patterns.learn.jaxb.model.ObjectFactory factory)` | Copies RLink predictions for all examples to XML datasets.

    - ### Methods inherited from class com.tibco.patterns.learn.training.RLinkExperiment

      `clearPredictions, getAllExamples, getNFeatures, getTrainSet, getVldSet`

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

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

- - ### Constructor Detail

    - #### RecPairExperiment

          public RecPairExperiment​(double vldProportion,
                                   java.lang.String recPairCsvFileName,
                                   RecPairScorer scorer)
                            throws com.netrics.likeit.NetricsFileFormatException,
                                   java.io.IOException,
                                   com.netrics.likeit.NetricsException

      Loads a single list of pairs from CSV, then divides them randomly to training and validation datasets. Calculates symmetric feature scores for each pair. Each line in CSV has format "Key1,Key2,label". It cannot contain spaces before/after a comma. The label is 0 or 1. Pairs with other label values are skipped.
      Parameters:
        `vldProportion` - - probability that an example is assigned to validation dataset.
        `recPairCsvFileName` - - CSV file name.
        `scorer` - - object used to calculate feature scores for each pair.
      Throws:
        `java.lang.IllegalArgumentException` - if vldProportion is not in interval [0.0, 1.0), or if number of query field values does not match the number of all fields in feature query.
        `java.lang.IllegalStateException` - if server table was not provided when creating scorer.
        `com.netrics.likeit.NetricsFileFormatException` - - CSV file format errors
        `com.netrics.likeit.NetricsException` - if an error occurred on server
        `java.io.IOException` - if number of entries per line is wrong; or error communicating with server

    - #### RecPairExperiment

          public RecPairExperiment​(int nFeatures,
                                   java.util.List<com.tibco.patterns.learn.jaxb.model.RecPairType> xmlTrainDataset,
                                   java.util.List<com.tibco.patterns.learn.jaxb.model.RecPairType> xmlVldDataset)

      Creates RecPairExperiment with training examples imported from the two given XML datasets. To be used from UI.
      Parameters:
        `nFeatures` - - number of model features in each example of this experiment
        `xmlTrainDataset` - - training dataset in XML format.
        `xmlVldDataset` - - validation dataset in XML format.

  - ### Method Detail

    - #### copyModelResultsToXml

          public void copyModelResultsToXml​(java.util.List<com.tibco.patterns.learn.jaxb.model.RecPairType> xmlTrainDataset,
                                            java.util.List<com.tibco.patterns.learn.jaxb.model.RecPairType> xmlVldDataset,
                                            com.tibco.patterns.learn.jaxb.model.ObjectFactory factory)

      Copies RLink predictions for all examples to XML datasets. To be used from UI. The given XML datasets must not be modified since creating this experiment.
      Parameters:
        `xmlTrainDataset` - - training dataset in XML format.
        `xmlVldDataset` - - validation dataset in XML format.
        `factory` - - used to create PredictionType for RecPairs