public class TestFrameBuilder
extends java.lang.Object
Example usage:
final Frame builder = new TestFrameBuilder()
.withName("testFrame")
.withColNames("ColA", "ColB", "ColC")
.withVecTypes(Vec.T_NUM, Vec.T_STR, Vec.T_CAT)
.withDataForCol(0, ard(Double.NaN, 1, 2, 3, 4, 5.6, 7))
.withDataForCol(1, ar("A", "B", "C", "E", "F", "I", "J"))
.withDataForCol(2, ar("A", "B,", "A", "C", "A", "B", "A"))
.withChunkLayout(2, 2, 2, 1)
.build();
Data for categorical column are set in the same way as for string column and leves are created automatically.
All methods in this builder are optional:
Frame fr = new TestFrameBuilder().build().Frame fr = new TestFrameBuilder().withVecTypes(Vec.T_NUM).build().Scope.| Constructor and Description |
|---|
TestFrameBuilder() |
| Modifier and Type | Method and Description |
|---|---|
water.fvec.Frame |
build() |
TestFrameBuilder |
withChunkLayout(long... chunkLayout) |
TestFrameBuilder |
withColNames(java.lang.String... colNames)
Sets the names for the columns.
|
TestFrameBuilder |
withDataForCol(int column,
double[] data)
Sets data for a particular column
|
TestFrameBuilder |
withDataForCol(int column,
int[] data)
Sets data for a particular column
|
TestFrameBuilder |
withDataForCol(int column,
long[] data)
Sets data for a particular column
|
TestFrameBuilder |
withDataForCol(int column,
java.lang.String[] data)
Sets data for a particular column
|
TestFrameBuilder |
withDomain(int column,
java.lang.String[] domain) |
TestFrameBuilder |
withName(java.lang.String frameName)
Sets the name for the frame.
|
TestFrameBuilder |
withName(java.lang.String frameName,
water.rapids.Session session) |
TestFrameBuilder |
withRandomBinaryDataForCol(int column,
int size,
long seed)
Genarate random binary data for a particular column
|
TestFrameBuilder |
withRandomDoubleDataForCol(int column,
int size,
int min,
int max,
long seed)
Genarate random double data for a particular column
|
TestFrameBuilder |
withRandomIntDataForCol(int column,
int size,
int min,
int max,
long seed)
Genarate random double data for a particular column
|
TestFrameBuilder |
withSequenceIntDataForCol(int column,
int from,
int to)
Generate sequence of integer data
|
TestFrameBuilder |
withUniformVecTypes(int nvecs,
byte vecType)
Sets the vectors types to a single, uniform value for each vector
|
TestFrameBuilder |
withVecTypes(byte... vecTypes)
Sets the vector types.
|
public TestFrameBuilder withName(java.lang.String frameName)
public TestFrameBuilder withName(java.lang.String frameName, water.rapids.Session session)
public TestFrameBuilder withColNames(java.lang.String... colNames)
public TestFrameBuilder withVecTypes(byte... vecTypes)
public TestFrameBuilder withUniformVecTypes(int nvecs, byte vecType)
nvecs - Number of vectors in the framevecType - Uniform type of the vectorspublic TestFrameBuilder withSequenceIntDataForCol(int column, int from, int to)
column - for which to set datafrom - minimal value to generate (included)to - maximum value to generate (excluded)public TestFrameBuilder withRandomIntDataForCol(int column, int size, int min, int max, long seed)
column - for which to set datasize - size of randomly generated columnmin - minimal value to generatemax - maximum value to generatepublic TestFrameBuilder withRandomDoubleDataForCol(int column, int size, int min, int max, long seed)
column - for which to set datasize - size of randomly generated columnmin - minimal value to generatemax - maximum value to generatepublic TestFrameBuilder withRandomBinaryDataForCol(int column, int size, long seed)
column - for which to set datapublic TestFrameBuilder withDataForCol(int column, java.lang.String[] data)
column - for which to set datadata - array of string datapublic TestFrameBuilder withDataForCol(int column, double[] data)
column - for which to set datadata - array of double datapublic TestFrameBuilder withDataForCol(int column, long[] data)
column - for which to set datadata - array of long datapublic TestFrameBuilder withDataForCol(int column, int[] data)
column - for which to set datadata - array of long datapublic TestFrameBuilder withDomain(int column, java.lang.String[] domain)
public TestFrameBuilder withChunkLayout(long... chunkLayout)
public water.fvec.Frame build()