Class LabelledDataGenerator
java.lang.Object
org.tribuo.classification.example.LabelledDataGenerator
Generates three example train and test datasets, used for unit testing.
They don't necessarily have sensible classification boundaries,
it's for testing the machinery rather than accuracy.
-
Method Summary
Modifier and TypeMethodDescriptionGenerates a pair of datasets with sparse features and unknown features in the test data.binarySparseTrainTest
(double negate) Generates a pair of datasets with sparse features and unknown features in the test data.Generates a train/test dataset pair which is dense in the features, each example has 4 features,{A,B,C,D}, and there are 4 classes, {Foo,Bar,Baz,Quux}.denseTrainTest
(double negate) Generates a train/test dataset pair which is dense in the features, each example has 4 features,{A,B,C,D}, and there are 4 classes, {Foo,Bar,Baz,Quux}.Generates an example with no features.Generates an example with the feature ids 1,5,8, which does not intersect with the ids used elsewhere in this class.Generates a pair of datasets, where the features are sparse, and unknown features appear in the test data.sparseTrainTest
(double negate) Generates a pair of datasets, where the features are sparse, and unknown features appear in the test data.
-
Method Details
-
denseTrainTest
Generates a train/test dataset pair which is dense in the features, each example has 4 features,{A,B,C,D}, and there are 4 classes, {Foo,Bar,Baz,Quux}.- Returns:
- A pair of datasets.
-
denseTrainTest
public static com.oracle.labs.mlrg.olcut.util.Pair<Dataset<Label>,Dataset<Label>> denseTrainTest(double negate) Generates a train/test dataset pair which is dense in the features, each example has 4 features,{A,B,C,D}, and there are 4 classes, {Foo,Bar,Baz,Quux}.- Parameters:
negate
- Supply -1.0 to insert some negative values into the dataset.- Returns:
- A pair of datasets.
-
sparseTrainTest
Generates a pair of datasets, where the features are sparse, and unknown features appear in the test data. It has the same 4 classes {Foo,Bar,Baz,Quux}.- Returns:
- A pair of train and test datasets.
-
sparseTrainTest
public static com.oracle.labs.mlrg.olcut.util.Pair<Dataset<Label>,Dataset<Label>> sparseTrainTest(double negate) Generates a pair of datasets, where the features are sparse, and unknown features appear in the test data. It has the same 4 classes {Foo,Bar,Baz,Quux}.- Parameters:
negate
- Supply -1.0 to negate some values in this dataset.- Returns:
- A pair of train and test datasets.
-
binarySparseTrainTest
public static com.oracle.labs.mlrg.olcut.util.Pair<Dataset<Label>,Dataset<Label>> binarySparseTrainTest()Generates a pair of datasets with sparse features and unknown features in the test data. Has binary labels {Foo,Bar}.- Returns:
- A pair of train and test datasets.
-
binarySparseTrainTest
public static com.oracle.labs.mlrg.olcut.util.Pair<Dataset<Label>,Dataset<Label>> binarySparseTrainTest(double negate) Generates a pair of datasets with sparse features and unknown features in the test data. Has binary labels {Foo,Bar}.- Parameters:
negate
- Supply -1.0 to negate some values in this dataset.- Returns:
- A pair of train and test datasets.
-
invalidSparseExample
Generates an example with the feature ids 1,5,8, which does not intersect with the ids used elsewhere in this class. This should make the example empty at prediction time.- Returns:
- An example with features {1:1.0,5:5.0,8:8.0}.
-
emptyExample
Generates an example with no features.- Returns:
- An example with no features.
-