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

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

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

Frame.name介绍

暂无

代码示例

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

public int[] mapNames(String[] names) {
 assert names.length == _adaptedFrame._names.length : "Names must be the same length!";
 int[] idx = new int[names.length];
 Arrays.fill(idx, -1);
 for(int i = 0; i < _adaptedFrame._names.length; i++) {
  for(int j = 0; j < names.length; j++) {
   if( names[j].equals(_adaptedFrame.name(i)) ) {
    idx[i] = j; break;
   }
  }
 }
 return idx;
}

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

public String[] ignoredCols() {  // publishes private field
 if( _ignoredCols==null ) {
  ArrayList<Integer> cols = new ArrayList<>();
  for(ColMeta c: _cols)
   if( c._ignored ) cols.add(c._idx);
  _ignoredCols=new String[cols.size()];
  for(int i=0;i<cols.size();++i)
   _ignoredCols[i]=_fr.name(cols.get(i));
 }
 return _ignoredCols;
}

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

public FrameMetadata(UserFeedback userFeedback, Frame fr, int response, String[] predictors, String datasetName, boolean isClassification) {
 this(userFeedback, fr, response, datasetName, isClassification);
 _includeCols = predictors;
 if( null==_includeCols )
  for (int i = 0; i < _fr.numCols(); ++i)
    _cols[i] = new ColMeta(_fr.vec(i),_fr.name(i),i,i==_response);
 else {
  HashSet<String> preds = new HashSet<>();
  Collections.addAll(preds,_includeCols);
  for(int i=0;i<_fr.numCols();++i)
   _cols[i] = new ColMeta(_fr.vec(i),_fr.name(i),i,i==_response,!preds.contains(_fr.name(i)));
 }
}

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

Arrays.fill(colTypes, "double");
Arrays.fill(colFormats, "%5f");
model._output._pcond[col] = new TwoDimTable(_train.name(col), null, rowNames, colNames, colTypes, colFormats,
    "Y_by_" + _train.name(col), new String[rowNames.length][], pcond[col]);
model._output._pcond[cidx] = new TwoDimTable(_train.name(cidx), null, rowNames, new String[] {"Mean", "Std_Dev"},
    new String[] {"double", "double"}, new String[] {"%5f", "%5f"}, "Y_by_" + _train.name(cidx),
    new String[rowNames.length][], pcond[cidx]);

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

@Test public void testAirlines1() { // just test that it works at all
 Frame fr = parse_test_file(Key.make("a.hex"), "smalldata/airlines/allyears2k_headers.zip");
 try {
  DataInfo dinfo = new DataInfo(
      fr.clone(),  // train
      null,        // valid
      1,           // num responses
      true,        // use all factor levels
      DataInfo.TransformType.STANDARDIZE,  // predictor transform
      DataInfo.TransformType.NONE,         // response  transform
      true,        // skip missing
      false,       // impute missing
      false,       // missing bucket
      false,       // weight
      false,       // offset
      false,       // fold
      Model.InteractionSpec.allPairwise(new String[]{fr.name(8),fr.name(16),fr.name(2)})  // interactions
  );
  dinfo.dropInteractions();
  dinfo.remove();
 } finally {
  fr.delete();
 }
}

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

@Test public void testIris3() {  // test that getting sparseRows and denseRows produce the same results
 Frame fr = parse_test_file(Key.make("a.hex"), "smalldata/iris/iris_wheader.csv");
 fr.swap(2,4);
 Model.InteractionPair[] ips = Model.InteractionPair.generatePairwiseInteractionsFromList(0, 1, 2, 3);
 DataInfo di=null;
 try {
  di = new DataInfo(
      fr.clone(),  // train
      null,        // valid
      1,           // num responses
      true,        // use all factor levels
      DataInfo.TransformType.STANDARDIZE,  // predictor transform
      DataInfo.TransformType.NONE,  // response  transform
      true,        // skip missing
      false,       // impute missing
      false,       // missing bucket
      false,       // weight
      false,       // offset
      false,       // fold
      Model.InteractionSpec.allPairwise(new String[]{fr.name(0),fr.name(1),fr.name(2),fr.name(3)})          // interactions
  );
  checker(di,true);
 } finally {
  fr.delete();
  if( di!=null ) {
   di.dropInteractions();
   di.remove();
  }
 }
}

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

