Class RLinkDataSet<T extends VectorExample>
- java.lang.Object
-
- com.tibco.patterns.learn.training.RLinkDataSet<T>
-
- All Implemented Interfaces:
java.lang.Iterable<T>
- Direct Known Subclasses:
RecPairSet,VectorSet
public abstract class RLinkDataSet<T extends VectorExample> extends java.lang.Object implements java.lang.Iterable<T>A container for storing a set of training examples suitable for model training. Subclasses can add operations to load from CSV, etc.
-
-
Constructor Summary
Constructors Constructor Description RLinkDataSet(int nFeatures)Creates empty dataset.RLinkDataSet(int nFeatures, int initialCapacity)Creates empty dataset.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadd(T e)Adds the given example to this dataset.voidclearPredictions()Clears stored predictions from all examples.abstract RLinkDataSet<T>createDataSet()intgetNFeatures()java.util.Iterator<T>iterator()intsize()java.lang.StringtoString()static voidverifyDatasetProportion(double destProportion)Verifies the proportion of validation dataset as a percentage of all examples.
-
-
-
Field Detail
-
examples
protected final java.util.List<T extends VectorExample> examples
Stores all examples for this dataset
-
-
Constructor Detail
-
RLinkDataSet
public RLinkDataSet(int nFeatures)
Creates empty dataset.- Parameters:
nFeatures- - number of model features in each example of this dataset
-
RLinkDataSet
public RLinkDataSet(int nFeatures, int initialCapacity)Creates empty dataset. Use when the number of examples 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
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- Returns:
- a string with all examples in this dataset.
-
createDataSet
public abstract RLinkDataSet<T> createDataSet()
- Returns:
- a new empty dataset of the appropriate subclass of RLinkDataSet
-
iterator
public java.util.Iterator<T> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<T extends VectorExample>- Returns:
- an iterator over the examples in this dataset
-
add
public void add(T e)
Adds the given example to this dataset.- Parameters:
e- - the new training example. Must have matching number of features.- Throws:
java.lang.IllegalArgumentException- if number of features in the given example does not match the number of features for this dataset.
-
size
public int size()
- Returns:
- the number of examples in this dataset.
-
verifyDatasetProportion
public static void verifyDatasetProportion(double destProportion)
Verifies the proportion of validation dataset as a percentage of all examples.- Throws:
java.lang.IllegalArgumentException- if destProportion is not in interval [0.0, 1.0)
-
getNFeatures
public int getNFeatures()
- Returns:
- the number of features in each example in this dataset
-
clearPredictions
public void clearPredictions()
Clears stored predictions from all examples.
-
-