water.fvec.Frame.types()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中water.fvec.Frame.types()方法的一些代码示例,展示了Frame.types()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Frame.types()方法的具体详情如下:
包路径:water.fvec.Frame
类名称:Frame
方法名:types

Frame.types介绍

暂无

代码示例

代码示例来源:origin: h2oai/h2o-3

private static Frame selectByPredicate(Frame fr, Frame predicateFrame) {
 String[] names = fr.names().clone();
 byte[] types = fr.types().clone();
 String[][] domains = fr.domains().clone();
 fr.add("predicate", predicateFrame.anyVec());
 Frame filtered = new Frame.DeepSelect().doAll(types, fr).outputFrame(Key.<Frame>make(), names, domains);
 predicateFrame.delete();
 fr.remove("predicate");
 return filtered;
}

代码示例来源:origin: h2oai/h2o-3

@Override
public Frame scoreExemplarMembers(Key<Frame> destination_key, final int exemplarIdx) {
 Vec booleanCol = new MRTask() {
  @Override
  public void map(Chunk c, NewChunk nc) {
   for (int i=0;i<c._len;++i)
    nc.addNum(c.at8(i)==_exemplars[exemplarIdx].gid ? 1 : 0,0);
  }
 }.doAll(Vec.T_NUM, new Frame(new Vec[]{_exemplar_assignment_vec_key.get()})).outputFrame().anyVec();
 Frame orig = _parms.train();
 Vec[] vecs = Arrays.copyOf(orig.vecs(), orig.vecs().length+1);
 vecs[vecs.length-1] = booleanCol;
 Frame ff = new Frame(orig.names(), orig.vecs());
 ff.add("predicate", booleanCol);
 Frame res = new Frame.DeepSelect().doAll(orig.types(),ff).outputFrame(destination_key, orig.names(), orig.domains());
 FrameUtils.shrinkDomainsToObservedSubset(res);
 DKV.put(res);
 assert(res.numRows()==_counts[exemplarIdx]);
 booleanCol.remove();
 return res;
}

代码示例来源:origin: h2oai/h2o-3

byte[] types = fr.types();
final int ncols = fr.numCols();
byte[] alltypes = new byte[ncols*ratios.length];

代码示例来源:origin: h2oai/h2o-3

Frame res = new Frame.DeepSelect().doAll(orig.types(),ff).outputFrame(destination_key, orig.names(), orig.domains());
FrameUtils.shrinkDomainsToObservedSubset(res);
booleanCol.remove();

代码示例来源:origin: h2oai/h2o-3

}.doAll(_airlines.types(),_airlines).outputFrame(Key.make("airlines_train"),_airlines.names(),_airlines.domains());
_airlinesTest = new MRTask(){
 public void map(Chunk [] cs, NewChunk [] ncs){
}.doAll(_airlines.types(),_airlines).outputFrame(Key.make("airlines_test"),_airlines.names(),_airlines.domains());
_airlines.delete();

代码示例来源:origin: h2oai/h2o-3

@Override
 public void check(Frame f) {
  assertArrayEquals("Column names need to match!", ar("CString", "CBytes", "CInt", "CLong", "CFloat", "CDouble", "CBoolean", "CNull"), f.names());
  assertArrayEquals("Column types need to match!", ar(Vec.T_STR, Vec.T_STR, Vec.T_NUM, Vec.T_NUM, Vec.T_NUM, Vec.T_NUM, Vec.T_NUM, Vec.T_BAD), f.types());
  int nrows = nrows();
  BufferedString bs = new BufferedString();
  for (int row = 0; row < nrows; row++) {
   assertEquals("Value in column CString", String.valueOf(row), f.vec(0).atStr(bs, row).toString());
   assertEquals("Value in column CBytes", String.valueOf(row), f.vec(1).atStr(bs, row).toString());
   assertEquals("Value in column CInt", row, f.vec(2).at8(row));
   assertEquals("Value in column CLong", row, f.vec(3).at8(row));
   assertEquals("Value in column CFloat", row, f.vec(4).at(row), EPSILON);
   assertEquals("Value in column CDouble", row, f.vec(5).at(row), EPSILON);
   assertEquals("Value in column CBoolean", (row & 1) == 1, (((int) f.vec(5).at(row)) & 1) == 1);
   assertTrue("Value in column CNull", f.vec(7).isNA(row));
  }
 }
}

代码示例来源:origin: h2oai/h2o-3