GLMParameters parms = new GLMParameters(Family.gaussian);
parms._train = _weighted._key;
parms._ignored_columns = new String[]{_weighted.name(0)};
parms._response_column = _weighted.name(1);
parms._standardize = true;
parms._objective_epsilon = 0;

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

false,       // offset
    false,       // fold
    Model.InteractionSpec.allPairwise(new String[]{fr.name(8),fr.name(16),fr.name(2)})  // interactions
);

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

public MetaPass1(int idx, FrameMetadata fm) {
 Vec v = fm._fr.vec(idx);
 _response=fm._response==idx;
 String colname = fm._fr.name(idx);
  _colMeta = new ColMeta(v, colname, idx, _response);
 if( _response ) _isClassification = _colMeta.isClassification();
 _mean = v.mean();
 if(v.isCategorical()){
  _colMeta._cardinality = v.cardinality();
 }else{
  _colMeta._cardinality = 0;
 }
 int nbins = (int) Math.ceil(1 + log2(v.length()));  // Sturges nbins
 int xbins = (char) ((long) v.max() - (long) v.min());
 if(!(_colMeta._ignored) && !(_colMeta._v.isBad()) && xbins > 0) {
  _colMeta._histo = MetaCollector.DynamicHisto.makeDHistogram(colname, nbins, nbins, (byte) (v.isCategorical() ? 2 : (v.isInt() ? 1 : 0)), v.min(), v.max());
 }
 // Skewness & Kurtosis
 _colMeta._skew = AstSkewness.skewness(v, true);
 _colMeta._kurtosis = AstKurtosis.kurtosis(v, true);
}

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

false,       // offset
    false,       // fold
    Model.InteractionSpec.allPairwise(new String[]{fr.name(8),fr.name(16),fr.name(2)})           // interactions
);
checker(di,true);

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

false,       // offset
    false,       // fold
    Model.InteractionSpec.allPairwise(new String[]{fr.name(8),fr.name(16),fr.name(2)})          // interactions
);
checker(di,true);

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

@Test public void testIris1() {  // test that getting sparseRows and denseRows produce the same results
 Frame fr = parse_test_file(Key.make("a.hex"), "smalldata/iris/iris_wheader.csv");
 fr.swap(1,4);
 Model.InteractionPair[] ips = Model.InteractionPair.generatePairwiseInteractionsFromList(0, 1);
 DataInfo di=null;
 try {
  di = new DataInfo(
      fr.clone(),  // train
      null,        // valid
      1,           // num responses
      true,        // use all factor levels
      DataInfo.TransformType.NONE,  // predictor transform
      DataInfo.TransformType.NONE,  // response  transform
      true,        // skip missing
      false,       // impute missing
      false,       // missing bucket
      false,       // weight
      false,       // offset
      false,       // fold
      Model.InteractionSpec.allPairwise(new String[]{fr.name(0),fr.name(1)})          // interactions
  );
  checker(di,false);
 } finally {
  fr.delete();
  if( di!=null ) {
   di.dropInteractions();
   di.remove();
  }
 }
}

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

@Override
protected Frame postProcessPredictions(Frame adaptedFrame, Frame predictFr, Job j) {
 if (_output._calib_model == null)
  return predictFr;
 if (_output.getModelCategory() == Binomial) {
  Key<Job> jobKey = j != null ? j._key : null;
  Key<Frame> calibInputKey = Key.make();
  Frame calibOutput = null;
  try {
   Frame calibInput = new Frame(calibInputKey, new String[]{"p"}, new Vec[]{predictFr.vec(1)});
   calibOutput = _output._calib_model.score(calibInput);
   assert calibOutput._names.length == 3;
   Vec[] calPredictions = calibOutput.remove(new int[]{1, 2});
   // append calibrated probabilities to the prediction frame
   predictFr.write_lock(jobKey);
   for (int i = 0; i < calPredictions.length; i++)
    predictFr.add("cal_" + predictFr.name(1 + i), calPredictions[i]);
   return predictFr.update(jobKey);
  } finally {
   predictFr.unlock(jobKey);
   DKV.remove(calibInputKey);
   if (calibOutput != null)
    calibOutput.remove();
  }
 } else
  throw H2O.unimpl("Calibration is only supported for binomial models");
}

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

