Search in sources :

Example 11 with TestFrameBuilder

use of water.fvec.TestFrameBuilder in project h2o-3 by h2oai.

the class AstMatchTest method makeTestFrame.

private Frame makeTestFrame() {
    Random rnd = new Random();
    final int len = 45000;
    double[] numData = new double[len];
    String[] strData = new String[len];
    String[] catData = new String[len];
    for (int i = 0; i < len; i++) {
        char c = (char) ('A' + rnd.nextInt('Z' - 'A'));
        numData[i] = c >= 'B' && c <= 'D' ? 1 : -1;
        strData[i] = "s" + Character.toString(c);
        catData[i] = "c" + Character.toString(c);
    }
    return new TestFrameBuilder().withName("data").withColNames("Expected", "Str", "Cat").withVecTypes(Vec.T_NUM, Vec.T_STR, Vec.T_CAT).withDataForCol(0, numData).withDataForCol(1, strData).withDataForCol(2, catData).withChunkLayout(10000, 10000, 20000, 5000).build();
}
Also used : TestFrameBuilder(water.fvec.TestFrameBuilder) Random(java.util.Random)

Example 12 with TestFrameBuilder

use of water.fvec.TestFrameBuilder in project h2o-3 by h2oai.

the class AstRectangleScalarAssignTest method makeTestFrame.

private Frame makeTestFrame() {
    Random rnd = new Random();
    final int len = 43978;
    double[] numData = new double[len];
    String[] strData = new String[len];
    String[] catData = new String[len];
    for (int i = 0; i < len; i++) {
        numData[i] = rnd.nextDouble();
        strData[i] = "s" + Character.toString((char) ('A' + rnd.nextInt('Z' - 'A')));
        catData[i] = "c" + Character.toString((char) ('0' + rnd.nextInt('9' - '0')));
    }
    return new TestFrameBuilder().withName("data").withColNames("Num", "Str", "Cat").withVecTypes(Vec.T_NUM, Vec.T_STR, Vec.T_CAT).withDataForCol(0, numData).withDataForCol(1, strData).withDataForCol(2, catData).withChunkLayout(10000, 10000, 20000, 3978).build();
}
Also used : TestFrameBuilder(water.fvec.TestFrameBuilder) Random(java.util.Random)

Aggregations

TestFrameBuilder (water.fvec.TestFrameBuilder)12 Frame (water.fvec.Frame)9 Test (org.junit.Test)8 Session (water.rapids.Session)6 Val (water.rapids.Val)4 Random (java.util.Random)3 BufferedString (water.parser.BufferedString)3 IOException (java.io.IOException)1 ByteChannel (java.nio.channels.ByteChannel)1 Vec (water.fvec.Vec)1 ValFrame (water.rapids.vals.ValFrame)1 IcedLong (water.util.IcedLong)1