当前位置: 首页>>代码示例>>Java>>正文


Java Frame.domains方法代码示例

本文整理汇总了Java中water.fvec.Frame.domains方法的典型用法代码示例。如果您正苦于以下问题:Java Frame.domains方法的具体用法?Java Frame.domains怎么用?Java Frame.domains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在water.fvec.Frame的用法示例。


在下文中一共展示了Frame.domains方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildOutput

import water.fvec.Frame; //导入方法依赖的package包/类
static Frame buildOutput(int[] gbCols, int noutCols, Frame fr, String[] fcnames, int ngrps, MRTask mrfill) {
  // Build the output!
  // the names of columns
  final int nCols = gbCols.length+noutCols;
  String[] names = new String[nCols];
  String[][] domains = new String[nCols][];
  for( int i=0;i<gbCols.length; i++ ) {
    names  [i] = fr.name     (gbCols[i]);
    domains[i] = fr.domains()[gbCols[i]];
  }
  for( int i=0; i<fcnames.length; i++ )
    names[i+gbCols.length] = fcnames[i];
  Vec v = Vec.makeZero(ngrps); // dummy layout vec

  // Convert the output arrays into a Frame, also doing the post-pass work
  Frame f= mrfill.doAll_numericResult(nCols,new Frame(v)).outputFrame(names,domains);
  v.remove();
  return f;
}
 
开发者ID:kyoren,项目名称:https-github.com-h2oai-h2o-3,代码行数:20,代码来源:ASTGroup.java

示例2: testModelAdaptMissing

import water.fvec.Frame; //导入方法依赖的package包/类
@Test public void testModelAdaptMissing() {
  AModel.AParms p = new AModel.AParms();
  AModel.AOutput o = new AModel.AOutput();

  Vec cat = vec(new String[]{"A","B"},0,1,0,1);
  Frame trn = new Frame();
  trn.add("cat",cat);
  o._names = trn.names();
  o._domains = trn.domains();
  trn.remove();
  AModel am = new AModel(Key.make(),p,o);
  
  Frame tst = new Frame();
  tst.add("cat", cat.makeCon(Double.NaN)); // All NAN/missing column
  Frame adapt = new Frame(tst);
  String[] warns = am.adaptTestForTrain(adapt,true, true);
  Assert.assertTrue(warns.length == 0); // No errors during adaption

  Model.cleanup_adapt( adapt, tst );
  tst.remove();
}
 
开发者ID:kyoren,项目名称:https-github.com-h2oai-h2o-3,代码行数:22,代码来源:ModelAdaptTest.java

示例3: testModelAdaptConvert

import water.fvec.Frame; //导入方法依赖的package包/类
@Test public void testModelAdaptConvert() {
  AModel.AParms p = new AModel.AParms();
  AModel.AOutput o = new AModel.AOutput();

  Frame trn = new Frame();
  trn.add("dog",vec(new String[]{"A","B"},0,1,0,1));
  o._names = trn.names();
  o._domains = trn.domains();
  trn.remove();
  AModel am = new AModel(Key.make(),p,o);
  
  Frame tst = new Frame();
  tst.add("dog",vec(2, 3, 2, 3));
  Frame adapt = new Frame(tst);
  boolean saw_iae = false;
  try { am.adaptTestForTrain(adapt, true, true); }
  catch( IllegalArgumentException iae ) { saw_iae = true; }
  Assert.assertTrue(saw_iae);

  Model.cleanup_adapt( adapt, tst );
  tst.remove();
}
 
开发者ID:kyoren,项目名称:https-github.com-h2oai-h2o-3,代码行数:23,代码来源:ModelAdaptTest.java

示例4: testModelAdaptMultinomial

import water.fvec.Frame; //导入方法依赖的package包/类
@Test public void testModelAdaptMultinomial() {
  Frame trn = parse_test_file("smalldata/junit/mixcat_train.csv");
  AModel.AParms p = new AModel.AParms();
  AModel.AOutput o = new AModel.AOutput();
  o._names = trn.names();
  o._domains = trn.domains();
  trn.remove();
  AModel am = new AModel(Key.make(),p,o);
  
  Frame tst = parse_test_file("smalldata/junit/mixcat_test.csv");
  Frame adapt = new Frame(tst);
  String[] warns = am.adaptTestForTrain(adapt,true, true);
  Assert.assertTrue(ArrayUtils.find(warns,"Test/Validation dataset column 'Feature_1' has levels not trained on: [D]")!= -1);
  Assert.assertTrue(ArrayUtils.find(warns, "Test/Validation dataset is missing training column 'Const': substituting in a column of NAs") != -1);
  Assert.assertTrue(ArrayUtils.find(warns, "Test/Validation dataset is missing training column 'Useless': substituting in a column of NAs") != -1);
  Assert.assertTrue(ArrayUtils.find(warns, "Test/Validation dataset column 'Response' has levels not trained on: [W]") != -1);
  // Feature_1: merged test & train domains
  Assert.assertArrayEquals(adapt.vec("Feature_1").domain(),new String[]{"A","B","C","D"});
  // Const: all NAs
  Assert.assertTrue(adapt.vec("Const").isBad());
  // Useless: all NAs
  Assert.assertTrue(adapt.vec("Useless").isBad());
  // Response: merged test & train domains
  Assert.assertArrayEquals(adapt.vec("Response").domain(),new String[]{"X","Y","Z","W"});

  Model.cleanup_adapt( adapt, tst );
  tst.remove();
}
 
开发者ID:kyoren,项目名称:https-github.com-h2oai-h2o-3,代码行数:29,代码来源:ModelAdaptTest.java


注:本文中的water.fvec.Frame.domains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。