Search in sources :

Example 56 with Val

use of water.rapids.Val 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 57 with Val

use of water.rapids.Val 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 58 with Val

use of water.rapids.Val 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)

Example 59 with Val

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

the class AstSumAxisTest method testRowwisesumOnFrameWithTimeandNumericColumn.

@Test
public void testRowwisesumOnFrameWithTimeandNumericColumn() {
    Frame fr = register(new Frame(Key.<Frame>make(), ar("t1", "i1"), aro(vt1, vi1)));
    Val val = Rapids.exec("(sumaxis " + fr._key + " 1 1)");
    assertTrue(val instanceof ValFrame);
    Frame res = register(val.getFrame());
    assertColFrameEquals(ard(-1, -2, 0, 2, 1), 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 60 with Val

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

the class AstSumAxisTest method testRowwisesumOnFrameWithNonnumericColumnsOnly.

@Test
public void testRowwisesumOnFrameWithNonnumericColumnsOnly() {
    Frame fr = register(new Frame(Key.<Frame>make(), ar("c1", "s1"), aro(vc2, vs1)));
    Val val = Rapids.exec("(sumaxis " + fr._key + " 1 1)");
    assertTrue(val instanceof ValFrame);
    Frame res = register(val.getFrame());
    assertEquals("Unexpected column name", "sum", res.name(0));
    assertEquals("Unexpected column type", Vec.T_NUM, res.types()[0]);
    assertColFrameEquals(ard(Double.NaN, Double.NaN, Double.NaN, 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)

Aggregations

Val (water.rapids.Val)76 Frame (water.fvec.Frame)65 Test (org.junit.Test)56 ValFrame (water.rapids.vals.ValFrame)52 Vec (water.fvec.Vec)14 ValRow (water.rapids.vals.ValRow)8 MRTask (water.MRTask)5 Session (water.rapids.Session)5 Chunk (water.fvec.Chunk)4 TestFrameBuilder (water.fvec.TestFrameBuilder)4 ValNum (water.rapids.vals.ValNum)4 NewChunk (water.fvec.NewChunk)2 AstParameter (water.rapids.ast.AstParameter)2 AstNumList (water.rapids.ast.params.AstNumList)2 CreateFrame (hex.CreateFrame)1 GLRMParameters (hex.glrm.GLRMModel.GLRMParameters)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1