water.util.Log.warn()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(11.1k)|赞(0)|评价(0)|浏览(82)

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

Log.warn介绍

[英]Log a warning to standard out, the log file and the store.
[中]将警告记录到标准输出、日志文件和存储。

代码示例

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

/** Log a warning to standard out, the log file and the store. */
static public Throwable warn(Sys t, String msg) {
 return warn(t, msg, null);
}
/** Log a warning to standard out, the log file and the store. */

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

/** Log a warning to standard out, the log file and the store. */
static public Throwable warn(String msg) {
 return warn(Sys.WATER, msg, null);
}
/** Log an information message to standard out, the log file and the store. */

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

public int[] columnMapping( String[] features ) {
 int[] map = new int[_colNames.length];
 for( int i=0; i<_colNames.length; i++ ) {
  map[i] = -1;              // Assume it is missing
  for( int j=0; j<features.length; j++ ) {
   if( _colNames[i].equals(features[j]) ) {
    if( map[i] != -1 ) throw new IllegalArgumentException("duplicate feature "+_colNames[i]);
    map[i] = j;
   }
  }
  if( map[i] == -1 ) Log.warn(Sys.SCORM,"Model feature "+_colNames[i]+" not in the provided feature list from the data");
 }
 return map;
}

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

/**
 * We had a report from a user that H2O didn't start properly on MacOS X in a
 * case where the user was part of the root group.  So warn about it.
 */
public static void printWarningIfRootOnMac() {
 String os_name = System.getProperty("os.name");
 if (os_name.equals("Mac OS X")) {
  String user_name = System.getProperty("user.name");
  if (user_name.equals("root")) {
   Log.warn("Running as root on MacOS; check if java binary is unintentionally setuid");
  }
 }
}

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

private static void bbstats( AtomicInteger ai ) {
 if( !DEBUG ) return;
 if( (ai.incrementAndGet()&511)==511 ) {
  Log.warn("BB make="+BBMAKE.get()+" free="+BBFREE.get()+" cache="+BBCACHE.get()+" size="+BBS.size());
 }
}

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

private void try2Recover(int attempt, IOException e) {
 if(attempt == _retries) Throwables.propagate(e);
 Log.warn("[H2OS3InputStream] Attempt("+attempt + ") to recover from " + e.getMessage() + "), off = " + _off);
 try{_is.close();}catch(IOException ex){}
 _is = null;
 if(attempt > 0) try {Thread.sleep(256 << attempt);}catch(InterruptedException ex){}
 open();
 return;
}

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

@Override
protected boolean toJavaCheckTooBig() {
 if(beta() != null && beta().length > 10000) {
  Log.warn("toJavaCheckTooBig must be overridden for this model type to render it in the browser");
  return true;
 }
 return false;
}

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

@SuppressWarnings("unused")
@Override protected void init() {
 super.init();
 // Initialize local variables
 _mtry = (mtries==-1) ? // classification: mtry=sqrt(_ncols), regression: mtry=_ncols/3
   ( classification ? Math.max((int)Math.sqrt(_ncols),1) : Math.max(_ncols/3,1))  : mtries;
 if (!(1 <= _mtry && _mtry <= _ncols)) throw new IllegalArgumentException("Computed mtry should be in interval <1,#cols> but it is " + _mtry);
 if (!(0.0 < sample_rate && sample_rate <= 1.0)) throw new IllegalArgumentException("Sample rate should be interval (0,1> but it is " + sample_rate);
 if (DEBUG_DETERMINISTIC && seed == -1) _seed = 0x1321e74a0192470cL; // fixed version of seed
 else if (seed == -1) _seed = _seedGenerator.nextLong(); else _seed = seed;
 if (sample_rate==1f && validation!=null)
  Log.warn(Sys.DRF__, "Sample rate is 100% and no validation dataset is specified. There are no OOB data to compute out-of-bag error estimation!");
 if (!classification && do_grpsplit) {
  Log.info(Sys.DRF__, "Group splitting not supported for DRF regression. Forcing group splitting to false.");
  do_grpsplit = false;
 }
}

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

/** Add a Warn UserFeedbackEvent and log. */
public void warn(UserFeedbackEvent.Stage stage, String message) {
 Log.warn(stage+": "+message);
 addEvent(new UserFeedbackEvent(autoML, UserFeedbackEvent.Level.Warn, stage, message));
}

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

