Search in sources :

Example 76 with ValFrame

use of water.rapids.vals.ValFrame in project h2o-3 by h2oai.

the class AstMeanTest method testColumnwiseMeanWithNaRm.

@Test
public void testColumnwiseMeanWithNaRm() {
    Frame fr = register(new Frame(Key.<Frame>make(), ar("I", "D", "DD", "DN", "T", "S", "C"), aro(vi1, vd1, vd2, vd3, vt1, vs1, vc2)));
    Val val = Rapids.exec("(mean " + fr._key + " 1 0)");
    assertTrue(val instanceof ValFrame);
    Frame res = register(val.getFrame());
    assertArrayEquals(fr.names(), res.names());
    assertArrayEquals(ar(Vec.T_NUM, Vec.T_NUM, Vec.T_NUM, Vec.T_NUM, Vec.T_TIME, Vec.T_NUM, Vec.T_NUM), res.types());
    assertRowFrameEquals(ard(0.0, 4.0, 0.6, 2.0, 10000030.0, Double.NaN, Double.NaN), res);
}
Also used : Val(water.rapids.Val) ValFrame(water.rapids.vals.ValFrame) ValFrame(water.rapids.vals.ValFrame) Frame(water.fvec.Frame) Test(org.junit.Test)

Example 77 with ValFrame

use of water.rapids.vals.ValFrame in project h2o-3 by h2oai.

the class AstMeanTest method testColumnwiseMeanWithoutNaRm.

@Test
public void testColumnwiseMeanWithoutNaRm() {
    Frame fr = register(new Frame(Key.<Frame>make(), ar("I", "D", "DD", "DN", "T", "S", "C"), aro(vi1, vd1, vd2, vd3, vt1, vs1, vc2)));
    Val val1 = Rapids.exec("(mean " + fr._key + " 0 0)");
    assertTrue(val1 instanceof ValFrame);
    Frame res = register(val1.getFrame());
    assertArrayEquals(fr.names(), res.names());
    assertArrayEquals(ar(Vec.T_NUM, Vec.T_NUM, Vec.T_NUM, Vec.T_NUM, Vec.T_TIME, Vec.T_NUM, Vec.T_NUM), res.types());
    assertRowFrameEquals(ard(0.0, 4.0, 0.6, Double.NaN, 10000030.0, Double.NaN, Double.NaN), res);
}
Also used : Val(water.rapids.Val) ValFrame(water.rapids.vals.ValFrame) ValFrame(water.rapids.vals.ValFrame) Frame(water.fvec.Frame) Test(org.junit.Test)

Example 78 with ValFrame

use of water.rapids.vals.ValFrame in project h2o-3 by h2oai.

the class AstSumAxisTest method testColumnwiseSumWithNaRm.

@Test
public void testColumnwiseSumWithNaRm() {
    Frame fr = register(new Frame(Key.<Frame>make(), ar("I", "D", "DD", "DN", "T", "S", "C"), aro(vi1, vd1, vd2, vd3, vt1, vs1, vc2)));
    Val val = Rapids.exec("(sumaxis " + fr._key + " 1 0)");
    assertTrue(val instanceof ValFrame);
    Frame res = register(val.getFrame());
    assertArrayEquals(fr.names(), res.names());
    assertArrayEquals(ar(Vec.T_NUM, Vec.T_NUM, Vec.T_NUM, Vec.T_NUM, Vec.T_TIME, Vec.T_NUM, Vec.T_NUM), res.types());
    assertRowFrameEquals(ard(0.0, 20.0, 3.0, 6.0, 50000150.0, Double.NaN, Double.NaN), res);
}
Also used : Val(water.rapids.Val) ValFrame(water.rapids.vals.ValFrame) ValFrame(water.rapids.vals.ValFrame) Frame(water.fvec.Frame) Test(org.junit.Test)

Example 79 with ValFrame

use of water.rapids.vals.ValFrame in project h2o-3 by h2oai.

the class AstSumAxisTest method testColumnwisesumWithoutNaRm.

@Test
public void testColumnwisesumWithoutNaRm() {
    Frame fr = register(new Frame(Key.<Frame>make(), ar("I", "D", "DD", "DN", "T", "S", "C"), aro(vi1, vd1, vd2, vd3, vt1, vs1, vc2)));
    Val val1 = Rapids.exec("(sumaxis " + fr._key + " 0 0)");
    assertTrue(val1 instanceof ValFrame);
    Frame res = register(val1.getFrame());
    assertArrayEquals(fr.names(), res.names());
    assertArrayEquals(ar(Vec.T_NUM, Vec.T_NUM, Vec.T_NUM, Vec.T_NUM, Vec.T_TIME, Vec.T_NUM, Vec.T_NUM), res.types());
    assertRowFrameEquals(ard(0.0, 20.0, 3.0, Double.NaN, 50000150.0, Double.NaN, Double.NaN), res);
}
Also used : Val(water.rapids.Val) ValFrame(water.rapids.vals.ValFrame) ValFrame(water.rapids.vals.ValFrame) Frame(water.fvec.Frame) Test(org.junit.Test)

Example 80 with ValFrame

use of water.rapids.vals.ValFrame in project h2o-3 by h2oai.

the class AstSumAxisTest method testColumnwisesumBinaryVec.

@Test
public void testColumnwisesumBinaryVec() {
    assertTrue(vc1.isBinary() && !vc2.isBinary());
    Frame fr = register(new Frame(Key.<Frame>make(), ar("C1", "C2"), aro(vc1, vc2)));
    Val val = Rapids.exec("(sumaxis " + fr._key + " 1 0)");
    assertTrue(val instanceof ValFrame);
    Frame res = register(val.getFrame());
    assertArrayEquals(fr.names(), res.names());
    assertArrayEquals(ar(Vec.T_NUM, Vec.T_NUM), res.types());
    assertRowFrameEquals(ard(3.0, Double.NaN), res);
}
Also used : Val(water.rapids.Val) ValFrame(water.rapids.vals.ValFrame) ValFrame(water.rapids.vals.ValFrame) Frame(water.fvec.Frame) Test(org.junit.Test)

Aggregations

ValFrame (water.rapids.vals.ValFrame)132 Frame (water.fvec.Frame)98 Val (water.rapids.Val)48 Vec (water.fvec.Vec)43 Test (org.junit.Test)38 MRTask (water.MRTask)32 Chunk (water.fvec.Chunk)24 NewChunk (water.fvec.NewChunk)23 BufferedString (water.parser.BufferedString)16 AstNumList (water.rapids.ast.params.AstNumList)11 AstNum (water.rapids.ast.params.AstNum)7 ValNum (water.rapids.vals.ValNum)7 AstRoot (water.rapids.ast.AstRoot)6 ValRow (water.rapids.vals.ValRow)6 ArrayList (java.util.ArrayList)5 Key (water.Key)5 AstStrList (water.rapids.ast.params.AstStrList)5 Futures (water.Futures)4 AstParameter (water.rapids.ast.AstParameter)4 Random (java.util.Random)3