Class RecPairSet

  • All Implemented Interfaces:
    java.lang.Iterable<RecPairExample>

    public final class RecPairSet
    extends RLinkDataSet<RecPairExample>
    A container for storing a set of RecPairExample training examples. Each example contains a record pair with associated feature scores.
    • Constructor Detail

      • RecPairSet

        public RecPairSet​(int nFeatures)
        Creates empty dataset.
        Parameters:
        nFeatures - - number of model features in each example of this dataset
      • RecPairSet

        public RecPairSet​(int nFeatures,
                          int initialCapacity)
        Creates empty dataset. Use when the number of examples that will be added is already known.
        Parameters:
        nFeatures - - number of model features in each example of this dataset
        initialCapacity - - number of examples that will be stored in this dataset
      • RecPairSet

        public RecPairSet​(java.lang.String csvFileName,
                          RecPairScorer scorer)
                   throws com.netrics.likeit.NetricsFileFormatException,
                          com.netrics.likeit.NetricsException,
                          java.io.IOException
        Constructs the dataset by loading record pairs from CSV file. The dataset is composed of RecPairExample objects.
        Parameters:
        csvFileName - - CSV file with record pairs and labels. The format of each line in CSV is: "key1,key2,label", where label is 0 or 1. Pairs with other label values are skipped. It cannot contain spaces before/after a comma.
        scorer - - the object to be used for to score record pairs in this table
        Throws:
        com.netrics.likeit.NetricsFileFormatException - - CSV file format errors
        com.netrics.likeit.NetricsException - - errors on the server
        java.io.IOException - - wrong number of entries per line; or error communicating with server.
        java.lang.IllegalArgumentException - 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.
      • RecPairSet

        public RecPairSet​(int nFeatures,
                          java.util.List<com.tibco.patterns.learn.jaxb.model.RecPairType> xmlDataset)
        Creates RecPairSet with examples copied from xmlDataset. Only examples with true/false labels are copied. These examples must contain the correct number of feature scores (calculated in advance). To be used from Learn UI.
        Parameters:
        nFeatures - - number of model features in each example of this dataset
        xmlDataset - - source dataset with examples to copy
        Throws:
        java.lang.IllegalArgumentException - if a feature score stored in a record pair inside xmlDataset is null, empty, or contains an invalid value. All values must be between 0 and 1, or -1 for an empty feature. Or if number of field values is 0 or it is not the same in the two XML lists. Or if number of feature scores in XML does not match this dataset. Of if number of records in any XML record pair is incorrect.