public static InputStream openStream(Key k, ProgressMonitor pmon) throws IOException {
 H2OHdfsInputStream res = null;
 Path p = new Path(k.toString());
 try {
  res = new H2OHdfsInputStream(p, 0, pmon);
 } catch( IOException e ) {
  try {
   Thread.sleep(1000);
  } catch( Exception ex ) {}
  Log.warn("Error while opening HDFS key " + k.toString() + ", will wait and retry.");
  res = new H2OHdfsInputStream(p, 0, pmon);
 }
 return res;
}

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

private void exposeRawEnumArray(CtClass cc) throws NotFoundException, CannotCompileException {
  CtField field;
  try {
   field = cc.getField("$VALUES");
  } catch( NotFoundException nfe ) {
   // Eclipse apparently stores this in a different place.
   field = cc.getField("ENUM$VALUES");
  }
  String body = "public static "+cc.getName()+" raw_enum(int i) { return i==255?null:"+field.getName()+"[i]; } ";
  try {
   cc.addMethod(CtNewMethod.make(body,cc));
  } catch( CannotCompileException ce ) {
   Log.warn(Sys.WATER,"--- Compilation failure while compiler raw_enum for "+cc.getName()+"\n"+body+"\n------",ce);
   throw ce;
  }
}

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

public void solve(double[] result) {
 System.arraycopy(_xy, 0, result, 0, _xy.length);
 _chol.solve(result);
 double gerr = Double.POSITIVE_INFINITY;
 if (_addedL2) { // had to add l2-pen to turn the gram to be SPD
  double[] oldRes = MemoryManager.arrayCopyOf(result, result.length);
  for (int i = 0; i < 1000; ++i) {
   solve(oldRes, result);
   double[] g = gradient(result)._gradient;
   gerr = Math.max(-ArrayUtils.minValue(g), ArrayUtils.maxValue(g));
   if (gerr < 1e-4) return;
   System.arraycopy(result, 0, oldRes, 0, result.length);
  }
  Log.warn("Gram solver did not converge, gerr = " + gerr);
 }
}

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

@Override
public void map(Chunk[] cs) {
 if (_strataMin < 0 || _strataMax < 0) {
  Log.warn("No Huber math can be done since there's no strata.");
  return;
 }
 final int nstrata = _strataMax - _strataMin + 1;
 Log.info("Computing Huber math for (up to) " + nstrata + " different strata.");
 _huberGamma = new double[nstrata];
 _wcounts = new double[nstrata];
 Chunk weights = fm.weightIndex >= 0 ? cs[fm.weightIndex] : new C0DChunk(1, cs[0]._len);
 Chunk stratum = cs[fm.nids0Index];
 Chunk diffMinusMedianDiff = cs[cs.length - 1];
 for (int row = 0; row < cs[0]._len; ++row) {
  int nidx = (int) stratum.at8(row) - _strataMin; //get terminal node for this row
  _huberGamma[nidx] += weights.atd(row) * Math.signum(diffMinusMedianDiff.atd(row)) * Math.min(Math.abs(diffMinusMedianDiff.atd(row)), _huberDelta);
  _wcounts[nidx] += weights.atd(row);
 }
}

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

public void checkNumRows(Frame before, Frame after) {
 long droppedCount = before.numRows()- after.numRows();
 if(droppedCount != 0) {
  Log.warn(String.format("Number of rows has dropped by %d after manipulations with frame ( %s , %s ).", droppedCount, before._key, after._key));
 }
}

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

private ModelMetrics makeModelMetrics(SharedTreeModel model, Frame fr, Frame adaptedFr, Frame preds) {
 ModelMetrics mm;
 if (model._output.nclasses() == 2 && _computeGainsLift) {
  assert preds != null : "Predictions were pre-created";
  mm = _mb.makeModelMetrics(model, fr, adaptedFr, preds);
 } else {
  boolean calculatePreds = preds == null && model._parms._distribution == DistributionFamily.huber;
  // FIXME: PUBDEV-4992 we should avoid doing full scoring!
  if (calculatePreds) {
   Log.warn("Going to calculate predictions from scratch. This can be expensive for large models! See PUBDEV-4992");
   preds = model.score(fr);
  }
  mm = _mb.makeModelMetrics(model, fr, null, preds);
  if (calculatePreds && (preds != null))
   preds.remove();
 }
 return mm;
}

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

private void initialXClosedForm(DataInfo dinfo, Archetypes yt_arch, double[] normSub, double[] normMul) {
 Log.info("Initializing X = AY'(YY' + gamma I)^(-1) where A = training data");
 double[][] ygram = ArrayUtils.formGram(yt_arch._archetypes);
 if (_parms._gamma_y > 0) {
  for (int i = 0; i < ygram.length; i++)
   ygram[i][i] += _parms._gamma_y;
 }
 CholeskyDecomposition yychol = regularizedCholesky(ygram, 10, false);
 if(!yychol.isSPD())
  Log.warn("Initialization failed: (YY' + gamma I) is non-SPD. Setting initial X to standard normal" +
      " random matrix. Results will be numerically unstable");
 else {
  CholMulTask cmtsk = new CholMulTask(yychol, yt_arch, _ncolA, _ncolX, dinfo._cats, normSub, normMul);
  cmtsk.doAll(dinfo._adaptedFrame);
 }
}

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

