water.H2O类的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(215)

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

H2O介绍

[英]Start point for creating or joining an H2O Cloud.
[中]创建或加入H2O云的起点。

代码示例

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

/**
 * Compute the fraction of rows that need to be used for training during one iteration
 * @param numRows number of training rows
 * @param train_samples_per_iteration number of training rows to be processed per iteration
 * @param replicate_training_data whether of not the training data is replicated on each node
 * @return fraction of rows to be used for training during one iteration
 */
private float computeRowUsageFraction(final long numRows, final long train_samples_per_iteration, final boolean replicate_training_data) {
 float rowUsageFraction = (float)train_samples_per_iteration / numRows;
 if (replicate_training_data) rowUsageFraction /= H2O.CLOUD.size();
 assert(rowUsageFraction > 0);
 return rowUsageFraction;
}
private float rowFraction(Frame train, DeepWaterParameters p, DeepWaterModel m) {

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

public Maxout(DeepLearningParameters params, short k, int units) { super(units);
 _k = k;
 _maxIncoming=new int[params._mini_batch_size][];
 for (int i=0;i<_maxIncoming.length;++i) _maxIncoming[i]=new int[units];
 if (_k!=2) throw H2O.unimpl("Maxout is currently hardcoded for 2 channels. Trivial to enable k > 2 though.");
}
@Override protected void fprop(long seed, boolean training, int n) {

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

public void submitTask() {H2O.submitTask(this);}
public void forkTask() {fork();}

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

void set_next_Cloud( H2ONode[] h2os, int hash ) {
 synchronized(this) {
  int idx = _idx+1; // Unique 1-byte Cloud index
  if( idx == 256 ) idx=1; // wrap, avoiding zero
  CLOUDS[idx] = CLOUD = new H2O(h2os,hash,idx);
 }
 SELF._heartbeat._cloud_size=(char)CLOUD.size();
}

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

/** The main method launched in the H2O environment and
 * generating documentation.
 */
public static void main(String[] args) throws Exception {
 // Boot invoke by default mainClass water.H2O and then call runClass
 H2O.waitForCloudSize(1);
 createReSTFilesInCwd();
 H2O.exit(0);
}

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

@Override protected int size() { throw H2O.fail(); }
@Override protected int numNodes() { throw H2O.fail(); }

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

if (H2O.CLOUD.size() > 1) {
 if(H2O.SELF.getSecurityManager().securityEnabled) {
  throw new H2OIllegalArgumentException("Cannot run XGBoost on an SSL enabled cluster larger than 1 node. XGBoost does not support SSL encryption.");
 if (H2O.getCloudSize() > 1)
  error("_backend", "GPU backend is not supported in distributed mode.");
 case bernoulli:
  if( _nclass != 2 /*&& !couldBeBool(_response)*/)
   error("_distribution", technote(2, "Binomial requires the response to be a 2-class categorical"));
  break;
 case modified_huber:
  if( _nclass != 2 /*&& !couldBeBool(_response)*/)
   error("_distribution", technote(2, "Modified Huber requires the response to be a 2-class categorical."));
  break;
 case multinomial:
  if (!isClassifier()) error("_distribution", technote(2, "Multinomial requires an categorical response."));
  break;
 case huber:
  if (isClassifier()) error("_distribution", technote(2, "Huber requires the response to be numeric."));
  break;
 case poisson:
  if (isClassifier()) error("_distribution", technote(2, "Poisson requires the response to be numeric."));
  break;
 case gamma:
  if (isClassifier()) error("_distribution", technote(2, "Gamma requires the response to be numeric."));
  break;
 case tweedie:
  if (isClassifier()) error("_distribution", technote(2, "Tweedie requires the response to be numeric."));

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

if (_l2 < 0)
 dl.error("_l2", "L2 penalty must be >= 0.");
if (H2O.CLOUD.size() == 1 && _replicate_training_data)
 dl.hide("_replicate_training_data", "replicate_training_data is only valid with cloud size greater than 1.");
if (_single_node_mode && (H2O.CLOUD.size() == 1 || !_replicate_training_data))
 dl.hide("_single_node_mode", "single_node_mode is only used with multi-node operation with replicated training data.");
if (H2O.ARGS.client && _single_node_mode)
  dl.error("_loss", "Cannot use CrossEntropy loss for auto-encoder.");
 if (!classification && _loss == CrossEntropy)
  dl.error("_loss", technote(2, "For CrossEntropy loss, the response must be categorical."));
  case gamma:
  case poisson:
   dl.error("_distribution", technote(2, _distribution  + " distribution is not allowed for classification."));
   break;
  case AUTO:
  case bernoulli:
  case modified_huber:
   dl.error("_distribution", technote(2, _distribution  + " distribution is not allowed for regression."));
   break;
  case tweedie:
  dl.error("_class_sampling_factors", "class_sampling_factors requires balance_classes to be enabled.");
 if (_replicate_training_data && null != train() && train().byteSize() > 0.9*H2O.CLOUD.free_mem()/H2O.CLOUD.size() && H2O.CLOUD.size() > 1) {
  dl.error("_replicate_training_data", "Compressed training dataset takes more than 90% of avg. free available memory per node (" + 0.9*H2O.CLOUD.free_mem()/H2O.CLOUD.size() + "), cannot run with replicate_training_data.");

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

public static void waitForCloudSize(int x) {
 waitForCloudSize(x, 10000);
}

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

static public int onIce(String className) {
 Integer I = MAP.get(className);
 if( I != null ) return I;
 // Need to install a new cloud-wide type ID for className
 assert H2O.CLOUD.size() > 0 : "No cloud when getting type id for "+className;
 int id = -1;
 if( H2O.CLOUD.leader() != H2O.SELF ) // Not leader?
  id = FetchId.fetchId(className);
 return install(className,id);
}

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

public DeepwaterMojoWriter(DeepWaterModel model) {
 super(model);
 _parms = model.get_params();
 _model_info = model.model_info();
 _output = model._output;
 if (_model_info._unstable) {
  throw new UnsupportedOperationException(technote(4, "Refusing to create a MOJO for an unstable model."));
 }
}

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

@BeforeClass public static void setupCloud() {
 H2O.main(new String[] { });
}

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

if (H2O.getCloudSize() != 1)
 throw new IllegalArgumentException("Deep Water currently only supports execution of 1 node.");
_output._origNames = params._train.get().names();
 throw new IllegalArgumentException(technote(5, "Model is too large to fit into the DKV (larger than " + PrettyPrint.bytes(Value.MAX) + ")."));

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

@Before public void initCloud() {
 // Setup cloud name
 String[] args = new String[] { "-name", "h2o_test_cloud"};
 // Build a cloud of 1
 H2O.main(args);
 H2O.waitForCloudSize(1, 10*1000 /* ms */);
}

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

@BeforeClass public static void setupCloud() {
 H2O.main(new String[] {});
 _initial_keycnt = H2O.store_size();
 assert Job.all().length == 0;      // No outstanding jobs
 _testClassTimer = new Timer();
}

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

String[] workerArgs = new String[] { "-flatfile", FLATFILE, "-port", "" + PORT };
List<FlatFileEntry> flatfile = H2O.parseFlatFile(new File(FLATFILE));
HashMap<String, Host> hosts = new HashMap<String, Host>();
ArrayList<Node> workers = new ArrayList<Node>();
 w.start();
H2O.main(Utils.append(workerArgs, args));
stall_till_cloudsize(1 + workers.size(), 10000); // stall for cloud 10seconds
Log.unwrap(System.out, "");

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

if (H2O.getCloudSize() > 1) {
 Log.info("GPU backend not supported in distributed mode. Using CPU backend.");
} else if (! p.gpuIncompatibleParams().isEmpty()) {
 Log.info("GPU backend not supported for the choice of parameters (" + p.gpuIncompatibleParams() + "). Using CPU backend.");
} else if (XGBoost.hasGPU(H2O.CLOUD.members()[0], p._gpu_id)) {
 Log.info("Using GPU backend (gpu_id: " + p._gpu_id + ").");
 params.put("gpu_id", p._gpu_id);

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

final void buildModel() {
 if ((XGBoostModel.XGBoostParameters.Backend.auto.equals(_parms._backend) || XGBoostModel.XGBoostParameters.Backend.gpu.equals(_parms._backend)) &&
     hasGPU(_parms._gpu_id) && H2O.getCloudSize() == 1 && _parms.gpuIncompatibleParams().isEmpty()) {
  synchronized (XGBoostGPULock.lock(_parms._gpu_id)) {
   buildModelImpl();
  }
 } else {
  buildModelImpl();
 }
}

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

@Override protected AutoBuffer compress(AutoBuffer ab, AutoBuffer abAux) { throw H2O.fail(); }
@Override protected int size() { throw H2O.fail(); }

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

public static void stall_till_cloudsize(int x, long ms) {
  H2O.waitForCloudSize(x, ms);
  UKV.put(Job.LIST, new Job.List()); // Jobs.LIST must be part of initial keys
 }
}

相关文章