Class RecPairExample


  • public final class RecPairExample
    extends VectorExample
    A training example constructed based on a pair of database records. The feature vector consists of match scores for all model features (querylets).
    • Constructor Detail

      • RecPairExample

        public RecPairExample​(RecPairId recPairId,
                              java.util.List<java.lang.String> fieldValues0,
                              java.util.List<java.lang.String> fieldValues1,
                              double[] featureValues,
                              boolean label)
        Creates RecPairExample when feature values are known.
        Parameters:
        recPairId - - contains keys of the two records in the pair. Not null.
        fieldValues0 - - field values of the first record.
        fieldValues1 - - field values of the second record.
        featureValues - - the feature vector.
        label - - the label of the record pair.
        Throws:
        java.lang.IllegalArgumentException - if featureValues 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 lists.
        java.lang.NullPointerException - if recPairId, fieldValues0 or fieldValues1 is null.
      • RecPairExample

        public RecPairExample​(RecPairId recPairId,
                              RecPairScorer scorer,
                              boolean label)
                       throws java.io.IOException,
                              com.netrics.likeit.NetricsException
        Uses RecPairScorer to get field values from server table, calculates symmetric feature scores. Use when feature values are not known in advance.
        Parameters:
        recPairId - - contains keys of the two records in the pair. Not null.
        scorer - - used to calculate feature scores for this pair. Not null. Must refer to a table on server that contains the two records.
        label - - the label of the record pair.
        Throws:
        com.netrics.likeit.NetricsException - - errors on the server
        java.io.IOException - - if I/O error occurs while 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.
    • Method Detail

      • getId

        public RecPairId getId()
        Returns:
        record pair ID stored in this example.
      • getFields

        public java.util.List<java.lang.String> getFields​(int recIndex)
        Parameters:
        recIndex - - record index in the pair (0 or 1)
        Returns:
        internal list of field values for the given record.