@Override
 public void check(Frame f) {
  assertArrayEquals("Column names need to match!", ar("CUString", "CUBytes", "CUInt", "CULong", "CUFloat", "CUDouble", "CUBoolean"), f.names());
  assertArrayEquals("Column types need to match!", ar(Vec.T_STR, Vec.T_STR, Vec.T_NUM, Vec.T_NUM, Vec.T_NUM, Vec.T_NUM, Vec.T_NUM), f.types());
  int nrows = nrows();
  BufferedString bs = new BufferedString();
  // NA in the first row
  for (int col = 0; col < ncols(); col++) {
   assertTrue("NA should be in first row and col " + col, f.vec(col).isNA(0));
  }
  for (int row = 1; row < nrows; row++) {
   assertEquals("Value in column CString", String.valueOf(row), f.vec(0).atStr(bs, row).toString());
   assertEquals("Value in column CBytes", String.valueOf(row), f.vec(1).atStr(bs, row).toString());
   assertEquals("Value in column CInt", row, f.vec(2).at8(row));
   assertEquals("Value in column CLong", row, f.vec(3).at8(row));
   assertEquals("Value in column CFloat", row, f.vec(4).at(row), EPSILON);
   assertEquals("Value in column CDouble", row, f.vec(5).at(row), EPSILON);
   assertEquals("Value in column CBoolean", (row & 1) == 1, (((int) f.vec(5).at(row)) & 1) == 1);
  }
 }
}

代码示例来源:origin: h2oai/h2o-3

@Override
 public void check(Frame f) {
  assertArrayEquals("Column names need to match!", ar("CEnum", "CUEnum"), f.names());
  assertArrayEquals("Column types need to match!", ar(Vec.T_CAT, Vec.T_CAT), f.types());
  assertArrayEquals("Category names need to match in CEnum!", categories[0], f.vec("CEnum").domain());
  assertArrayEquals("Category names need to match in CUEnum!", categories[1], f.vec("CUEnum").domain());
  int numOfCategories1 = categories[0].length;
  int numOfCategories2 = categories[1].length;
  int nrows = nrows();
  for (int row = 0; row < nrows; row++) {
   assertEquals("Value in column CEnum", row % numOfCategories1, (int) f.vec("CEnum").at(row));
   if (row % (numOfCategories2+1) == 0) assertTrue("NA should be in row " + row + " and col CUEnum", f.vec("CUEnum").isNA(row));
   else assertEquals("Value in column CUEnum", row % numOfCategories2, (int) f.vec("CUEnum").at(row));
  }
 }
}

代码示例来源:origin: h2oai/h2o-3

for (int i = 0; i < numNoncatColumns; ++i) {
 Assert.assertEquals(mainFrame.name(i), transformedFrame.name(i));
 Assert.assertEquals(mainFrame.types()[i], transformedFrame.types()[i]);

代码示例来源:origin: ai.h2o/h2o-automl

private static Frame selectByPredicate(Frame fr, Frame predicateFrame) {
 String[] names = fr.names().clone();
 byte[] types = fr.types().clone();
 String[][] domains = fr.domains().clone();
 fr.add("predicate", predicateFrame.anyVec());
 Frame filtered = new Frame.DeepSelect().doAll(types, fr).outputFrame(Key.<Frame>make(), names, domains);
 predicateFrame.delete();
 fr.remove("predicate");
 return filtered;
}

代码示例来源:origin: ai.h2o/h2o-algos

@Override
public Frame scoreExemplarMembers(Key<Frame> destination_key, final int exemplarIdx) {
 Vec booleanCol = new MRTask() {
  @Override
  public void map(Chunk c, NewChunk nc) {
   for (int i=0;i<c._len;++i)
    nc.addNum(c.at8(i)==_exemplars[exemplarIdx].gid ? 1 : 0,0);
  }
 }.doAll(Vec.T_NUM, new Frame(new Vec[]{_exemplar_assignment_vec_key.get()})).outputFrame().anyVec();
 Frame orig = _parms.train();
 Vec[] vecs = Arrays.copyOf(orig.vecs(), orig.vecs().length+1);
 vecs[vecs.length-1] = booleanCol;
 Frame ff = new Frame(orig.names(), orig.vecs());
 ff.add("predicate", booleanCol);
 Frame res = new Frame.DeepSelect().doAll(orig.types(),ff).outputFrame(destination_key, orig.names(), orig.domains());
 FrameUtils.shrinkDomainsToObservedSubset(res);
 DKV.put(res);
 assert(res.numRows()==_counts[exemplarIdx]);
 booleanCol.remove();
 return res;
}

代码示例来源:origin: ai.h2o/h2o-algos

byte[] types = fr.types();
final int ncols = fr.numCols();
byte[] alltypes = new byte[ncols*ratios.length];

代码示例来源:origin: ai.h2o/h2o-algos

Frame res = new Frame.DeepSelect().doAll(orig.types(),ff).outputFrame(destination_key, orig.names(), orig.domains());
FrameUtils.shrinkDomainsToObservedSubset(res);
booleanCol.remove();

相关文章