@Test public void testIris2() {  // test that getting sparseRows and denseRows produce the same results
 Frame fr = parse_test_file(Key.make("a.hex"), "smalldata/iris/iris_wheader.csv");
 fr.swap(1,4);
 Model.InteractionPair[] ips = Model.InteractionPair.generatePairwiseInteractionsFromList(0, 1);
 DataInfo di=null;
 try {
  di = new DataInfo(
      fr.clone(),  // train
      null,        // valid
      1,           // num responses
      true,        // use all factor levels
      DataInfo.TransformType.STANDARDIZE,  // predictor transform
      DataInfo.TransformType.NONE,  // response  transform
      true,        // skip missing
      false,       // impute missing
      false,       // missing bucket
      false,       // weight
      false,       // offset
      false,       // fold
      Model.InteractionSpec.allPairwise(new String[]{fr.name(0),fr.name(1)})          // interactions
  );
  checker(di,true);
 } finally {
  fr.delete();
  if( di!=null ) {
   di.dropInteractions();
   di.remove();
  }
 }
}

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

false,       // offset
    false,       // fold
    Model.InteractionSpec.allPairwise(new String[]{fr.name(8),fr.name(16),fr.name(2)})   // interactions
);
System.out.println(dinfo__withInteractions.fullN());

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

GLMParameters parms = new GLMParameters(Family.gaussian);
parms._train = _weighted._key;
parms._ignored_columns = new String[]{_weighted.name(0)};
parms._response_column = _weighted.name(1);
parms._standardize = true;
parms._objective_epsilon = 0;

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

false,       // offset
    false,       // fold
    Model.InteractionSpec.allPairwise(new String[]{fr.name(8),fr.name(16),fr.name(2)})  // interactions
);
System.out.println(dinfo__withInteractions.fullN());

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

totalExpectedColumns, transformedFrame.numCols());
for (int i = 0; i < numNoncatColumns; ++i) {
 Assert.assertEquals(mainFrame.name(i), transformedFrame.name(i));
 Assert.assertEquals(mainFrame.types()[i], transformedFrame.types()[i]);
      transformedFrame.vec(i).isNumeric());
  Assert.assertEquals("Transformed categorical column should carry the name of the original column",
      transformedFrame.name(i), mainFrame.name(i) + ".Eigen");
 Assert.assertEquals("Transformed categorical column should have the correct mean value",
     expectedMean[i-numNoncatColumns], transformedFrame.vec(i).mean(), 5e-4);

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

DRFModel.DRFParameters drfParams = new DRFModel.DRFParameters();
drfParams._train = f._key;
drfParams._response_column = f.name(responseIdx);
drfParams._ntrees = ntreesInPriorModel;
drfParams._seed = 42;
drfFromCheckpointParams._response_column = f.name(responseIdx);
drfFromCheckpointParams._ntrees = ntreesInPriorModel + ntreesInNewModel;
drfFromCheckpointParams._seed = 42;
drfFinalParams._response_column = f.name(responseIdx);
drfFinalParams._ntrees = ntreesInPriorModel + ntreesInNewModel;
drfFinalParams._seed = 42;

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

GBMModel.GBMParameters gbmParams = new GBMModel.GBMParameters();
gbmParams._train = f._key;
gbmParams._response_column = f.name(responseIdx);
gbmParams._ntrees = ntreesInPriorModel;
gbmParams._seed = 42;
gbmFromCheckpointParams._response_column = f.name(responseIdx);
gbmFromCheckpointParams._ntrees = ntreesInPriorModel + ntreesInNewModel;
gbmFromCheckpointParams._seed = 42;
gbmFinalParams._response_column = f.name(responseIdx);
gbmFinalParams._ntrees = ntreesInPriorModel + ntreesInNewModel;
gbmFinalParams._seed = 42;

相关文章