@Override protected void postGlobal(){
  if (H2O.CLOUD.size() > 1 && !_output.get_params().replicate_training_data) {
   long now = System.currentTimeMillis();
   if (_chunk_node_count < H2O.CLOUD.size() && (now - _lastWarn > 5000) && _warnCount < 3) {
//        Log.info("Synchronizing across " + _chunk_node_count + " H2O node(s).");
    Log.warn(H2O.CLOUD.size() - _chunk_node_count + " node(s) (out of " + H2O.CLOUD.size()
        + ") are not contributing to model updates. Consider setting replicate_training_data to true or using a larger training dataset (or fewer H2O nodes).");
    _lastWarn = now;
    _warnCount++;
   }
  }
  if (!_output.get_params().replicate_training_data || H2O.CLOUD.size() == 1) {
   _output.div(_chunk_node_count);
   _output.add_processed_global(_output.get_processed_local());
   _output.set_processed_local(0l);
  }
  assert(_input == null);
 }

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

@Override protected void execImpl() {
 Vec va = null;
 try {
  va = vactual.toEnum(); // always returns TransfVec
  actual_domain = va._domain;
  if (max_k > predict.numCols()-1) {
   Log.warn("Reducing Hitratio Top-K value to maximum value allowed: " + String.format("%,d", predict.numCols() - 1));
   max_k = predict.numCols() - 1;
  }
  final Frame actual_predict = new Frame(predict.names().clone(), predict.vecs().clone());
  actual_predict.replace(0, va); // place actual labels in first column
  hit_ratios = new HitRatioTask(max_k, seed).doAll(actual_predict).hit_ratios();
 } finally {       // Delete adaptation vectors
  if (va!=null) UKV.remove(va._key);
 }
}

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

public static DHistogram[] initialHist(Frame fr, int ncols, int nbins, DHistogram hs[], long seed, SharedTreeModel.SharedTreeParameters parms, Key[] globalQuantilesKey) {
 Vec vecs[] = fr.vecs();
 for( int c=0; c<ncols; c++ ) {
  Vec v = vecs[c];
  final double minIn = v.isCategorical() ? 0 : Math.max(v.min(),-Double.MAX_VALUE); // inclusive vector min
  final double maxIn = v.isCategorical() ? v.domain().length-1 : Math.min(v.max(), Double.MAX_VALUE); // inclusive vector max
  final double maxEx = v.isCategorical() ? v.domain().length : find_maxEx(maxIn,v.isInt()?1:0);     // smallest exclusive max
  final long vlen = v.length();
  try {
   hs[c] = v.naCnt() == vlen || v.min() == v.max() ?
     null : make(fr._names[c], nbins, (byte) (v.isCategorical() ? 2 : (v.isInt() ? 1 : 0)), minIn, maxEx, seed, parms, globalQuantilesKey[c]);
  } catch(StepOutOfRangeException e) {
   hs[c] = null;
   Log.warn("Column " + fr._names[c]  + " with min = " + v.min() + ", max = " + v.max() + " has step out of range (" + e.getMessage() + ") and is ignored.");
  }
  assert (hs[c] == null || vlen > 0);
 }
 return hs;
}

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

private static double[] defaultMetricForModel(Model m, ModelMetrics mm) {
 if (m._output.isBinomialClassifier()) {
  return new double[] {(((ModelMetricsBinomial)mm).auc()),((ModelMetricsBinomial) mm).logloss(), ((ModelMetricsBinomial) mm).mean_per_class_error(), mm.rmse(), mm.mse()};
 } else if (m._output.isMultinomialClassifier()) {
  return new double[] {(((ModelMetricsMultinomial)mm).mean_per_class_error()), ((ModelMetricsMultinomial) mm).logloss(), mm.rmse(), mm.mse()};
 } else if (m._output.isSupervised()) {
  return new double[] {((ModelMetricsRegression)mm).mean_residual_deviance(),mm.rmse(), mm.mse(), ((ModelMetricsRegression) mm).mae(), ((ModelMetricsRegression) mm).rmsle()};
 }
 Log.warn("Failed to find metric for model: " + m);
 return new double[] {Double.NaN};
}

相关文章

微信公众号

最新文章

更多