use of water.rapids.Val in project h2o-3 by h2oai.
the class AstMeanTest method testRowwiseMeanWithNaRm.
@Test
public void testRowwiseMeanWithNaRm() {
Frame fr = register(new Frame(Key.<Frame>make(), ar("i1", "d1", "d2", "d3", "s1"), aro(vi1, vd1, vd2, vd3, vs1)));
Val val = Rapids.exec("(mean " + fr._key + " 1 1)");
assertTrue(val instanceof ValFrame);
Frame res = register(val.getFrame());
assertEquals("Unexpected column name", "mean", res.name(0));
assertEquals("Unexpected column type", Vec.T_NUM, res.types()[0]);
assertColFrameEquals(ard(1.7 / 4, 2.9 / 4, 4.1 / 3, 10.3 / 4, 10.0 / 3), res);
}
use of water.rapids.Val in project h2o-3 by h2oai.
the class AstMeanTest method testValRowArgument.
@Test
public void testValRowArgument() {
Frame fr = register(new Frame(Key.<Frame>make(), ar("i1", "d1", "d2", "d3"), aro(vi1, vd1, vd2, vd3)));
// skip NAs
Val val = Rapids.exec("(apply " + fr._key + " 1 {x . (mean x 1)})");
assertTrue(val instanceof ValFrame);
Frame res = register(val.getFrame());
assertColFrameEquals(ard(1.7 / 4, 2.9 / 4, 4.1 / 3, 10.3 / 4, 10.0 / 3), res);
// do not skip NAs
Val val2 = Rapids.exec("(apply " + fr._key + " 1 {x . (mean x 0)})");
assertTrue(val2 instanceof ValFrame);
Frame res2 = register(val2.getFrame());
assertColFrameEquals(ard(1.7 / 4, 2.9 / 4, Double.NaN, 10.3 / 4, Double.NaN), res2);
}
use of water.rapids.Val 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);
}
use of water.rapids.Val 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);
}
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);
}
Aggregations