Package com.tibco.patterns.learn.recpair
Class RecPairSet
- java.lang.Object
-
- com.tibco.patterns.learn.training.RLinkDataSet<RecPairExample>
-
- com.tibco.patterns.learn.recpair.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.
-
-
Field Summary
-
Fields inherited from class com.tibco.patterns.learn.training.RLinkDataSet
examples
-
-
Constructor Summary
Constructors Constructor Description RecPairSet(int nFeatures)Creates empty dataset.RecPairSet(int nFeatures, int initialCapacity)Creates empty dataset.RecPairSet(int nFeatures, java.util.List<com.tibco.patterns.learn.jaxb.model.RecPairType> xmlDataset)Creates RecPairSet with examples copied from xmlDataset.RecPairSet(java.lang.String csvFileName, RecPairScorer scorer)Constructs the dataset by loading record pairs from CSV file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RecPairSetcreateDataSet()-
Methods inherited from class com.tibco.patterns.learn.training.RLinkDataSet
add, clearPredictions, getNFeatures, iterator, size, toString, verifyDatasetProportion
-
-
-
-
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 datasetinitialCapacity- - 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.IOExceptionConstructs 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 errorscom.netrics.likeit.NetricsException- - errors on the serverjava.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 datasetxmlDataset- - 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.
-
-
Method Detail
-
createDataSet
public RecPairSet createDataSet()
- Specified by:
createDataSetin classRLinkDataSet<RecPairExample>- Returns:
- a new empty RecPairSet.The number of features is same as for this object.
-
-